Roomba Hacking via Serial Tether

Note:
This post is pretty old and I’ve been continuing work on Roomba software.
Note:
For a more readable take on this, see this Makezine artcicle

A week ago I got my OSMO//hacker Roomba firmware updater from iRobot. It worked like a charm, giving me a serial port to fully control the Roomba.

An interface was needed however, since the crazy mini-DIN 7-pin on the Roomba is very unstandard. So the first attempt at a robust interface between a Roomba and a standard PC serial port is my Roomba Serial Interface:

The Roomba Serial Connector
It seems people are confused by the mini-DIN 7-pin connector, citing difficulties in obtaining that specific plug. It turns out that mini-DIN 8-pin plugs will mechanically mate with the 7-pin jacks, with the center key hole in the 7-pin female jack taking the middel pin of the 8-pin plug. Mac high-speed serial cables from the 1990’s work great for this, and I have a ton of those from all my misspent youth doing MIDI on a Mac. So chop up those old Mac serial cables! If you can’t find one, Jameco will sell you one for $3.29.

The PC Serial Connector
Some computers have an RS-232 serial port. Most don’t. To hook this serial interface cable up to your Mac or other modern computer without an RS-232 port, use a Keyspan High Speed USB Serial Adapter. Supported on all platforms and the choice of Mac hardware-hackers worldwide.

Step-by-Step Construction details
If you’d like to build your own interface but don’t quite know where to start, I took a few images of the process I used.

The Software
With the Keyspan adapter and the Roomba Serial Interface, all the hardware is present to control the Roomba from a computer. All that’s required is software that can connect to serial ports and send and receive binary data. The Roomba SCI protocol isn’t text-based, so you can’t really use a normal terminal program like ZTerm (Mac) or HyperTerminal (PC).

My goal was to create a program that allowed one to remotely control all aspects of Roomba functionality as well as getting all information from the Roomba’s sensors.

It would be nice if the worked on multiple platforms. While I initially started in C, the difficulties in non-programmers getting C code to work on many platforms made me leery of that choice. And C doesn’t provide a consistent GUI framework on multiple systems. It turns out that Java has pretty good serial port functionality now (provided by RXTX), and Processing provides a good cross-platform environment for writing graphical Java programs.

I created a Roomba communication API in Java and a GUI in Processing that shows a top-down iconic view of the Roomba universe. The API is called “RoombaComm” and the GUI is called:

RoombaComm_tst

It provides the following capabilities:

  • Detect a Roomba and display Roomba status
  • Remotely control the Roomba like a little tank
  • Read and display bump, wheeldrop, cliff and dirt sensors
  • Display angle and velocity data from the Roomba both numerically and iconically
  • Start and stop vacuum on the Roomba
  • Play notes on the Roomba using the computer keyboard as a musical keyboard
  • Display Roomba button press status

The software is still very rough and not very well structured nor documented. However if you have a Roomba serial interface and want to play with it, it can be downloaded at:

Trying it out
In the zip file above, there are executables for Mac OS X, Windows, and Linux. I’ve only tried the OS X one. Give one of them a try and see if it works for you. If not…

To use it inside of Processing:

  1. Download and install Processing
  2. In the Processing document folder (“Documents/Processing” on Mac or “My Documents/Processing” on PC), unzip the above zipfile. It should create a directory called “roombacomm_tst”
  3. Launch Processing and choose File->Sketchbook->roombacomm_tst to open the program
  4. Click the Play icon to compile and start the program
  5. RoombaComm_tst will then give you a list of serial ports, pick the serial port that you’ve plugged the Roomba in to. On Mac OS X, there are both “/dev/cu.blahblah” and “/dev/tty.blahblah” serial ports. Always choose the “/dev/cu.blahblah” ports. On PCs, it will be whatever COM port number you’ve selected. On my Mac, the Keyspan adapter is “/dev/cu.KeySerial1” and on my PC, the Keyspan adapter is “COM6”.
  6. RoombaComm_tst will open that serial port and attempt to talk to the Roomba. If it is not successful, it will display “status: no roomba”.
  7. If it’s succesful, drive the Roomba around with the arrow keys, play tunes with the “asdf…” keys and so on!

Here’s what it looks like when just playing around:

Let me know if you try this out and give me feedback on how it works for you.

Update:

First release of RoombaComm API for Java and Processing

