I wanted to see if I could operate my Roomba remotely and get it to report its status via Twitter while I was away from home. I also wanted to make the device independent of a computer. This is the solution I came up with and it works very well.

Follow @TheRoomba on Twitter to see what mine is doing!

Step 1: Needed Parts and Tools

  • 1x - Small signal, low power PNP transistor (I used a 2N2907A (may also be known as NTE159))
  • 1x - 8-Pin mini DIN male connector
  • 1x - 7805 5V voltage regulator
  • 1x - Solderless breadboard
  • 1x - Arduino board
  • 1x - Sparkfun WiFly Arduino shield
  • Row of five or more male pin headers
  • A short piece of Cat5 cable or similar wire (Cat5 is 24 AWG)
  • And last but certainly not least, a Roomba*

  • Soldering iron
  • Small scissors
  • Third hand
  • Hot glue gun
  • Multimeter

  • For the purpose of this Instructable, I am going to be assuming that you have a basic knowledge of basic electronics,  the Arduino and the Arduino's programming language.

*I have only tested this with the 500 Series. However, it should work with newer models, but I am not sure about older models.

Step 2: Roomba's Serial Connector

All 500 series Roombas have a serial connector on them. We will be using this serial port to control and read sensor data from the Roomba. The serial connector is simply an 7-pin Mini-DIN jack with the block in the center. You can usually purchase these for a few dollars at your local electronics store.

To access the serial connector: remove the bin, gently pull up on the back edge of the top plate until the two clips in the back release. Now, use a flat blade screwdriver to gently pry up the rest of the plate. The connector is to the right of the control buttons.

You may wish to drill a hole in the plate to access the port without the plate removed.

Step 3: Creating a Connection Cable

The easiest way to connect to the serial port is to create a short cable using an 8-Pin mini DIN connector, some male pin headers and a short length of Cat5 cable. You may use a 7-Pin mini DIN instead if it has the plastic block in the center and not the bottom as the center pin is not connected. Strip a small amount of insulation off of the individual wires. If you don't have a wire stripper that can strip wires this small, gently rotate a pair of scissors around the insulation and pull it off.

It may be tricky to solder the wires into the small cups of the mini DIN connector. Use your Third Hand to hold the wire and mini DIN connector. You may wish to place the wire between a small piece of folded paper to prevent teeth marks from the Third Hand. Work form the inside out. If the wire is soldered in the cup properly, you can use a solder vacuum to clean up an excess solder on the exterior of the cup. Make a chart of what cup you attached each wire to.

Use a multimeter to check for shorts between pins.

The pins may be bent slightly out of place. Insert the pins into the Roomba's connector to realign them.

Use some hot melt glue between each wire so the do not bend and short against each other. Wrap some tape around all the wires to prevent shorts against the case. Reassemble the mini DIN connector, but do NOT slide the outer case of the mini Din over the pins until functionality has been verified. This will make it easier to modify if necessary. Strip the other end of the wire. Pins 6 and 7 (see image below) are both ground; attach them to the same pin header. Pins 1 and 2 are both positive. The voltage on these pins varies. When docked, it is about 20V, otherwise it is the voltage of the battery (about 14V). Attach them both to the same header. Attach the rest of the wires to their own headers.

Step 4: Connecting the Arduino

Place the WiFly shield on the Arduino.

Attach the cable by connecting the mini DIN connector to the Roomba and the pin headers to the breadboard.

Use the wiring diagram that you created in step 3 to help you connect the wires properly for the instructions below.

In his write up of the Roomba library for the Arduino, Mike McCauley tips us that we must use a PNP transistor in order to trigger the Arduino's RX pin from the Roomba. Use a jumper to connect the Roomba's TX pin of the cable to the Base pin of the transistor. Connect the Collector pin of the transistor to ground and the Emitter pin to the Arduino RX.

Attach the Arduino's TX pin to Roomba's RX pin on the cable. Attach the ground pin from the cable to the Arduino's ground.

