Hacking Roomba

Code Download

Because the ROI port on your Roomba is essentially just a serial port, there are many ways in which you can interface to it.

RoombaComm

Much of the book walks you through how to construct a Java-based library called RoombaComm that functions on most any operating system with Java. The book also discusses how to build several applications and tools built upon RoombaComm.

Read about RoombaComm code.

Microcontroller

Both Arduino and the Basic Stamp can control a Roomba. These inexpensive and easy-to-use microcontroller boards sit nicely upon a Roomba and the book shows you how to program them to act as replacement brains for your Roomba.

Read about Microcontroller code for Roombas.

Embedded Linux

No hacking project is complete without the addition of Linux. Certain small home wireless routers, like the Linksys WRTSL54GS can programmed to run Linux (and reverted back to normal if desired). They are small enough to sit on top the Roomba, controlling it and running off its battery. The book shows you how to do this, as well as add a webcam to your Roomba and give your Roomba its own web page.

Read about Linux for Roombas.

All software presented in the book and downloadable here is open source under the GPL.

38 comments

38 Comments so far

  1. Wael November 29th, 2006 2:19 pm

    Nice stuff, I can’t wait to try it out.

  2. Brett December 29th, 2006 2:25 pm

    Can the Roomba be made to run off Flash ActionScript 3 instead of Java? I have an idea for an application I’d like to write and would love to be able to do it in Flash

  3. todbot December 29th, 2006 3:07 pm

    Hi Brett,
    Yes, you can totally control a Roomba from Flash. You’ll need a program to act as a network gateway for the serial port on your computer the Roomba it’s connected to. This type of program is often called a “serial proxy” or “serial server”. It provides a socket server you can connect to with Flash.

    The Arduino page on Flash interfacing is a good place to start. There are several examples there on how to talk to serial devices with Flash. (Arduino is a serial device like a Roomba). One of the most used serial servers is Dan O’Sullivan’s SerialServer.

    Good luck and let me know what you create!

  4. Brett December 29th, 2006 9:07 pm

    Thank you! I just ordered my first Roomba and am really excited to get your book. Thank you.

  5. Barry Carden February 18th, 2007 3:53 pm

    Hey,

    I’ve built the Bluetooth for Roomba interface.

    I have my dongle and software but the Bluetooth software
    is different than that explained in Tod Kurts book and
    I cant make it work.

    Is there any help or any suggestions on my problem.

    Thanks

  6. todbot February 18th, 2007 6:29 pm

    Hi Barry,

    I take it you’re on Windows 2000? On Windows XP it looks like you can just plug in the Bluetooth USB dongle and XP will recognize it and configure it. On Windows 2000 (or earlier) you have to install drivers. (At least, this is my experience with the dongle I got from SparkFun.com)

    If you’re on XP and the dongle isn’t automatically recognized by XP, I’d say your best bet is to try a different dongle. You can get them for under $10 from places like NewEgg.com.

    Alternatively, try a different computer, on the off chance that there’s something weird with the one you’re currently trying.

  7. Dave May 8th, 2007 5:29 pm

    Is it possible to disable the “reached the top of the stairs” feature in the Roomba? I want it to be able to function entirely “normally” with just that one exception. (I have no stairs, but when it reaches the kitchen tile it thinks it is at the top of the stairs due to the color change, so it turns around and won’t vaccum the kitchen.)
    Thanks!
    Dave

  8. Adam July 13th, 2007 10:22 am

    As far as I know you can’t disable the stair sensors but a far simpler, easier and quicker way, is simply to cover the 4 stair sensors at the from of Roomba with black electrical tape, et voila! Problem solved. Some critics say that this stops Roomba docking on the homebase. Wrong! I’ve had no problems at all, give it a go!

  9. Nathanael August 28th, 2007 10:36 am

    It looks like you’ve got a subtle typo in the link to the Arduino website; it should be:

    http://www.arduino.cc/

    The current link goes to “http://arduinio.cc/,” with an extra “i.”

    Just thought I’d point that out, thanks.

  10. todbot August 28th, 2007 11:21 am

    Thanks Nathanael. Fixed. I think I’ve misspelled Arduino all the different ways possible.

  11. David February 25th, 2008 11:01 pm

    Hey todbot, just wondering if there would be a use from your Bluetooth module so that it could be used to turn on and off a LED using the TX0/RX1 lines to do that? Would your java source code still work for that? That would be nice if I could use my Samsung u740 Bluetooth phone to turn off/on something via that Bluetooth module. Would anything else be required to do that?

  12. todbot February 25th, 2008 11:10 pm

    Hi David, You’d need a bit more circuitry than just the Bluetooth module. This circuitry could be something as simple as a 555 chip wired up to trigger when it receives a pulse from the TX line. But I’m partial to these little 8-pin Atmel ATtiny chips. You program them in C and they’re little brothers to the chip in Arduino boards. And Arduino is a great way to get into playing with adding programmed logic to the real world.

    Your idea is a good one. Cell phones are natural “control panels” for things in the world, since we always have them on our person. There are various Bluetooth examples on the Mobile Processing to help you write code for your phone.

  13. David February 25th, 2008 11:22 pm

    Wow! Thanks for the quick response todbot! Would a 555 timer chip work with more than just one LED? Other than I guess turning one off and on, it could turn both on and only one off depending on which button is pressed on the cell phone? Sorry, I’m new with all the Bluetooth stuff and your demo of the roomba looked as close to something I would like to do with the Bluetooth.

    That Arduino Bluetooth looks pretty pricy! I’m just looking to get the spark Bluetooth u use and have it control whatever I hook to it. Sad for me I don’t know much C. But I do have a java class this semester so I’m sure i’ll understand most, if not all that. Would it be any trouble to point me to the site where I could get the 555 and Bluetooth module as well the blueprint of how to hook it up to the 555? (If that is the best chip to do what I would like to experiment with)

    Again, thanks for the QUICK response!

  14. todbot February 25th, 2008 11:32 pm

    Yeah the Arduino Bluetooth is pricey, and if you’re starting out I don’t recommend it. Better to get a normal Arduino (the “Diecimila”) from Sparkfun.com and add whatever interface devices you need, including a Bluetooth module like used in my Roomba examples (Sparkfun also sells bare Bluetooth modules that hook up nicely to an Arduino)

    If you’re just starting out and have never heard of the 555 timer chip, I’d leave that for another time. It’s simple and cheap, but unless you know how to make it work, it can be frustrating (it requires knowledge of electronics theory) Do a search for “555 timer chip” and you’ll see what I mean.

    With Arduino on the other hand, making an LED turn on and off is the first thing you learn and talking over serial ports (which is what the Bluetooth adapter looks like) is like the fourth thing you learn. :) I’ve taught a few classes on playing with Arduino and you can download the class notes to read. They were called Spooky Arduino and Bionic Arduino. Also the Arduino site has lots of good tutorials and examples.

  15. David February 25th, 2008 11:56 pm

    That looks simple (to me) so far looking at your class notes. I’d still rather have just the small footprint of the bluetooth board and the chip to work it.

    I like the idea in your notes how the Arduino acts as a boot loader. Is that something that the 555 chip acts like? Can i get one of those programmable ATmega chips and program that to since the pulses of the TX line? Or am i just making stuff up as i go? :o)

  16. todbot February 26th, 2008 12:24 am

    Once you get going with the Arduino, it’s pretty easy to move to a smaller ATtiny chip, which only has 8-pins like the 555 timer chip (but you can’t easily program the 555 to do what you want)

    The “bootloader” in Arduino is a part of the Arduino hardware that makes it easy to program the ATmega chip on the Arduino board. You don’t have to worry about it. Every time you save your program to the Arduino, you’re using the bootloader, but it’s not something you actively use.

    If I understand your question, you can write an Arduino program running on the Arduino board that listens to the Bluetooth adapter and then when it sees something it likes, it performs some action (like lighting an LED)

  17. David February 26th, 2008 10:15 am

    Are you talking about the ATtiny45 chip? I’d rather have a programmer to program that then go with the arduino and have a big board for each bluetooth project i do.

    Yes, thats what i would like to do with, as u stated, with the ATtiny45 chip. Program that to “listen” to the bluetooth cell phone and depending on how its programmed turn off/on an LED, etc.

    I would need to see examples of this to understand how one would program the ATtiny45 chip and tell it what to look for from the bluetooth cell phone. Thats what i dont get. Yeah, im a noob but i like doing stuff like this, i think it neat.

    My father made a projector screen drop down from an old chair but u have to hold down the up or down button to make it go, well up or down. I really would like to have it controlled by the bluetooth module so that he just has to use his cell phone to raise it and lower it. Just types of projects like that.

  18. todbot February 26th, 2008 2:42 pm

    The stuff you learn playing with Arduino is directly usable for the ATtiny45 (both use the same family of chip, the interfacing techniques are the same, and so on)

    If you’d like to bypass Arduino and start directly with the ATtiny45, there is a good AVR tutorial linked from Makezine.com a few days ago.

    As you read through that tutorial, you’ll see that it can be bit daunting to get everything set up. The concepts aren’t particularly difficult, but there’s all these little details you have to worry about. That’s why I’ve been advocating the Arduino board: it eliminates most of the dumb little details, while giving you the ability to program a micrcontroller with

    As an example of how you might do things with Arduino (and, again, the general code flow is usable with ATtiny45), there’s the Arduino tutorial PhysicalPixel.
    It listens to the serial port and turns on or off an LED based on what it reads from the serial port. A Bluetooth adapter hooked to Arduino will look like a serial port.

  19. David February 26th, 2008 7:53 pm

    Well that was some interesting reading….

    $60-$70 for the bluetooth smirf & ATtiny45 board VS. $150 for the bluetooth Arduino…. hum, kinda easy to tell which one i need to go with.

    Ok, lets say with your roomba hack with the bluetooth module. What would the ATtiny45 do once power is connected to it? Would it start the code? I assume it has a “bootloader” as well? How would i connect my phone to it?… lots of questions… maybe u can make another class project to do this? :o)

  20. todbot February 26th, 2008 8:05 pm

    The ATtiny45 runs the code you’ve programmed into it immediately on power up. No need for a bootloader or anything else. The Arduino bootloader is there so you can reprogram a chip using just a serial or USB connection and not need a special programmer.

    To make your phone connect to the Bluetooth serial adatper hooked to an Arduino or ATtiny45, you would write program on your phone that scanned for Bluetooth serial devices, connected to one, and sent data to the connected device. As mentioned previously, there are several examples on the Mobile Processing site. Mobile Processing lets you write programs for cell phones using a variant of the Java programming language.

  21. David February 27th, 2008 3:55 pm

    Sorry i was without internet for awhile there…Ok so in order to use the ATtiny45 i will need the following:

    -ATtiny45 chip (duh)
    -AVRStudio software
    -WinAVR
    -AVRISP mkII Programmer
    -AVRISP mkII software
    -sparkfun BlueSMiRF

    Now it would seem to me that the hardest part in all of this would be how to hook the bluetooth up to the ATtiny45 and from there hooking it up to the LED’s. Does the ATtiny45 have more than one output? If not, how could it turn off/on more than one LED?

  22. David February 27th, 2008 5:58 pm

    This is pretty much what i was looking to do.. its a 8 relay that is connected to bluetooth that seems to be able to be controlled via pc, pda and cell phone. However, its $200+.

  23. David February 27th, 2008 5:58 pm

    oops… forgot the url :o)

    http://www.audon.co.uk/mfc8800.html

  24. David March 2nd, 2008 2:45 pm

    I think i took something wrong you said a few posts up… If i get the Arduino then thats pretty much the programmer for the ATTiny chip? Once programmed and tested out with its ports i can then move the chip off of it and use it by itself?

  25. Reece March 4th, 2008 2:43 pm

    I have tried and tried time and time again to get the code for the ‘bumpturn’ program to work on my Arduino. When I run it on my BS2, it runs fine, but when I hook up the arduino to the roomba with the code (FYI I’m using the updated one on this website), this is what happens: The roomba just drives forward. Sometimes if you hit one of the bumpers, it just stops, and leaves the ‘safe’ or ‘full’ mode or whatever the mode it is in, and goes into passive, or whatever the regular mode is when it responds to button presses. Sometimes, the roomba won’t even budge. What’s wrong?? I can’t seem to figure out the problem. All my connections are fine and secure. Is your code mis-typed??

  26. Phil May 2nd, 2008 3:38 pm

    I’m having the exact same problem as Reece with my arduino. I’m using a roomba dirt dog, but I don’t think its any different from a regular roomba software wise.

  27. todbot May 2nd, 2008 5:31 pm

    Just to make sure: make sure you’re running the Arduino off external power, not USB power, when doing stuff. This is because when you use the USB port, the RX/TX lines of the Arduino are claimed by the USB chip.

    If you’d like to use both the USB serial connection and the Roomba at the same time, you should use a software serial port library for the Roomba connection, like LadyAda’s exellent AF_SoftSerial.

  28. Reece December 8th, 2008 1:53 pm

    I do know that; that’s a pitty because it’s a heck of a lot harder to debug with that issue. But this same problem still occurs regardless if I have the arduino hooked up to my PC or not. :(

  29. Reece December 8th, 2008 1:55 pm

    and yes, I do have the GNDs tied together.

  30. MovieMaker July 28th, 2009 8:31 pm

    I have the same identical problem also. It has disrupted my intire life! But, I am trying to be patient. Some people have had success.

  31. D' Artanian July 26th, 2010 5:57 am

    Hi,

    is this site still updated? …I just bought a 555 model and its been unmodified for almost a week….

    How/Where do I start?

    Many thanks

  32. MCD August 22nd, 2011 5:10 pm

    I have a question. Can the Roomba be interfaced with the Basic Stamp 2 using a PS/2 cable? It fits into the Roomba with the tab removed, but would it work?

  33. todbot August 22nd, 2011 6:14 pm

    You can use a Basic Stamp 2, but you can’t use a PS/2 cable. It doesn’t have all the pins you need. You can use an old Mac serial cable or get a cable from SparkFun.

  34. sean October 30th, 2011 4:34 am

    Arduino is coming out with an arm based board like the Corduino shortly.

    Other things that could work quite well are:
    -Plug computers like guruplug, ultraplug, pogoplug, etc.
    -Freescale MCIMX53 starter board.
    -Beagle/panda board
    -Trimslice

    They all run linux and have a small form factor. Some come with bluetooth and wireless, built-in, and use very little electricity like your cell phone. So you can use a small battery pack.

  35. Joe May 29th, 2012 12:02 am

    A guide to programming Roomba (All generations) was just published: http://www.robotappstore.com/Knowledge-Base/1-Introduction-to-Roomba-Programming/15.html

  36. Joel Gonzalez July 18th, 2012 10:18 pm

    Thank you Joe for the link. I’m about to buy the Roomba 560 and considering buying the iRobot too. I’d like to know if all other Roomba functions will operate if I disconnect/unplug the vacuum motor and brush motor–without hacking it–and if it will lose any programing capabilities doing so. The iRobot will not be able to vacuum as it is not made for that. I’m not sure if or when someone will be able to answer this question. Feel free to drop me an e-mail at joelgnz@hotmail.com
    Any info will be greatly appreciated.
    Thank you,

    Joel in Connecticut

  37. John June 17th, 2013 7:49 am

Leave a reply

You must be logged in to post a comment.