28 Replies to “Roomba Hacking via Serial Tether”

  1. Man, that’s frustrating. Is your Roomba still under warranty? Because it sounds like it’s having general problems not related to serial communications. Maybe iRobot could help? But beyond that, sorry, I don’t have any suggestions. Good luck getting it fixed.

  2. Hi todbot,

    A series of unfortunate events have befallen my roomba. :( It needed a new battery, finally got one. The roomba vacuumed the rugs well for several turns but then developed this odd behavior for both spot & clean: moving forward by alternating each wheel and then turning to the right and repeating.

    I’ve programmed the beast using the serial connection and all of a sudden that stopped working too. Although it not recognizing serial commands in the past was usually fixed by taking out the battery and putting it back in, but no dice. I have a program to print out the sensor information and would love to run it but it ignores the serial commands or does a half beep and nothing. I’ve run the diagnostic tests and all the sensors seem to be functioning. There may be trouble with the left wheel in reverse. I’m investigating. Do you have any ideas?

  3. Thank you Tod for your quick response. Just need to pick up the 16 pin IC holder and I will be able to begin construction. Thank you again, great book.

  4. Hi Paul,
    The capacitors are there to buffer power in case any power supply dropouts. Anything 1uF or over is fine. At the time, I had 10uF instead of 1uF. Sorry about the confusion!

  5. Regarding the serial tether circuit outlined in the book: The parts list shows six 1uf polarized electrolytic capacitors. The circuit appears to indicate that the same are used. However, in the picture of the board it looks like there is a 10uf capacitor, which I can’t find in the circuit. Is this a misprint?

  6. Thanks for the interface design.

    I googled the rs232 pinout and with that was off and running. I would add a ic socket to you list of parts. I’ve never been brave enough to solder a chip right to a board.

    With my humble interface in hand I hooked up my roomba scheduler and I can control it great!

    I’ve got no sensors though. I will double check your page to make sure I didn’t miss anything, but I welcome any suggestions.

  7. Hi guys,

    First of all, great job on the hardware documentation. It was very straight forward and easy to read.

    I’m using the serial cable circuit and I’m not able to send commands to the Roomba. I used your software and it is able to connect to the right port, but it says “status: no roomba” and 0 bytes available. I’m not too familiar with the MAX232 so I’m not sure where the problem lies. I’ve checked all the connections and everything seems to be connected correctly.

    Last night I went into hyperterminal before downloading your software and it spit out:

    device-detect
    2005-10-04-1308-L

    processor-sleep
    slept for 4158 minutes 249 ticks

    It repeated the processor-sleep over and over again with changing values. However, it doesn’t do that anymore. Any ideas on what could be wrong?

    Thanks,
    BJ

  8. Get the Roomba Discovery (model number 4210).

    It’s the most popular one and I can verify it works with the SCI protocol (as you can see above)
    According to the irobot.com/hacker page, any new Roomba with model numbers 41xx or 42xx should be compatible with the SCI.

  9. Hi,

    I am very beginner of hacking roomba.

    Before doing that, I need to buy that stuff, but I am not quite sure what kind of roomba should I purchase.

    When I want to shop for that by this site:http://www.irobotstore.com/, there are several types out there. What shall I buy for using SCI?

    They mentioned that the product after October 2005 will have the SCI, but how can I know when I purchase it through on-line, whether it is one after October 2005 or not?

    Do you have any idea? I mailed them about this, but there is no reponse from them yet.

  10. Shawnee,

    Depending on your constraints there are many options. If you are comfortable programming microcontrollers, you could add one to the Roomba, plugged into its SCI port, and stick a few ultrasonic or infrared rangefinders on the microcontroller. When the rangefinders detect something “close”, it runs away until it’s not close.

    If you have full control of the space and are comfortable with programming environments like Max/MSP or Processing, you may be able to set up a webcam or iSight that looks down on the entire floor analyzing the scene. The computer software identifies the Roomba (maybe because it’s been given a single vivid color via the simple trick of a big round piece of construction paper), identifies moving things that aren’t Roombas (people), and commands the Roomba to move away from them.

    If you control the people in the room, you could make them all wear tiny “virtual walls” (the standard Roomba package comes with one of these) and the Roomba will naturally flee from virtual walls.

    There are many ways to implement the idea of “flee from people”, but as you can see it depends on your particulars.

    Good luck with your project and when you get pictures/videos up I’d love to see them!

  11. Hello, I just got a iRobot Roomba discovery model 4310 do you know if it is possible to control my roomba? Do you have any sofware to control or do diagnostic to this roomba model? Can you send me a tutorial on this if it is possible?

    THX

    Best regards,

    Marc.

  12. I am a graduate art student in Chicago. I want to alter a roomba so that it will move away from people as they approach it in a small installation room while it plays music. Do you know how I would do this or if not, do you know who I might contact that could help me? Also, i havent bought one yet, do you know which model is the best as far as lower cost and ease to hack?

    Thanks SO much for your time.

  13. A couple addenda:

    1. The BAFO BF-810 USB-Serial adapter works just fine and costs about 1/3 of what the Keyspan costs (check Froogle). If you’re using OSX you will need to get the latest driver from Prolific Technology, who engineered the thing. Prolific’s name for the BF-810 is the PL-2303 and you can find the latest drivers here: http://www.prolific.com.tw/eng/downloads.asp?ID=31

    It creates a device called /dev/cu.usbserial, which means that if you’re really geeking out, you can have BOTH the Keyspan and the BAFO running at the same time. Now that’s pretty BAFO.

    2. If you’re using Processing, after you’ve installed your serial port, read the Processing Serial FAQ (http://processing.org/faq/bugs.html#serial) and follow the instructions before you try and do anything. Otherwise, it won’t work. I puzzled over the “gnu.io.PortinUseException” error until, well, until I read that.

  14. According to irobot.com/hacker, “The SCI is compatible with all 41xx and 42xx series Roomba models”. Although iRobot doesn’t make it trivial to discover the model numbers of their products, what I’ve discovered so far is:
    – model 4100 – Roomba Red
    – model 4105 – Roomba Sage (green)
    – model 4210 – Roomba Discovery
    – model 4220 – Roomba Discovery SE
    – model 4230 – Roomba Scheduler
    which leads me to believe that your Red Roomba is able to be updated. Assuming you have the physical port that is. It’s normally hidden, you have to pop off a little cover to expose it.

  15. I understand this only works on the newest robots. The plug on the outside is new but did they re-design the board to add the port or just begin offering access on the outside for something that was wired in all along? I have a Pro Elite Red that is probably too old to hack but have you opened up any of the Discovery series. Is there an interface anywhere on the board?

  16. Hi, Todd. Many thanks for making available all this information regarding the roomba robot. My time is limited and you just made my little project very efficient, especially by listing all the parts linked to a supplier and posting scematics along with quality pictures. Awesome!
    Hopefully my project will be a success and I’ll be able to help other potential Roomba hackers as well. Thanks again.
    -Mark

Leave a Reply

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