DIY mechanics and electronics projects

DIY mechanics and electronics projects

Google Search

WebThis site

Buy me a Beer :)

This web page is run by me on my spare time. If you find any of the information useful and worth a couple of bucks, I will be very grateful if you buy me a beer by donating a small amount using the PayPal link below :)

Amount: 

DIY Roomba USB interface cable Print E-mail
User Rating: / 3
PoorBest 
Article Index
DIY Roomba USB interface cable
USB adapter
SCI control software
Connecting to STK500
All Pages

roombainterfaceThe newer models of Roomba vacuum cleaners from iRobot feature a serial interface, enabling remote control and debugging of your Roomba. Here I will describe how you very easily can make a cable connecting the Roomba serial interface to a PC trough USB or RS232, or directly to an AVR microcontroller.

The roomba serial interface is called SCI, and its specification can be found at iRobots Roomba home pages. To access the SCI connector you need to remove the top face plate of the Roomba (applies to the 5xx series). The face plate can be pulled straight off, but requires a bit of force to be applied. First remove the dust compartment and lift up the edges of the face plate directly over the dust bin. Then press your fingers under the face plate and push upwards as shown in this video clip.

The SCI connector is the 7 pin mini DIN connector appearing underneath the face plate on the right side of you roomba. Unfortunately this particular type of mini DIN connector can be a bit hard to obtain. But the pin placements are the same as on a standard 6 pin PS2 connector, found on most computer mice and keyboards (that do not have USB that is). And I bet most of you already have some of those lying around.

To let the PS2 plug mate the SCI receptacle, the plastic stud on the PS2 connector must be removed. Take a small flat screw driver and press its end towards the base of the plastic stud. This will break of the stud. For images, see the gallery at the bottom of this page.

Roomba SCI Pinout SCI pin
SCI signal
 PS2 Signal
PS2 pin
PS2 pinout
roomba SCI pinout
1
2
3
4
5
6
7
+16V
+16V
RxD
TxD
D D
GND
GND

Data
n/c
GND
VCC
CLK

n/c
1
2
3
4
5

6
 PS2 pinout

The PS2 connector uses only 4 signals, pin 1, 3, 4 and 5. Not all mouse/keyboard cables have wires for the ones not used by PS2. Mine did not have more than five wires, the four signals and a ground cable.  Comparing this with the SCI connector we see that we then would not be able to connect to three of the SCI signals. Pin 2, battery voltage (+16V) is not a problem to leave unconnected, as we have the same voltage on pin 1. But both GND (ground/zero reference) pins on the SCI connector are left unconnected ion the PS2 plug. However my PS2 cable provided a ground cable (uninsulated copper wire) connected to the outer shield of the PS2 connector. And as the SCI connector also provide GND on its shield, this takes care of the missing ground connection wires.

There are several descriptions on the web of how to hook up the SCI port to a computer using a RS232 converter IC as the MAX232. However I did not want to permanently fix my plug to such circuit. I would instead like to be able to use it on different targets; directly to a microcontroller, on the spare RS232 port of the Atmel AVR STK 500 starterkit, or to a USB interface circuit. Therefore I selected to solder the PS2 connector wires to pin header connectors, used for connection to standard 0.1" (2,54mm) pitch pin headers.

Solder each wire to a pin header connector and insulate using a piece of shrink tubing. When all wires are connected and insulated slip a larger heat shrink tubing over all joints to make a good solid assembly, see image below. You now have a very versatile SCI connector assembly.

On the next pages I will describe two different ways to get this connected to your computer. First we start with an AVR based USB interface. Then I will show how you can connect this interface to the STK500 AVR starterkit, either for connection to a PC trough RS232, or for direct control by an AVR microcontroller. 

USB adapter

More and more computers now are delivered without an RS232 serial port as USB has been the preferred serial interface for years. One option for interfacing the Roomba to a USB port is to use a USB-to-RS232 adapter. This would convert the USB protocol to RS232 protocol and signal levels. Then you must use a RS232 interface to convert from RS232 levels to the Roombas 5 volt logic.

A more elegant solution would be to convert directly from USB to the 5V logic required by the SCI interface. Several dedicated USB to UART bridge ICs that do exactly this are available, for instance from FTDI chip. But as an hobbyist it is of course even more fun to make this using only a standard microcontroller.

On Atmels web page you can find the AVR309 application note implementing an USB (1.1) to UART bridge using only passive components and software running on an ATtiny2313 AVR microcontroller. The implementation does not support the windows CDC class, so it requires a dedicated driver. But both the driver and an sample application are available from Atmel so it is very easy to get started. Also as the Rooma commands are outside the ASCII table (ASCII use the values 0 to 127, Roomba 128-256) you would in any case need a dedicated application, as a terminal and keyboard only can input codes from 0 to 127.

The schematic of the AVR309 solution is shown below (cut from Atmels Appnote).

 

AVR309 schematics

 

Note that this schematic has one error: There should be a couple of 12-22pF capacitors connected to the crystal to ensure oscillation. Connect one capacitor to each end of the crystal. One pin at the crystal and the other at ground.

 

Xtal capacitors

 

Also it is recommended to connect a pull-up resistor to the reset line of the AVR. Anything from 1 to 47Kohms would be fine.

