rs232 bluetooth adapter

Usually, headless embedded systems can be managed conveniently using ssh. The consumer focused devices have web interfaces. SSH is perfect, for when the system is running, but if the boot process has problems, there is no screen to read the boot messages that the kernel prints out.  For this purpose these devices usually log to a good old serial port, either exposed as an RS232 (+-12V) or internally with TTL level (usually 5 or 3.3V). Most desktop and notebook computers these days don’t have an RS232 port any more. But there are USB to Serial converters, which are a bit pricey but available in most stores. And then you need a serial nullmodem cable. I threw my old one away many years ago, thinking the serial age was over. But then I bought one again exactly to debug the boot process of an alix. But sometimes, the embedded system is in a location where it’s inconvenient to span a cable. That’s when an RS232 bluetooth adapter comes in handy.

The commercial ones [1] [2] [3] were too expensive for me, and available only from abroad.  I knew about the blue smirf modules for a while. My Arduino BT has one of these, I think. By accident found really cheap modules from china on dealextreme. Add to this the RS232 shifter board that I no longer use, and that should be enough. Not quite! So far it only worked in one direction. The BT module has 3.3V signal level and the shifter board only works with 5V. I tried a few tricks with reducing the supply voltage and using bipolar transistors as I didn’t have any suitable MOSFET at hand. In the end, I’m using a proper logic level converter.

Although the RS232 specs include no power source, it is possible to feed devices by harvesting small amounts of power from the signal lines. After all, that’s how early mice worked. The capacitor on the shifter board was charged with exactly 5V in normal operation. But it couldn’t provide enough to power the BT module. I found some tutorial how to proceed [1] [2], but then I figured for my needs it’s not worth the hassle. I just soldered an USB cable that provides the thing with 5V and two simple diodes reduce that for the BT module (5 – 2*0.7 = 3.6V). Before I could effectively use with an Alix, there was another small hurdle to overcome. The BT module was configured to run at a speed of 9600 baud. The Alix on the other hand prints the kernel messages at 38400 baud to /dev/ttyS0. So einther of them had to be reconfigured. The Alix is easy. Just use another value when following this tutorial (for grub, kernel and tty). Dealextreme usually provides no documentation at all for it’s products. Often times however you find some things when entering the exact product description into a search engine. In the comments of this page there is the recipe on how to change the baud rate: AT+BAUD6. Too bad my device didn’t respond to this command. So it was easier to set the Alix to 9600 baud than investigating further on the BT device. 9600 doesn’t sound like much, and reminds me of ancient modems. But I want to use it only for terminal sessions and not to transfer files or browse the web, so it should be enough. To really test it, I upgraded one of my Alixes to Ubuntu 12.10 the other day over this bluetooth link. Usually, I do this over ssh. And although nothing happened so far, every time I get presented with a warning that a second ssh daemon was launched in case the first one went defunct. On top of that, with the serial link, I get to see grub and the kernel boot messages. It was somehow nostalgic seeing the cursor jumping around the screen while printing the messages. But amazing nonetheless, how well everything works from shell with command repetition to vi… Only some nice features of ssh, like forwarded key based authentication, were missing.



, ,




Leave a Reply

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