Roomba Remote Tilt Controller

What do you get when you combine Bluetooth®, Accelerometers, and the iRobot Roomba SCI? A vacuum for couch potatoes.

The RooTilt is just an amalgamation of toys here at SparkFun Electronics. We took a Bluetooth®  wireless accelerometer, tweaked the firmware a bit, and combined it with the RoboDynamics RooTooth wireless link for the Roomba. Now you can literally drive your Roomba to the pile of Styrofoam bits on your floor (because you know I hate Styrofoam) all from the comfort of your couch!

Remember, this is not like a joystick - there are no moving parts. You simply tilt the controller board to indicate how you want the Roomba to move. Doesn't quite make sense? Don't believe me? Here are some movies to whet your pallet:

Just in case you were wondering, the movies are located on the BatchPCB server so that they don't load the SparkFun server.

Oh, and here is the firmware in it's primordial form. Definitely not polished, but it gets the job done:

It's a very simple idea, get some tilt values, translate them into throttle and radius commands that the Roomba can understand, and then transmit them over the Bluetooth® wireless link. But get ready for some technical talk and a breakdown of ADCs, serial com, and some funky math.

This project was made easier using the WiTilt and the Bloader/Screamer boot loader that we designed for the 16F family PICs. We can quickly and easily bootload test code onto the WiTilt board. It took quite a bit of firmware work, and it's still not perfect, but you can drive the Roomba around.

You can buy the RooTilt with accompanying RooTooth here.

The WiTilt Breakdown -

The stock WiTilt reads the analog values from the MMA7260Q triple axis accelerometer. Is this triple axis sensor overkill? Completely. We only need two axis, but the WiTilt is a stock part so I decided not to muck with it.

Stock photo of the WiTilt v2.3. The latest version 2.5 has additional indicator LEDs.

The MMA7260Q outputs analog voltages. This means, as you tilt the sensor (or shake it like crazy) the sensor will output a voltage that varies between 0 and 3.3V. The PIC 16LF88 on the WiTilt reads in these voltages, and converts them to a digital number (aka analog to digital conversion, ADC, AtoD, A/D). At 0'g' (zero gravity) you'll see exactly half of 3.3V (or 1.65V). This 1.65V gets converted on the PIC to a digital number.

The ADC on the 16LF88 is 10 bit. So if 0V = 00.0000.0000 (10 bit binary) and 3.3V = 11.1111.1111 (10 bit binary for 1023) then 1.65 must be half of 1023, or roughly 512. From now on, I'll only use the decimal values.

0g = 1.65V = 512

1g = 1.65V + 0.8V = 2.45V = 760

-1g = 1.65V - 0.8V = 0.85V = 264

The MMA7250Q outputs 800mV/g in 1.5g mode. This is all spec'd in the sensor's datasheet.

So if we tilt the WiTilt forward completely, we should see 760 from the accelerometer on the X-axis and we should tell the Roomba to go forward at max speed. On the flip side (hah) at -1g, we should see 264 and should tell the Roomba to go full speed in reverse.

Turning deals with the same number range but on the Y-axis. At 760, we should be turning to the left, in place. 264, turn to the right in place. Anything in between dictates a less extreme turn rate.

Roomba SCI -

iRobot rocks. They had the brains to open the Roomba platform for hacking. Way to think ahead iRobot!

The Serial Communication Interface (SCI) is the document that will tell you how to control the Roomba through the DIN connector on the Roomba. The SCI is available from iRobot hacking page. The SCI pdf is here.

If we send the Roomba the motor command 137 followed by a throttle command and a radius command, the Roomba should move however we command it. The problem is that the Roomba is too smart. We have to tell it a very calculated number called the Turn Radius - the smaller the number, the smaller the radius, the tighter the Roomba will turn. So we need to take an increasing tilt value (we are talking about the Y-axis here) and create a decreasing radius value. Not the end of the world, but tricky.

Also, the Roomba requires some throttle when turning. So not only must we calculate a radius, but we need to overlay some throttle on top of that. Again, just takes time and firmware tweaking. Speaking of which...

PIC Bootloading -

Have a look at the Bloader/Screamer page for sure. If you've never programmed PICs before, it probably won't seem like a big deal. But if you're an avid PIC programmer, you may want to invest an afternoon and fiddle with a boot loader. It will save you days of time.

The stock WiTilt board comes with some firmware already on it for basic accelerometer data broadcasting. This won't work with the Roomba directly. So using our RS232 Shifter board, I can connect to and reprogram the PIC 16LF88 on the WiTilt.

Using the shifter board, I also am able to debug through the serial port - very handy when you need to see what the PIC is passing to the Roomba (over the Bluetooth® connection).

The PIC 16LF88 communicates at 57600bps with the Bluetooth® module and the RooTooth in turn communicates with the Roomba at 57600bps (required by the SCI spec). So in the firmware:

The math magic happens in the calc_throttle and calc_turn routines. The main routine (shown above) takes care of the basics of check for a flat controller (when the controller is set down, shut the Roomba down), sharp turning (turn in place is a special case), and finally general drive commands.

That's about it. The RooTilt was a fun project and our first experience with a Roomba. I never thought I would buy into all the Roomba hype or believe the marketing people that say 'it just works', but now I do. We let the Roomba loose every night and because we've got cables and chairs, and a fairly large office, the Roomba rarely makes it back to it's charge station alive. But who cares? This little autonomous vacuum does a surprisingly good job of cleaning, it is extremely well designed, and the Roomba can now be augmented with hacks just like the RooTilt through the SCI port. Well done iRobot.

March 30th, 2006 - NES (I am happy to hear from readers!)

You can buy the RooTilt with accompanying RooTooth here.

Comments 4 comments

  • Member #449667 / about 10 years ago / 1

    Check out this seems now a easier way to play from the iPhone

  • Member #334574 / about 11 years ago / 1

    If anyone is interested in reading a good writeup about programming the roomba using rootooth or a direct serial cable link this might be worth checking out:

  • mcpherrinm / about 11 years ago / 1

    The links to the videos are dead.

  • NXTreme / about 13 years ago / 1

    Very cool! I've always wanted to tell something smart what to do:) I did notice that the video links at the top of the page are 404ed. I don't know if you still have the videos floating around somewhere but I think that the SF servers could handle those videos now, especially with all those dinosaurs helping you out. Thanks.