Adding Bluetooth Serial Port to Asus RT-N16

I am running DebWrt on my Asus RT-N16 and it works well. The only problem that I have is: in case I misconfigure something and the device is inaccessible via the network, I need to open the case then connect a serial port to fix it. Because the configuration is in USB, I don’t have to open the case very often, in most cases, I can unplug the USB disk, mount it in my Linux machine, try to fix the configuration, plug the USB again, restart the router, and hope that my fix works. Either way, both are such a hassle.

I could have added a serial port just like my DIR-300 mod, but I think it’s not the best solution. Because I still need to bring down my router, find my serial cable, plug it in and connect to it. I wish that the device has a Bluetooth capability, so I can connect to it (via Bluetooth serial port profile), fix any problem that it has, and without moving or plugging anything, and hopefully I don’t even need to restart the router and wait for it to boot.

So I bought a 7.32 USD bluetooth module from Aliexpress and installed it on my RT-N16. Some of you may think that it is a bad idea because Bluetooth interferes (somewhat) with WIFI, but I don’t plan to keep constant connection via Bluetooth, and when I do make the connection, the data that I am transferring is very small (maybe just several kilobytes per minutes). So far in my testing, when connected via Bluetooth, I didn’t notice any speed difference in WIFI transfer speed (even when transferring large files via WIFI) and typing furiously from my Bluetooth terminal. Asus RTN16 only supports 2.4 GHz, but If your router supports 5GHz, I think you should use that band to eliminate any possible interference.

Asus RT-N16 has a serial header ready to be connected (it even has labels on it, GND, RX, TX, VCC):

IMG_4476

But before plugging in the module, I need to set the speed of the Bluetooth serial module to 115200, because the default speed is 9600. To set up the Bluetooth serial module, we need to connect it to a computer via serial port (I am using Bus Pirate for this).

My version of Bluetooth module is H-C07, and for this version, the device doesn’t use \r or \n to terminate command, it just uses time out to end a command (a complete command must be received within few hundreds millisecond). Typing very-very quickly in your terminal won’t work, so just copy and paste the command from your text editor. The command needed to set the Bluetooth module to 115200 is “AT+BAUD8”. These Bluetooth modules usually don’t come with documentation, so you need to look on the internet for your specific version.

Bluetooth

One of the nice thing about Bluetooth is: it is accessible from non-PC devices. After connecting the cables, I can connect to my router using Android Bluetooth SPP

Using Bluetooth SPP as console on Android

One thing to note: the Bluetooth module needs time to initialize, so it can not be used for accessing the bootloader. To restart the router, I need to plug and unplug the power cable. So the Bluetooth module will lose its connection when I restart the device. By the time the Bluetooth module is ready, the bootloader has already passed and you will be in the middle of Linux booting.

If you really want to use the Bluetooth module to access the bootloader, you will either need a separate power source for the Bluetooth module, or make a special reset button for the router (that doesn’t involve unplugging and plugging the device, and doesn’t cut power to the Bluetooth module).

9 thoughts on “Adding Bluetooth Serial Port to Asus RT-N16”

  1. extra (backup) battery for the module will do the trick to see what’s happening on the bootloader. A single 3V cell or a li-po should do the trick, to keep the module awake, while power is reset for the router.

    also I think there is a command to reset the router, without removing the power. (not sure about this one.

    GL

  2. The biggest problem is inter-char timeout so you need to send all the characters together, i.e. “cat AT+BAUD7 >/dev/rfcomm0” instead of using minicom or just cat.

    There might be 3.3v somewhere in the router and there are BT modules with 3.3v regulators. I added one to my chumby hacker board for a similar purpose. One for a raspberry pi should be easy. I got the base devices from suntek and created a fixture (see website).

  3. An alternative solution to the bootloader problem would be to configure the bootloader to wait 5 seconds (or however long is necessary to give the bluetooth module time to initialise) before booting a kernel.

  4. I am trying to do exactly this (with an HC-05 and SAX1V1K w/ OpenWRT)

    I was able to connect to the bluetooth from FTDI and put it into command mode, set the baud rate to 115200, 8-bit, stop bit 1, no parity, no flow control (same settings I would use when communicating with the router via USBSerial bridge).

    Unfortunately, I pair with the bluetooth module and open a console, and can’t seem to talk to the router at all.

    Curious if you might have any advice on this.

    1. Some ideas:
      – if you can connect to the bluetooth module, then it must have enough power, so i think we can rule out not enough power
      – are you sure the RX/TX is correct?
      – is the voltage correct? if router uses 3.3v and your bluetooth module is 5v, you wont get the response

      may be buy a another USB to serial, connect it to your bluetooth module to check if you can connect to it? just to see if the bluetooth module is working properly

Leave a Reply

Your email address will not be published. Required fields are marked *