Next we have a slight problem. The Roomba's power output can be up to 20V when it is being charged. While the Arduino's voltage regulator can handle this, the WiFly 3.3V voltage regulator cannot. We will need to add our own voltage regulation circuit to the breadboard. To do this we use a 7805 voltage regulator to bring the voltage down to 5V. Connect the Ground of the 7805 to ground, the Vin pin to the Roomba's power, and the Vout to the 5V pin on the Arduino.

When you attach the connector to the Roomba, the Arduino's power LED should light up.

Click here for a larger version of the Breadboard diagram.

Remember to disconnect the cable from the Roomba before reprogramming the Arduino!

Step 5: Complete Code

You can download and contribute to the code at GitHub. It may be a little buggy, so please feel free to comment any suggestions for improvement, or contribute yourself.

In order for it to work, you will need to replace "TWITTER oAUTH KEY" with the oAuth key created in Step 8 "Programming 3: Twittering". Then we just need to set the router passphrase and SSID. All of these options may be found in the "Credentials.h" file. The Arduino should now be able to access your network and your Twitter account. The code is also well commented so you should be able to modify several of the values easily, including what the Roomba says for certain events.

If you have any difficulties, scroll down to Step 9: Troubleshooting for help or feel free to contact me.
Make sure you have the Roomba Library(Step 6), the Twitter Library (Step 8), and the WiFly Library available from SparkFun.

Step 6: Programming 1: Communication

Communicating with the Roomba is actually fairly simple. The Roomba's serial port uses iRobot's Open Interface (OI) protocol to communicate with other devices (such as the Arduino). While the OI can provide full control of the Roomba's motors and LEDs, it can also be used to begin the built in cleaning process, which would undoubtedly take several hours to recode into the Arduino.

Instead of writing Arduino code to interface with the OI ourselves, we will use the fabulous library by Mike McCauley for interfacing with the OI. (Thanks Mike!) Mike's library features every basic OI command for the Roomba.

Full details of iRobot's OI can be found here.

Step 7: Programming 2: Web Control

For this, we can stick mostly to the example code for the WiFly web server. The example code provides us with everything we need to do except reading the requests from a web browser. However, this is pretty easy to add. All we need to do is read the request byte by byte using the sample code and place that in a string. Fairly easy right?

The hard part of this is configuring the router correctly. Firstly, we need to tell the router to give the WiFly Shield a static IP address. Unfortunately, since all routers are different, I cannot tell you how to do this. You will need to look in your router's manual for instructions on how to assign a manual IP address.

Unless you don't mind other people potentially controlling your Roomba, this is mostly for control over the network and not the internet. However, if you understand the security risks (or know how to set up an authentication system), it is possible to configure most routers to forward to the Arduino web server. Again, you will need to look in your router's manual on how to do this. You may also be able to find instructions using Google.

To control the Roomba over the network, simply enter the IP address you assigned to the WiFly into you browser's address bar and voila! If you did connect it to the internet, you can access it anywhere by entering the IPv4 address of your router, which can be found here.

Step 8: Programming 3: Twittering

This part of the code was a little more difficult than I originally anticipated. Most guides for adding Twitter to the Arduino require a computer to do the actual Tweeting. I did not want to need my computer turned on to receive updates from the Roomba. There is, however, another excellent library (by @NeoCat) that we can use to make the Arduino Tweet without the assistance of a computer. However, the library is designed specifically for the Ethernet shield. Fortunately, though, Sparkfun's library for the WiFly shield is designed to easily replace the Ethernet shield library with minimal code tweaks. I have packaged a modified version of the Twitter Library with the code download. Don't worry about installing it in your libraries folder.

We now have a Twitter library that is fully compatible with the WiFly shield. In order to start using the library we will need to allow it access to our Twitter account by clicking Here and then clicking "Get a token to post a message using OAuth". Once we have granted it access, we will see a webpage with what is called an oAuth key. All we need to do now is place this in "Credentials.h" file where noted. We can now start Tweeting with the Arduino!

