Guest blog #1: Repurposing a Roomba by Ben J
Clive: The future has been so disappointing. We were promised force fields; teleporters; and androgynous, android manservants. Instead we got cagoules, budget airlines and robovacs. And what do you do with a robovac when it reaches the end of its useful life? You stick a Raspberry Pi on it and make it into a proper robot of course! In the first of our guest blogs Ben J, 14, does just that (thanks Ben!):
Hi! My name’s Ben.
I’ve always had a big interest in robotics and electronics in general, so when I heard about the Raspberry Pi, I knew I had to build a robot around it. This is what I came up with:
The base of the robot is an old iRobot roomba 4000 with all of the cleaning brushes and their respective motors removed.
The model of roomba that I used has two drive wheels and a coaster wheel in front, and the drive wheels draw almost 300mA of current, so powering them directly off of the Raspberry Pi’s GPIO obviously wouldn’t work. So, I considered using a relay board to control the two drive motors from the GPIO. However, it turns that all the good boards were a little too expensive for a hobby project, so I decided to open the roomba up and see if I could somehow control the motors from the existing circuitry. Guess what? It turns out that there are four small transistors on the main board that power four larger transistors that deliver power to the motors. This means that there are two transistors per motor: one for forwards and one for backwards.
They’re labeled Q13, Q14, Q30 and an un-labeled one near R129.
I had a little help in discovering this from a video that a man named Dean Segovis had posted on YouTube, but I ended up taking a multimeter to the board; just to make sure that I wasn’t hooking my precious pi up to anything dangerous. You can watch Dean’s video here:
Once I had confirmed the location of the transistors I needed on the board, I connected their bases to GPIO pins 4, 17, 18 and 21 on the Raspberry pi with with a 16 pin socket that I had lying around.
To power the Raspberry Pi, I soldered together a power supply circuit around a 1 amp 5 volt regulator (basically the regulator and two capacitors) on a piece of perf board and had the 5v output from the regulator run to a micro USB connector. I also added some miscellaneous components to the circuit, like a power switch, a 2.5 Amp fuse, a 12 volt in socket and some 12 volt out sockets; one of which the camera is plugged into. The roomba’s main board is also plugged into a 12 volt out socket.
For the camera, I just used an ip network camera from the company Vivotek.
I had tried to use a USB webcam that you might use for skype calls, but streaming video from the pi slowed it way down and the picture quality wasn’t as good as I had wanted. I wasn’t using the best webcam in the world, though.
To hold the Pi in place on the robot, I just glued some plastic pegs where I wanted it to go:
One in between the USB and Ethernet ports, one in between the audio jack and the component video port, one near the HDMI port and one near the SD card slot. This makes it easy to remove the Pi from the robot when It isn’t in use, yet it holds it in place very well.
The entire robot is powered off of a small 12 volt lead acid battery that fits nicely into the slot where the roomba’s original battery went. I could have used the original battery, but the one that came with my roomba was extremely old and wouldn’t take a charge any more. .
Lastly, I wrote some software in python to take input from a Nintendo wii remote and transmit the input it got to the Pi over wifi, where it’s decoded by another piece of python software and the wheels are moved according to the position of the joysticks on the wii remote. You can get my code at the links below:
Server.py – This one runs on the Raspberry Pi:
Client.py – This one runs on your “base station” computer, a laptop for example:
You can watch a short video of me driving the robot around on my YouTube channel:
And I think that’s about it. If I was unclear about anything or if you want a more detailed description of my project, please email me at benhjake (at) gmail.com , or leave a comment below. Also, if you replicate my project, I’d love to see a picture or two. You could email those to the same address. Thanks, and Happy Hacking!
Wow. Now If only I had one…..
My model 400 Roomba has a serial port, and iRobot documents the protocol you can use to control a robot using that port. You can read the sensors and control all the motors.
The protocol is documented here: http://www.irobot.com/images/consumer/hacker/roomba_sci_spec_manual.pdf
Might be an easier way of connecting a microcontroller board to a Roomba.
Actually I did look into the roomba serial protocol and tried to use it, but it turns out that my roomba was one of the earlier 400 models; so it didn’t have the correct firmware in it. At least thats what I was lead to believe. But if you own one that does have the correct firmware in it, that would definatly be a better solution than what I did.
Anyone know where any documentation for the Python CWiiD library can be found?
CWiiD really falls short when it comes to documentation. To tell you the truth, I don’t believe I ever found any. There probably is some somewhere, but I learned how to use it from the tutorial here:
To use the classic controller, this bit of python code should give you the values of the left and right sticks:
# Code starts
print ‘Press buttons 1 and 2’
print ‘Wii Remote connected…’
Rumble = False
wm.rpt_mode = cwiid.RPT_CLASSIC
right = wm.state[‘classic’][‘r_stick’]
left = wm.state[‘classic’][‘l_stick’]
print ” ”
# Code stops
I hope you get the remote working.
Eben has said something to the effect that if the Pi is only responsible for one new engineer for each 1,000 kids who get to play with a Pi, the Foundation will have exceeded its wildest expectations. Ben is Peoples Exhibit A that there are 999 (hopefully less) other kids who can rest easy without feeling pressured to become geeks, now. They’re still more than welcome to go nerdy to their heart’s content, but they can just relax and have fun with their Pi without worrying about it.
I don’t recall him saying if this would allow him to die a happy man, but he can at least cross making Ben a proto-engineer off his bucket list! :D
There is a library called ‘pyroomba’ to control iRobot via serial port:
I’ve used it with iRobot create and it works very well.
That’s brilliant. The only possible enhancement would be lasers!
Brilliant work Ben;
Plus you have also done a geat service by re-tasking one of the Devils motorbikes, a vacuum cleaner, ( yeah I know Roombas are sweepies) from the planet .
The noise of a vacuum is guarenteed to bust any train of thought into a thousand pieces..
Doesn’t the Roomba have collision sensors and stuff which could Ripe for RPi control ???
Roombas have collision sensors and cliff sensors, both of which you could easily read with a raspberry pi, as the collision sensors are really just momentary switches, and the cliff sensors are ir leds, I believe. It can also sense whether all of the wheels are touching the floor or not. It does that with more ir leds. I’ve been thinking about making the robot autonomous with those sensors for a while. Perhaps I could put a tray on it and code it to bring me a sandwich?
Thanks for the comment,
Wheels and a sandwich? Liz would be over the moon! :-D
Obligatory XKCD: http://xkcd.com/149/
Actually, I’ve got a t-shirt with that one on it!
Just had it on yesterday…
So much potential!
Driving it around like a RC-toy is nice, but having the Pi to control the Rumba, read from its sensors and make autonomous decisions would have been awesome.
Ohhh it’s great!
He had a model iRobot Dirt Dog, which is crazy and does not want to clean,
maybe I decided to make this union.
It has a serial port,
I hope with raspberry, the puppy tail wag… :-P
Thank’s BEN !!!
Thanks for this post! In a matter of a few hours I got my Roomba controled by the arrow keyboard keys from a java/php page hosted on the pi. I’m using simple “`echo “0” > /sys/class/gpio/gpio17/value`” type commands to control it on the PHP side of things and using jquery to take the keyup/keydown actions to the appropriate php scripts.
Question… Everything seems to run pretty smooth with the exception of reversing both motors. Forward works great, and left/right works great, but it seems like when I go reverse with both motors, it runs at 1/4 of the power. Have you ran into this?
Makes it hard to reverse out of the charge dock.
I really enjoyed writing the post, and I’m glad that you liked reading it.
It’s really cool that you got your roomba to move in a couple hours, because it took me about two months to finish mine. I assume you opened it up and soldered to the transistors on the motherboard?
To answer your question about ‘full reverse’, in my experiences it does go slower when you try to drive both wheels backwards. Then again, mine has a weird problem where one wheel moves slightly slower than the other, making it drift to the side slightly. Maybe it was never made to go backwards? Sounds kinda silly, but maybe it normally just spins in a circle to to go back the way it came…
Thanks for the comment,
Comments are closed