So when I showed some friends my Roomba’s new modifications, it got more attention than I expected. It wasn’t until later that I realised I’d left out all of the technical details. Most people are bored by the technical detail and just want to enjoy the spectacle. This post is going to be for those that like the how to side of things. Safety gear on, we’re going to make a thing…
Ok, I’ll take you through this in steps exactly as I did it. Obviously I’ll point out bad decisions as I go.
FIRST THINGS FIRST: Don’t name it! Any of it. Not the Roomba, the camera, the remote. If you aren’t careful, you could accidentally short a connection, watch the lights of your electronics fade out, the magic smoke escape from it’s lifeless shell, and realise that you’re now going to have to find somewhere that sells a 12 mhz crystal at 9pm on a Saturday night. At which point, the loss of little Roomby may be enough to push you over the edge.
That’s also a hint that if you attempt this and it goes bad, blah blah you know the deal, we void warranties. I’m not giving you the disclaimer speech. I don’t know about your model of Roomba, but this is a 530 Series. The other can probably do the same if not more, but I don’t own those models. This looks complicated, but it isn’t. It’s a lot of little simple separate systems stuck together with velcro to make an integrated system.
First…you need to understand that you can actually connect to a Roomba without hacking it up.
The green plate you can see on this pic of my other Roomba can be removed to expose a communication port. I find it easiest to take the dustbin out of the back and gently start prying it up from there with my fingers. The communications port is a little black socket with about 8 holes on the top of the right side.
So what? Make it dance already!
So the first thing you’re going to need is something to plug into that communication port. There’s a few things you can buy online, like the Rootooth, but I didn’t want to buy one. I have a lot of spare electronics, so no need to waste money. Let’s cheat a little. You’re going to want some “breadboard”.
Basically you can plug wires into the little holes you can see in the picture above and link components together. If you don’t understand…maybe google or youtube it.
I’ve got a bunch of the jumper wire like you see above and they can be pretty handy, but let me give you…
A VERY IMPORTANT TIP: Do not trust these little bastards. They’re kind of a loose fit and slip out of the prototyping boards easily and worst of all, the ends break off in the black sheath. So you plug it in, spend 4 hours trying to work out WTF is wrong with your build before you work out the cable is hiding the betrayal. Seriously. You have no idea how many 4 letter words I’ve muttered at them under my breath.
If you decide to use these, just remember to test them regularly and replace them with real wiring once you know your circuit works. The other option is to cut the end off a PS/2 mouse or keyboard. Plugs right in.
Don’t worry about the apparent shortage of pins. We don’t really need all of them.
Now What? Yell Into the Cable?
Why not? I did. But it’s easier if you have a device that can yell down it for you. I’ll tell you right now that my Roomba 530 speaks a sort of Serial. Like…provincial Serial. You’ll want a device that can run off 5 volts, speak Serial, and can connect to your computer. Or you know….a long Serial cable. An Arduino is ideal though.
I went with the Arduino Nano since it covers all these bases, has heaps of inputs and outputs, and I had spares. Time for another…
VERY IMPORTANT TIP: If you’re a cheapskate, or just unlucky and you end up with a clone like I did, you may have trouble getting this to show up when you connect it to your PC or Mac. This champ did us the favour of rounding up the drivers. You may also find that you need to burn a bootloader to them as some clones aren’t preloaded.
Install the Arduino application and make sure you can at least upload the blink sample program successfully before you go plugging things in everywhere.
While we’re on the topic of having wires everywhere, take my advice. Don’t balance the Arduino on one knee, the laptop on another, the Roomba on your table lamp, and attempt to plug dental floss cables into it all like some sort of nerdy marionette. I swear by these things now…
Do it. These removable stick on velcro pads mean you can stick your component to the Roomba without damaging it. Since it’s velcro, when you need to solder something or get a closer look at your wiring, you can just pull the component off quickly and stick it right back.
Pluggy Pluggy Time Now?
Alright fine. Let’s plug some stuff in. You’re going to need to know where though. I found this document that details the 500 series, but it looks like the Create 2 series specifications for the comms socket are the same. Just because I found it, here’s the Create original specs.
Short version? Get your devil wires and follow along with the rest of the class as we link this all together.
I’ve stuck my breadboard to the Roomba just behind the comms port, close enough that I can use relatively short wiring, and then inserted the Arduino Nano as seen below.
So bare minimum to get the slightest peep out of this thing, you’re going to need to get some power to the Arduino Nano (+5v and Gnd), a connection to send commands, and one to receive information back. There’s one more pin to add which isn’t really needed, but it let’s the Arduino power on the Roomba. Without it, if you power the Roomba off, the only way to turn the Roomba on is to press the “Clean” button manually. Here’s some pictures of the 2 devices you’re connecting together, with the pins labeled.
Connect as follows…
Roomba —– Arduino
7 ————— GND (the one above VIN)
3 —————- D9
4 —————- D8
2 —————- VIN
5 —————- 7
If you’re still with me, you should end up with something that looks like the following picture, but with better lighting and maybe some lens flares.
For those of you who are a little more cautious, you may have notice we just plugged an unregulated power supply (allegedly 18volts) from the Roomba into a 5 volt device. Yep. Turns out VIN on the Arduino Nano is quite robust and can handle up to about 20volts. That’s nice. 🙂
I See Light, But No Killbot!
Right. So let’s load a test code onto the Arduino. I am not an elegant coder. I know. I write unmaintainable code and I’m ok with that. You should remove the Arduino from the breadboard to do this next bit. Plug the Arduino into your computer via USB then upload the code below to the Arduino.
WARNING: If you don’t remove the Arduino from the breadboard to do this, you could accidentally activate the Roomba and it could….I dunno….drive off and pull your computer off the desk?
SoftwareSerial mySerial(8, 9);
int powerPin = 7;
delay(1000); //Give it a second to settle Grettle
mySerial.write(133); //Tell the Roomba to start in the off state in case it’s not there.
delay(500); //Easy there tiger, give it half a second to get it together.
digitalWrite(powerPin, LOW); //This little block toggles pin 7 to wake up the Roomba
mySerial.write(128); //Alright wake the Roomba up by putting it into Passive Mode
mySerial.write(130); //Let the Roomba know who’s boss by putting it into Safe Mode
mySerial.write(141); //Hey Roomba, sing me something.
mySerial.write(2); //Sing me the song of your people.
If everything went to plan your Roomba should loop through a sequence of:
- Power on
- Play a tune
- Power off
If it’s not doing that, something went wrong. Go back and double check everything.