Just another WordPress site

Menu

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 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 is 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 (may be 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):

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 setup 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 use time out to end a command (a complete command must be received within few hundreds millisecond). Typing very-very quickly in your terminal wont 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 doesn’t come with documentation, so you need to look on the internet for your specific version.

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

One thing to note: the bluetooth module needs time to initialize, so it is not useful for accessing the boot loader. 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 boot loader 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 boot loader, you will either need 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).

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

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.

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).

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.