Control Roomba Over Bluetooth Via Brainlink

by arpruss in Circuits > Robots

5058 Views, 23 Favorites, 0 Comments

Control Roomba Over Bluetooth Via Brainlink

20140913-133939.JPG

One can buy accessories like the Rootooth for controlling a Roomba over Bluetooth from a computer, phone or tablet, but that costs $100. One can use a cheap Bluetooth-to-TTL-serial adapter like the HC-06, but then one needs to find a way to power it (e.g., by using a voltage regulator). But there is a cute and little-known device that is perfect for various bridging products: the Brainlink. It has an Atxmega 16a4 processor, a USB-rechargeable battery, a serial UART, a Bluetooth module, accelerometer, IR transmitter/receiver, and various i/o ports. Unfortunately, the device is discontinued, but one can buy it for $39 from SurplusShed, which is about the cost of the components, and SurplusShed has periodic sales on all stock.

To build a Bluetooth connection for the Roomba that is compatible with all the PC and Android apps I've tried (I don't have an iOS device), you need:

  • Brainlink
  • S-Video or PS-2 cable (perhaps attached to some mouse you don't use)
  • JST connector with three to eight pins and 1.25mm pin spacing (one is included with the Brainlink, but you will want to order extras)
  • A way of connecting wires (soldering iron and solder, or heat-shrink tubing)
  • Electrical tape or heat-shrink tubing
  • A computer with Bluetooth connection or an Android device with Bluetooth (Android is simpler) for upgrading Brainlink firmware
  • Multimeter or other continuity tester
  • Optional: Hook-and-loop fastener

I use the Brainlink for various projects, and have just unplugged it and plugged it into various devices (Roomba, Mindflex headset, PalmOne IR keyboard). So you're definitely not using up the Brainlink in this project!

Update Brainlink Firmware

pins.png
brainlink.jpg
blfw4.png

To use the Brainlink as a transparent bridge to your Roomba, you need to upload my unofficial updated Brainlink firmware. The updated firmware is backwards compatible, but also adds some new features and fixes a nasty buffer overflow bug. While my firmware is unofficial, it's recommended on the official Brainlink firmware page. The feature relevant to the Roomba is that when the updated Brainlink gets a 0x80 signal in idle mode, it automatically sets the baud rate for the Roomba, sends the 0x80 to the Roomba and initiates bridging between serial and Bluetooth. The 0x80 signal is the first thing Roomba control apps send to a Roomba.

You can download my latest firmware here and follow the instructions here for updating via a computer. The

But it is much easier to update the firmware over Bluetooth from an Android phone or tablet. Just:

  1. make sure your Brainlink is fully charged
  2. download my firmware update app from Google Play
  3. pair your Android device with Brainlink (PIN 1234)
  4. turn off the Brainlink
  5. connect pins 2 and 8 (numbered from right to left; see photo) on the Brainlink's 8-pin port
  6. turn on Brainlink while keeping pins connected (blue firmware update light should turn on)
  7. run Brainlink Firmware Uploader on your Android device
  8. choose your Brainlink device (typically shows up as RN42-xxxx) and whether you want firmware for connecting to a Roomba 500+ or to one of the older Roomba 400 / Create robots
  9. tap on "Program device"

Before step 8, you might also want to increase the Bluetooth connectivity setting in the Uploader. This sets the Brainlink's Bluetooth module to higher connectivity, making it easier to connect to it in the future (you do lose some battery life).

Make Brainlink to Roomba Cable

20140907-134726.JPG
pinout.png
20140913-133654.JPG
20140913-112434.JPG

For this step, you will need your S-video or PS/2 cable for the Roomba end, and a JST 1.25mm-pin-spacing cable at least three and at most eight pins for the Brainlink end. You can use the origin 8-pin tether that came with the Brainlink, but if you do, you'll want to order another.

I recommend using a 3-pin cable (you can buy lots on ebay). The relevant three pins on the Brainlink are on the left side of the 8-pin port: GND, serial TX and serial RX. So if you use a 3-pin cable, you will just plug it in on the left side of the port. If you use an 8-pin cable, I recommend cutting off the other five wires close to the connector, or covering their tips with electrical tape to avoid shorts.

In my instructions, I will assume assume an S-video cable, but you can easily modify the instructions for the PS/2 cable.

Cut off a three or four inch segment of the cable with one DIN-style connector. Strip the cut end. You will have four (S-video; more for PS/2) line, plus perhaps a ground connected to the plug shield. You will need to check with a multimeter or continuity tester which stripped line connects to which pin on the DIN-style connector. For this project, only three pins matter, the ones marked in my photo RX, GND and TX. (These connect to the Roomba's RXD, GND and TXD connections.)

The S-video cable I used had two coaxial wires, each of which had to be separated in order to access the four pins of the plug.

Then connect the stripped lines on the S-video cable to the right pins on the Brainlink's JST cable. GND goes to GND, RX goes to TX, and TX goes to RX. See the diagram.

Carefully cover up all the connections with electrical tape (and if you have a ground connection or other lines in a PS/2 plug, make sure they don't do any harm). As a result, you'll have an adapter with a JST-style connector on the Brainlink side and a DIN plug on the Roomba side.

Finally, use a screwdriver to break off the plastic rectangle inside the S-video DIN plug. It'll only get in the way.

Connect to Roomba and Brainlink

20140913-105544.JPG
20140913-133939.JPG

Take off the top plate of your Roomba, exposing the female DIN socket. Plug the adaptor into the socket, and the JST side to the Brainlink's 8-pin port (if you have a 3-pin cable, make sure you plug it on the left side of the port, as in the previous step's photo). Turn on Roomba and Brainlink.

Now you should be able to connect via Bluetooth from any software designed to work with the Roomba. I like this Android app a lot as a remote control for the Roomba. On a desktop, RoombaComm works fine. I bet there are fine iOS apps as well, but I haven't tried them.

Optional: Drill Through Top Plate

20140913-110032.JPG

It's inconvenient to remove the top plate whenever one wants to control the Roomba, so I drilled a hole through the top plate with a Forstner bit.

Optional: Hook and Loop Fastener

20140913-111746.JPG

To protect the cable and remove rattling, I put hook and loop fastener on both the Roomba and the Brainlink.