Add Scheduling To A Roomba 532 via Arduino

For the class I’m planning on controlling a few Roombas for art-related nefariousness. Harvey, a friend of mine, gave me two Roomba 562’s he found in a dumpster to complement the 532 and Elite Pro I already owned. The 562’s have a really neat feature that is not present on my 532: You can setup an automatic schedule for cleaning instead of having to manually start the Roomba. Currently I have two options: 1) turning on my Roomba when I leave for class and risk the possibility of waking my potentially still sleeping roommate or 2) Starting the Roomba when I get back from class and have it bump around while I’m trying to cook. Both of the Roomba’s Harvey gave me are inoperable as a daily vacuum, and I wanted the scheduling feature on my 532.

So, here’s how I did it. From top to bottom.

Step 1: Get the Roomba connected to your Arduino.

XBees, Cable-mods, Rootooth, BlueSMiRF… There are all kinds of guides on how to do this with some really cool technology. I decided to use simple wires.

Remove the top cover of your Roomba (Pull out the dust bin, then just pry the top off.) You’ll find a port that looks something like this:

image

On Your Arduino, you have a similar complement of ports.

image

Just take a wire, plug it into the Arduino, then jam it down into the corresponding hole on the Roomba.

Arduino: Rx Pin 0  ———> Roomba: Tx Pin 4

Arduino: Tx Pin 1  ———> Roomba: Rx Pin 3

Arduino: Pin 2 (Green In Above Pic) ———> Roomba: Device Detect Pin 5

Arduino: Vin ———> Roomba: +16V Pin 1 or 2 Just pick one

Arduino: Gnd ———> Roomba: Ground Pin 6 or 7 Just pick one

So now you’re saying OMG. +16V is going to fry my Arduino. It didn’t fry my Diecimila or Duemilanove boards.

So, now you’ve got all this connected, switch the jumper from USB power to EXT power. Your Arduino will now run off of the Roomba’s battery.

Launch your Arduino compiler and connect the USB Cable.

Here’s the code:

int rxPin = 0;

int ddPin = 2;

int ledPin = 13;

void setup(){

//Setup pins

pinMode(ddPin, OUTPUT);

pinMode(ledPin, OUTPUT);

Serial.begin(115200);

//Visual Confirmation that everything is OK so far.

digitalWrite(ledPin, HIGH);

delay(1000);

digitalWrite(ledPin, LOW);

delay(1000);

digitalWrite(ledPin, HIGH);

delay(1000)

digitalWrite(ledPin, LOW);

//Setup ROI to recieve commands

Serial.print(128, BYTE); //START

delay(50);

Serial.print(130, BYTE); //CONTROL

delay(50);

//Set Current Time

Serial.print(168,BYTE);

Serial.print(3,BYTE);

Serial.print(22,BYTE);

Serial.print(0,BYTE);

//Send Scheduling Info

Serial.print(167, BYTE);

Serial.print(127,BYTE);

Serial.print(15,BYTE);

Serial.print(0,BYTE);

Serial.print(15,BYTE);

Serial.print(0,BYTE);

Serial.print(15,BYTE);

Serial.print(0,BYTE);

Serial.print(15,BYTE);

Serial.print(0,BYTE);

Serial.print(15,BYTE);

Serial.print(0,BYTE);

Serial.print(15,BYTE);

Serial.print(0,BYTE);

Serial.print(15,BYTE);

Serial.print(0,BYTE);

}

OK. So, make some changes depending on when you want the Roomba to run.

Under //Set Current Time

168 = Let Roomba know we want to setup the time

3 = The Day

22 = Hour (24-hour format)

0 = Minutes

Here’s how days work:

image

Next in the code is when you want the Roomba to run. Here is the sequence:

167 = Setup scheduling

127 = Days to run (will be explained)

Sunday Hours (24-hour format) then Sunday Minutes, two for each day, all the way until Monday. In the code, I’ve set my Roomba to run every day of the week at 3 PM.

Days to run is determined like this:

Value Day

1 Sunday

2 Monday

4 Tuesday

8 Wednesday

16 Thursday

32 Friday

64 Saturday

So, add up the value for each day you want your Roomba to run and put that into the code. (127 = Every day of the week)

Power down the Roomba, upload the code, hit reset on your Arduino, wait 30 seconds and your schedule has been set.

image

(Yeah, it’s a picture of a 562 with the scheduling interface, but it’s been tested and working on the 532.)