However, here we hit another snag: we cannot tweet something that we have already tweeted in the past. So, the Roomba will only be able to tell you that it has finished once. There are few ways to get around this:

Add a Real Time Clock (RTC) to our hardware and add the time to the beginning of each Twitter post. This method is more expensive, but will look prettier on the tweets.
Read a couple of sensor values from the Roomba to generate a random number. This method is less expensive, but it does not look quite as nice as using an RTC to time-stamp the tweets.
We could also use the Arduino's millis() function to tag on to the tweet. This is the most reliable and the easiest. However, it will also look ugly compared to the RTC time-stamp.

For this Instructable, we will be using the latter as it is the least difficult and least expensive. The millis() function returns the number of milliseconds since the program was started. We do not need to worry about the number getting too long as it resets to zero after fifty days. The highest the number may be is about 4.32x10^9, which is ten digits. As for it resetting, we do not need to worry about duplicate tweets as the likelihood of an exact match is near impossible.

Step 9: Troubleshooting

This is a small section about the problems that I ran into and how I fixed them.

Issue - Possible Solutions
WiFly does not connect - Confirm your SSID and router passphrase in the Credentials.h file
If you are using WEP, try changing to WPA/PSK+WPA2/PSK

Twitter does not update - Confirm that your oAuth key is correct (see Step 8)
Check your solder joints

Web control page does not show correct information - Check your solder joints

Cannot access web control page - Ensure that you are using the right IP address (see Step 7)

If none of these solutions helped you, please feel free to contact me.

Step 10: Conclusion

I hope you liked my Instructable and hope you may find it useful!

There are many ways that I considered furthering the code. Including:
 * Driving it around manually.
 * Adding Cosm support to log cleaning times, battery-life, etc.
 * Moving the components onto a PCB instead of using a the breadboard.