Note that the AVR will drive its pins at 3,5V, not 5 V, but as the SCI interface use TTL levels any voltage above 2,0V will be detected as a logic '1'. As the TxD pin from the Roomba is driven at 5 V a current limiting resistor bust be connected between SCI TxD and the USB interface RxD to avoid destroying the AVRs input protection diodes. The voltage difference between Roomba and the AVR is 1,5V. So if we add a series resistor of 1K-1,5Kohm this would reduce the current flowing into the AVR input protection diode to 1,5-1mA, low enough to ensure no damage to the AVR from the 5V TxD signal.

 

connections

 

Compile the assembly code from the AVR 309 zip archive and program the resulting hex file into the AVR. Or you can download the compiled hex file here:

download
AVR309.hex

Note: Remember to select the correct fuse settings, especially to set the clock option to external crystal>8MHz.

Now plug the circuit to your PCs USB port. You will be asked to install a driver, and this can be found in the same archive file as the source code in the folder \code\AVR309_USB\Driver.

On the next page I will present a control software that I have made to control the Roomba trough the SCI interface.


As already mentioned, as the Rooma commands are outside the ASCII table (ASCII use 0 to 127, Roomba 128-256) it is not straight forward using a terminal to control the Roomba. Therefore a dedicated application is neccessary. Several implementations of different Roomba control softwares exists on web, but no one quite fit my expectations. So therefore I made my own (the ultimate solution to any problem Cool ). The software use the DLL provided in the AVR309 application note from Atmel, and provides an easy interface to control and monitor your Roomba.

SCI control software screen shot

You can download the Application and dll file here:

zip
 Roomba_USB_Interface.zip

and the USB driver here:

zip
 USBdriver.zip

Note that this software is made for my Roomba 560, having scheduling possibilities. There are more buttons on the Roomba 560 than on the ones without scheduling. The SCI documentation from iRobot only lists the four buttons for the Roombas without scheduling in the button status byte:

Bit
7
6
5
4
3
2
1
0
Button
n/a
n/a
n/a
n/a
Power
Spot
Clean
 Max

But for the Roomba 560 (and therefore also for my SCI control software) the button configuration is this:

Bit
7
6
5
4
3
2
1
0
Button
Clock
Schedule
Day
Hour
Minute
Dock
Spot
Clean

UPDATE: There is now a separate SCI specification available for the 5xx series of Roomba vacuums. It can be found here, and has the correct button configuration listed, as above.

Using the software is simple. You wake up the Roomba by pressing the Wake up button, and enable SCI control by pressing Control. Then you can control the Roomba and select the different modes of operation. For details see the SCI specification.

Note that there are two UART baudrate selection boxes. The one on the right side is the Baud rate setting for the SCI control program. By default the Roomba communicates at 57600 baud (115200 for the 5xx series). If no connection is established with the Roomba you will se a notification and the baud selection box is red. The second baud selection box at the mid-left position is the SCI baud selection command to change Roombas baud rate. If you experience problems connecting to your Roomba on 57600 baud, hold the power button of your Roomba pressed for 10 seconds. Roomba will play a tune of decending tones and switch to 19200 baud, until the battery is removed or fully depleted.

The following video gives a quick demonstration of how to use the program. Note the connection problem at the very beginning, as I tried to connect at 57600 baud, and then the baud rate change made by holding down the power button for some seconds. After making this film, I found out that the 5xx series use 115200 baud as default, and this was the cause of the connecion problem.

On the next page I will show how you can connect the SCI interface to the STK500 AVR starterkit from Atmel to utilize its spare RS232 port, or control the Roomba using an AVR.


Connecting to the STK500 starter kit

I have for several years used the STK 500 development kit for AVR projects. And for those of you familiar with this kit you know that it have one fully RS232 compliant 9 pin spare connector that can be used by your AVR microcontroller.

You can now use this spare RS232 port to connect your roomba to your PC. Just plug your SCI adapter to the RS232 SPARE pinheader (on the middle of the STK500 by the row of 8 switches) and GND. Note that RxD on the SCI adapter (Roomba data input) must be connected to TxD on the RS232 SPARE connector (PC data out) and similarily SCI TxD to RS232 SPARE RxD. Also connect the GND pin. Under NO circumstance connect the +16V pin to any starterkit pin as this would blow your STK500.

The SCI Device Detect pin can be left unconnected as this one is pulled high internally in the Romba.

Alternatively you can use the STK500 to control the SCI interface from an AVR. Then you just connect the SCI adapter to the IO pins of your AVR. For example if using an ATmega8515, connect SCI TxD to PORTD pin0 (AVR RxD), SCI RxD to PORTD pin1 (AVR TxD), GND to one of the STK500's GND pins. The SCI device detect can be connected to any of the AVRs available IO pins (for example PE0), or be left unconnected. Now you have a Roomba powered by AVR.



Comments

avatar h
0
 
 
wow. That's amazing. It's like a roomba dev kit.
Good work.
I read that roomba 535 and upward models can talk to the wireless command center. So there must be a wireless transceiver inside these. Have you been able talk to them wirelessly.
Maybe they use bluetooth.
B
i
u
Quote
Code
List
List item
URL
Name *
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
B
i
u
Quote
Code
List
List item
URL
Name *
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
 
 
Joomla 1.5 Templates by Joomlashack