PiRoomba

   

Peter Wallis, June 20th 2013

Introduction

A Roomba 530 on its charge station.I have put a Raspberry Pi on my Roomba robot vacuum cleaner. The next section deals with the why; then we cover the how, link to the code, etc.

Controlling

The Roomba is a autonomous robot vacuum cleaner that can can be bought on line or, on occasion, from department stores. The machine has an interesting history in that it is manufactured by iRobot, the company set up by Rodney Brooks and others from MIT in the 1990's. The company has sold around six million Roombas[1] and the machine has in effect defined its own market with several imitations now available. Today however iRobot is probably more famous for producing the Packbot series of military remote control robots -- time for a quick visit to the campaign to stop killer robots?

The illustrious pedigree of the Roomba is evident in the way it works. The Roomba does not map the room but rather performs a semi random walk that is likely to cover any given spot multiple times (see time lapse photo). With no sense of location, the roomba is often seen as little more than a toy by computer scientists but there are historical reasons for the Roomba to take this approach. Ignoring the history is of course likely to lead to one repeating it. A time-lapse photo of the roomba's path

There are three good reasons for using a Roomba as the basis of serious robot research:

  • iRobot is really good at producing a robust platform with useful accessories. My Roomba is currently sitting on its charging platform and later today will clean the front room floor. It is a system that regularly runs for years rather than minutes. The system is well made with spares available. Indeed my Roomba is a second hand unit that was suffering the "9 beep dance". I fixed it with a soldering iron and a 60p component from Maplin Electronics. The thing has been chased by the children, dropped (not too far) and tells me when it needs a clean. What you get with a Roomba is something with lots of development behind it.
  • The Roomba has an application that means it is always on. You get all the above if you buy a iRobot Create but if I was using a Create, why would I leave it on? Like my previous robots, there is no doubt something I made with the Create would end up being disassembled or in the back of a cupboard with the batteries out. My Roomba is there and I am continually temped to modify it.
  • Having an application means that Roombas provide a pathway to addressing a fundamental question in language & representation. Many robot people have the naïve idea that things in the robot's environment can be represented with arbitrary symbols. It turns out that `symbol grounding' (not really the right term) happens through our experience of the world and that experience is determined by embodiment. By the 1980's AI research realised the reference model of meaning failed surprisingly quickly when moves out of a "blocks world," but what could we do about it? The issue has a long history going back at least Heidegger and Witgenstein, extending through to Gibson's notion of affordances, to Lakoff & Johnson's notion of metaphor, and to Ruthrof's "semantics of the body". How this thinking links into serious robot research is an on going issue.
The link however does bring us back to an interesting feature of the Roomba. There is a problem with representation and Brooks grand agenda (in the early days at least) was to see what could be done without representation. The Roomba's random walk is not a quick fix that ought to be replaced with an algorithm based on some sort of map, but rather it is a considered solution to a classic problem. Indeed when one looks at the Roomba Open Interface, the architecture is very much Behaviour Based Robotics with "primitive" commands for "clean", "seek dock" and so on. In the same way one might like to start with two motors and a chassis and not use the excellent work done by iRobot to make a Roomba, one could also throw out their excellent work on the application/architecture and use a iRobot Create. I however think the Roomba is a better place to start thinking about robotics.

Connecting

A raspberry pi on a Roomba - top view
I have a Roomba 530 with a serial interface and open API as specified here. Connecting the pi requires a serial connection between the pi an the roomba's serial port, and some way of powering the pi from the 18volt supply on the roomba. I have put the pi in a plastic case that is connected to the bumper. That way when it goes under a chair and catches the case, the force is transmitted to the bump sensors and the standard software figures out what to do.
A raspberry pi on a Roomba - side view

The home made 7 pin DIN plug Unfortunately the clear plastic bowl I could get to cut down was slightly too small and so I ended up making a 7 pin DIN plug out of a piece of brass tube, some bass wire and some epoxy putty from the local hobby shop. The process was to solder the wires onto the pins, take the battery out of the Roomba and put vaseline on the serial plug on the Roomba. Put the pins (and earth ring) in the Roomba socket, and then push putty over the top of the pins. When it dries, take the plug out (carefully) and "back fill" the plug from the pin side and push it back into its vaseline covered socket. Let it dry and clean up.

The pi - Roomba interface board There are two electrical challenges. First the serial interface to the rpi is 3.3v and the serial interface to the Roomba is 5v. To address this I simply used a voltage divider on the Roomba TxD to rpi RxD connection (see circuit below). The rpi TxD to Roomba RxD connection is fine as 3.3v seems to be enough to drive the Roomba RxD signal.

The pi - Roomba interface board circuit

The second challenge is that, although there 18-14v available directly from the Roomba battery via the serial plug, there is a 200mA poly fuse on that supply and the Roomba draws up to 700mA. It actually only draws 330 mA when running but round 420 on boot. The difference between what it normally draws and the specified required current is to drive things hanging off the USB ports. The solution was to use a DC to DC converter (available through Farnell in the UK) that would provide 400mA. This turns out to be enough to boot and so my 4 rechargeable batteries are redundant until I put something weighty on the USB connections. Here is the circuit I used - there are some strange choices (the inductor is surface mount; the schottiky diode is too big ...) but these decisions were based on what I had and could get. The original idea was to tune the potentiometer to deliver a trickle charge (via a current regulator) to the batteries and have the the power to the pi go via a voltage regulator. This doesn't work as I don't seem to be able to find a voltage regulator that will take 5.45v down to between 4.8 and 5.2 volts. Please mail me if you have any suggestions.

Finally the code. I have written (most) of the Roomba Open Interface as a Java package that uses RXTX behind the scenes to communicate with the robot. In addition I have written a user interface that provides a "joystick" to steer the roomba, and a set of level meters that indicate the output from the 6 "light bump sensors": my laptop running the Roo Pie remote control interface with the roomba finding the sofa.
The code is in Java and uses Sockets to communicate between a computer running the user interface and the rpi, and RXTX to communicate between the rpi and the roomba. The code is available for download here as a tar ball.