Please comment any questions or suggestions. I welcome your feedback.
<p>Hi !</p><p>I am a beginner and I only have one pnp transitor around : A928A</p><p>do you think it will work ?</p>
<p>If you don't have a 8-pin mini DIN connector laying around, you can also use a ps2 connector of the old computer-mouses,</p><p>only remove the black pin in the middle</p>
Why not strap a camera to it and remotely check out whats goin on at home?<br>No burglar would suspect that. A dog\s eye view... haha
I thought about it, but the Arduino does not have the necessary processing power to use the camera with the WiFly.
actually it does.u just need to add a pin cammera to it.
There is an Arduino Shield Compatible board with a Parallax Propeller chip that would have the processing power, while still being able to use the Arduino shields. Not quite as easy to program, though.<br><br>http://mghdesigns.com/index.php?main_page=product_info&amp;products_id=1
Hmmm... I will have to look into that. I have also heard that the FEZ Panda has the processing power?
Trying to eliminate some confusion: the connector diagram above is for a Mini-DIN7, not Mini-DIN8 as noted on the previous page. They don't count the circular ground shroud as a pin, although it does indeed provide a useful additional connection, normally to the ground. That said, however, you can fit a Mini-DIN8 <strong>plug</strong> into a Mini-DIN7 <strong>socket</strong> (which is what Roomba has). In other words, if you're looking for a connector, you can expand your search and get yourself either Mini-DIN7 or Mini-DIN8 plugs, both would work, just be careful with the pinout.<br> <br> Or, and a word of caution, perhaps: there is a whole bunch of non-standard 7, 8 and 9 pin plugs out there, usually from power supplies of all sorts, that look like Mini-DINs but aren't.&nbsp;<br> <br>
It appears that you are right. I got confused because some of the mini DIN 7's have a different pin out. I was also going off of the fact that the cable for the Roomba from Sparkfun is an 8 pin. thanks for pointing that out.
You are a very patient, helpful person. <br> <br>Very inspiring build as well. Love the iterative process you've worked through this instructable.
The device still does not work consistently: <br>1) It is not always a connection is established with the Roomba. <br>2) WEB interface displays the information is not correct. <br>3) Control in WEB interface does not work. <br> <br>The scheme is valid because the data is still being received. Transfer rate the same is true. <br> <br>Please help me! <br> <br>Propose to introduce a management DDpin. It would be great to transfer data exchange interface for softserial, and USB Arduino output debug information.
It sounds like the underlying problem has to do with the communication between the Arduino and the Roomba, that would certainly be causing all of the symptoms you have listed.<br><br>I doubt you would get much from serial debugging; it isn't a software problem as you consistently have access to the web interface. But you can try it. The SoftwareSerial is pretty compatible with the Serial library, if it is fast enough.<br><br>I know I have said this before, but please check your link cable thoroughly. You could also try making few jumpers out of lengths of Cat5 and make the links individually. This will eliminate a large portion of possible problems.
Cable and transistor I changed 3 times already.
The device works! The problem was most Arduino. <br>However, sometimes the fee freezes and green LED stops flashing and constant light. <br>Is it possible to learn the meaning of the flashing LEDs? <br>Are there any plans expansion WEB interface?
All my efforts are useless. Does not work. <br>I know that the data rate my Roomba 115200. <br>I know exactly what data is coming. <br>Web interface works but no data. I tried everythin
Good afternoon. <br>I still problemmy. <br>The program compiles without errors. Appears WEB interface where all the zeros, and nothing works. <br>It is also very much like the version for 400 series.
It sounds like your interface cable is wired wrong. Double check it. Most likely, you have the TX and RX mixed up. Another possibility is that the PNP transistor on the Roomba-to-Arduino line may be wired incorrectly.
Great instructable! I was actually looking for a way to control Roomba over internet, did you forget to add this part? :) <br>&quot;To control the Roomba over the network, simply enter the IP address you assigned to the WiFly into you browser's address bar and voila!&quot; There will be directional controls on the resulting webpage?
Thanks! <br>I never added manual control, just start, stop, and dock. I have recently considered returning to this project and adding a few features (like manual driving), but haven't yet.
Help!!! <br> <br>In file included from Twittering_Roomba.cpp:1: <br>C:\arduino-0022\libraries\Twitter/Twitter.h:21:22: error: Ethernet.h: No such file or directory <br>C:\arduino-0022\libraries\Twitter/Twitter.h:23:25: error: EthernetDNS.h: No such file or directory <br>In file included from Twittering_Roomba.cpp:1: <br>C:\arduino-0022\libraries\Twitter/Twitter.h:33: error: 'Client' does not name a type
Ok. I have updated the code and packaged a modified version of the Twitter library. Thanks for your patience and your interest in my project :)
It looks like the Twitter library has been updated for 1.0 (It appears you have the 1.0 version of the library). You can try finding an older version, or I'll be releasing an update of my code in a couple of days, now that I actually have an opportunity. Sorry I haven't been able to offer a lot of support on this over the last little while.
after replacing the library: <br>In file included from Twittering_Roomba.pde:1: <br>C:\arduino-1.0.4\libraries\Twitter/Twitter.h:35: error: 'EthernetClient' does not name a type
There are problems when compiling: <br>IDE 1.0.4 <br> <br>In file included from Twittering_Roomba.pde:1: <br>C:\arduino-1.0.4\libraries\Twitter/Twitter.h:35: error: 'EthernetClient' does not name a type <br>In file included from C:\arduino-1.0.4\libraries\WiFly/WiFly.h:4, <br> from Twittering_Roomba.pde:4: <br>C:\arduino-1.0.4\libraries\WiFly/SpiUart.h:62: error: conflicting return type specified for 'virtual void SpiUartDevice::write(byte)' <br>C:\arduino-1.0.4\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)' <br>In file included from C:\arduino-1.0.4\libraries\WiFly/WiFly.h:8, <br> from Twittering_Roomba.pde:4: <br>C:\arduino-1.0.4\libraries\WiFly/Client.h:21: error: conflicting return type specified for 'virtual void Client::write(byte)' <br>C:\arduino-1.0.4\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)' <br>C:\arduino-1.0.4\libraries\WiFly/Client.h:23: error: conflicting return type specified for 'virtual void Client::write(const uint8_t*, size_t)' <br>C:\arduino-1.0.4\hardware\arduino\cores\arduino/Print.h:53: error: overriding 'virtual size_t Print::write(const uint8_t*, size_t)' <br>In file included from Twittering_Roomba.pde:1: <br>C:\arduino-1.0.4\libraries\Twitter/Twitter.h:35: error: 'EthernetClient' does not name a type <br>In file included from C:\arduino-1.0.4\libraries\WiFly/WiFly.h:4, <br> from Twittering_Roomba.pde:4: <br>C:\arduino-1.0.4\libraries\WiFly/SpiUart.h:62: error: conflicting return type specified for 'virtual void SpiUartDevice::write(byte)' <br>C:\arduino-1.0.4\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)' <br>In file included from C:\arduino-1.0.4\libraries\WiFly/WiFly.h:8, <br> from Twittering_Roomba.pde:4: <br>C:\arduino-1.0.4\libraries\WiFly/Client.h:21: error: conflicting return type specified for 'virtual void Client::write(byte)' <br>C:\arduino-1.0.4\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)' <br>C:\arduino-1.0.4\libraries\WiFly/Client.h:23: error: conflicting return type specified for 'virtual void Client::write(const uint8_t*, size_t)' <br>C:\arduino-1.0.4\hardware\arduino\cores\arduino/Print.h:53: error: overriding 'virtual size_t Print::write(const uint8_t*, size_t)'
Ah yes. Arduino 1.0 changed a few things. I can't remember if my code needed changing itself, so do you have the 1.0 version of the WiFly library? https://github.com/jmr13031/WiFly-Shield <br>When I ran in to this problem, I think the only needed fix was updating the library, but if you still have problems, I'll take a look at my code.
Just curious. <br>I made this cable but haven't tested it yet. Is the pin out supposed to be for the male end (cable) or the female end (roomba serial port)?
The illustration in the bottom right of Img.6 is the female port on the Roomba. The main picture is of the back-side (with the solder cups) of the male connector (so from the viewpoint, it is the same as the bottom-right drawing, but rotated 180 degrees). <br> <br>I hope this was helpful.
I just added a couple of notes to the image to add (hopefully) a little more clarification.
A twittering robot is awesome! haha. A great introduction to interfacing with the roomba can be seen here: <br /> <br />http://www.robotappstore.com/Knowledge-Base/3-Serial-Port-Baud-Rate-Configuration/17.html <br /> <br />what's nice with the roomba - is that you can program via any type of language you want - as long as your program ultimately sends the proper serial commands down to the roomba. <br /> <br />Cool project - :) <br />
That's a great work!<br> <br> Why not doing that with code? (like .Net, or Java...)<br> It seems much easier when you are connected to a computer.<br> <br> (check out this <a href="http://www.robotappstore.com/Knowledge-Base/How-to-program-Roomba-for-NET-developers/23.html" rel="nofollow">Roomba Programming guide for .Net</a> for more details)
very nice job
this is a good invention very good invention actually and you should get it to say im bout to explode when its filled up <br>
The fact that it tweets is hilarious. &quot;I'm all done with the living room!&quot; lol
It sure is being picked up a lot :P
I like making it mad ;)

About This Instructable




Bio: I am a 18 year-old computer and electronics enthusiast. I love to program computers and design electronic circuits.
More by matchlighter:Web-controlled Twittering Roomba 
Add instructable to: