Interfacing Roomba and Arduino, Getting Started

When a Roomba vacuum has reached the end of life, it can be repurposed into a useful experimental robotics platform. This post will provide the necessary information for to anyone to get started making an autonomous robot from a used Roomba. There are many different ways to send commands to the Roomba. This post will describe the use of the low cost and very popular Arduino microcontroller.

The specific Roomba in this example is a Roomba 4000, manufactured by iRobot in 2007, shown below.

DUT - Roomba 4000
Roomba 4000

Step 1 – Operations Check

The machine was very dirty due to years of service as a vacuum cleaner. It took at least two hours to fully disassemble the machine and perform a thorough cleaning with a ShopVac, air compressor and brushes. The battery was removed from the device and connected directly to the charger for one hour (warning, this can overheat the battery). This was accomplished because the internal charging circuit of the Roomba was inoperative, a common problem for this model.

After installing the battery, the Roomba powered up and performed a normal cleaning. It did a great job and the dogs were mildly interested in it while the robot performed a cleaning operation. A photo of a puppy investigating the robot is shown below. Note that the Power LED is red, indicating a low battery charge.

Plato checks out the Roomba 400
Puppy investigates

Subsequent testing revealed the machine required a replacement battery, filters, brushes and brush bearings. The trade off analysis resulted in the decision to hack the device as a robot development platform, when compared to the cost of a new Roomba.

Roombas manufactured after October 2005 can be given commands via the serial port using the iRobot Roomba SCI. This makes it ideal for a platform to experiment with robotics. Roombas with firmware that predates this date cannot be controlled using the SCI. This would result in a large amount of extra work to build the required circuitry and logic to interface with the motors, encoders and sensors.

The firmware date version was determined in accordance with the information provided in a post (reference link):

1. Disconnect the roomba from the charger.
2. Hold down the power button for about 10 seconds.
3. Count the dits and dahs
Note: Each short beep equals 1 and each long beep equals 5. The format is year month day.

During this check, it was discovered that the speaker was inoperative. The wiring to the existing speaker was disconnected and reconnected to a used 8 Ohm speaker from a discarded desktop computer. The wiring was routed through a new hole drilled in the cover and the speaker was secured with double-sided tape. The video below shows the results of the firmware check. The first series of beeps indicate a firmware year of 2006 (one long and 2 short). This indicates this machine is compatible with the iRobot Roomba SCI.

Step 2 – Interim Battery Installation

No direct replacement battery was available (for free). As a result, a 12VDC AGM (Advanced Glass Mat) battery was installed on the top cover with double-sided tape. The working battery was salvaged from a discarded UPS (Uninterruptible Power Supply). See the wiring diagram and photos shown below. The blue pen indicates the position of the connector described in the photo caption and listed on the wiring diagram.

Note: the battery is charged with an automotive battery charger (not shown), bypassing the Roomba charging circuit.

Wiring diagram showing installation of interim battery, switch and power connector for Arduino Microcontroller
Wiring diagram showing installation of interim battery, switch and power connector for Arduino Microcontroller
J15 Battery Connector
J15 Battery Connector
Connector Near 207  Note: 207 is printed on the Circuit Board nard the connector
Connector Near 207
Note: 207 is printed on the Circuit Board near the connector

Step 3 – Interface Roomba Serial Port to Arduino Uno with Jumper Harness

The Roomba has a Mini-DIN connector in which the serial port can be accessed with an interface cable that has the correct mating connector. The location of the serial port is shown in the diagram below, from page 6 of the iRobot Discovery/400 Series Owners Manual. According to page 2 of the SCI, the serial port is a 5V logic level with a default baud rate of 57600, 8 data bits, no parity, one stop bit. This is compatible with the Arduino serial default of 8 data bits, no parity, one stop bit and an adjustable baud rate that includes 57600.

Location of Serial Port
Location of Serial Port

For reasons of convenience,  the Mini-DIN connector was cut away and a jumper harness was spliced in place. The external charger jack was also removed and the wiring was capped and stowed. This is shown in the photo below. Referencing the diagram from the SCI Spec Manual page 2, DD (Device Detect or Wake Up) connects to a black wire, TXD (Roomba Transmit Data) connects to an orange wire and RXD (Roomba Receive Data) connects to a yellow wire in the Roomba chassis wiring. The other side of the jumper harness was terminated to #22 pins that can connect to the Arduino’s headers.

Serial Interface Cable
Serial Interface Cable

Finally, a Arduino Uno Rev 2 was installed with velcro and the serial cable connected as shown in the photo below. The dust bin and all vacuum related components have been removed.

Wiring to the Arduino is as follows:

Arduino Uno Digital IO 5 RX to Roomba pin 4 TXD (yellow wire)
Arduino Uno Digital IO 6 TX to Roomba pin 3 RXD (orange wire)
Arduino Uno Digital IO 7 DD to Roomba pin 5 DD (black wire)

DUT with replacement speaker, interim battery and Arduino microcontroller
Roomba with replacement speaker, interim battery, switch and Arduino Uno

Step 4 – Wake Up

The Device Detect (DD) pin is not part of the serial communication, per se. According to page 2 of the SCI, sending an active low pulse on this pin will wake up the Roomba from the initial power on default sleep mode.

Shown below is an image of the program that is loaded on the Arduino to wake up the Roomba. Once it is run, the Roomba makes a sound and the clean light illuminates green. Here is a link to the code:

2015-05-29 08_16_13-roomba_wake_up _ Arduino 1.6.4

Step 5 – Blink the LED

A popular first program to run on a microcontroller is to blink an LED. This program blinks the Roomba Power and Status LEDs between the colors green and red.

Blink Roomba LED Green, Turn on Arduino LED (noted by yellow arrow and circle)
Blink Roomba LED Green, Turn on Arduino LED (noted by yellow arrow and circle)
Blink Red
Blink Red

Here is a link to the full code:

2015-05-29 10_18_15-Roomba_blink _ Arduino 1.6.4

2015-05-29 10_18_57-Roomba_blink2 _ Arduino 1.6.4

Blink Roomba LED – How does it work?

The Roomba SCI describes how to control the Roomba LEDs on page 4. When the Roomba computer receives the command opcode 139 over its serial connection, it expects 3 more bytes of data. These describe what LEDs to turn on, the color (the Roomba uses Tri-Color LEDs) and the intensity (The Roomba can brighten or dim the LED intensity).

The Arduino sends the following command sequence to the Roomba through the serial connection:

[128] enable the SCI

pause for 100 milliseconds

[130] enable user control of the Roomba

pause for 100 milliseconds

[132] enable unrestricted control and turn off safety features

pause for 100 milliseconds

[139] [32] [0] [255] illuminate status and power LEDs green at full intensity

pause for 2000 milliseconds

[139] [16] [255] [255] illuminate status and power LEDs red at full intensity

pause for 1000 milliseconds

repeat the last two commands and pauses


This post described how to transform an Arduino Uno and a used Roomba with a bad battery into a functional experimental robot development platform. The first program woke up the Roomba by sending an active low pulse to the device detect pin. The second program flashed the Roomba power and status LEDs green and red. The second program verified proper communication between the Arduino and Roomba.


Once Roomba Blink is successfully completed, try out these challenges and take these concepts to the next level!

1. Blink the Roomba power LED blink red, orange then green with the status always light off. Answer Link.

2. Write a new program that slowly changes the power led color from green [0] through red [255]. Answer Link.

3. Play a song! Follow this link for a sketch that will have your Roomba play the Star Wars theme song for the Imperial Army.

Part 3 – PcDuino and Scratch – the Details

This post explores the PcDuino Hardware Code Block Collection and interface differences to the Arduino.

Scratch for PcDuino adds a Hardware Code Block Collection, shown below. The image is taken from a LinkSprite document titled, Port Scratch to pcDuino with Hardware Support.

2015-01-04 16_14_59-https___s3.amazonaws.com_pcduino_book_scratch_pcduino.pdf

The first code block sets a particular pin of the PcDuino to an Input or Output. Clicking on the pin number field opens a window which offers a choice of pins 0 to 23. The image below describes more details about the Scratch PcDuino interface.

2015-01-04 16_15_36-https___s3.amazonaws.com_pcduino_book_scratch_pcduino.pdf

The Arduino has 14 Digital Input/Outputs and 6 Analog Input/Outputs. These are shown in the image below, highlighted in yellow. Yellow highlighting added
note: yellow highlighting added

The PcDuino Linker Shield appears to have the same configuration of pins, as shown in the image below. The Analog and Digital Inputs and Outputs are highlighted in yellow. Note that they are the same as the Arduino.

2015-01-04 17_14_54-Base Shield - LinkSprite Playgound

Testing the Digital I/O pins with scratch and a multimeter, pins 0 thru 13 were measured to be 3.3 Volts when set to a HIGH level. So where are the extra GPIO pins 14 through 23?

These are located on the main board of the PCDuino, as shown in the image below. They do not appear to be able to be accessed using the Linker Shield.

Here is the link to more information on and a good article on

pcduino_lite_wifi_GPIO (1)

The 3.3 Volt measurement was a surprise, as I thought the PcDuino was the same as the Arduino, which outputs 5 Volts. Stay tuned for a post that will contain a detailed comparision of the differences between the Arduinio and PcDuino interfaces.

Part 2 – PcDuino3 Scratch – Hello World!

Getting started with LEDs and switches are both easy and fun. Refer to the following link for a free book that describes how to get started with these modules.

2015-01-04 15_56_26-https___s3.amazonaws.com_pcduino_book_CPK_pcDuino3.pdf

18 Projects with CuteDigi Project Kit for pcDuino3

Project 1 describes how to get the LED modules to light up using Scratch. Project 2 adds the switch as an LED control method.

2015-01-04 15_55_47-https___s3.amazonaws.com_pcduino_book_CPK_pcDuino3.pdf

Shown below is an inventory of the LinkSprite components installed per the previous post. Click on the module name, below, to go the appropriate LinkSprite wiki page.

Linker Base Shield

Linker Cable

5mm Yellow LED

5mm Green LED

Touch Sensor Module

Linker Button Module

Linker modules are easy to use and make experimenting with Scratch hardware interfaces available to almost anyone.

PcDuino3 and MIT Scratch

PcDuino is a powerful single board computer that leverages the very popular Arduino shields. I’ve had an Arduino for a few years and really not done much with it other than making a light blink on and off.

During the 2013 Denver Mini Maker Faire last summer, I saw the PcDuino running Scratch and my imagination was energized. Scratch is a programming language for ages 8-16, and there is a custom version on the PcDuino that utilizes the unique analog and digital interfaces not found on a PC. Here’s a really cool example of a Scratch music video: Link

Scratch Party Anthem
Scratch Party Anthem

The inspiration was to re-purpose a kids toy to be a fun Scratch interface. The local second hand store had a toys that looks like promising candidates, so I brought a few home. Next, I ordered a PcDuino3, Linker Shield and some Linker Modules from CuteDigi and LinkSprite. They have an excellent selection of all kinds of Linker modules and accessories.

Some of the modules I picked up are a tilt sensor, light sensor, lights, touch sensor and a temperature sensor. These can be interfaced with Scratch to make these sensors controls for a video game or other program.

The first toy I took apart was a Jensen DJ Scratch toy. It looks like the kind of record player that a DJ would use as an instrument during a musical performance. When I tried to power up the toy, nothing worked. After opening up the case, it was revealed that some of the circuits were fried. Fortunately, the circuit that the record scratch wheel attached to was still functional.

Jensen DJ Scratch Mixer Prior to Hacking
Jensen DJ Scratch Mixer Prior to Hacking
After Hacking

During development, I connected the wheel circuit to the PcDuino using an Adafruit Protoshield that was already in my workshop. This is an example of how the PcDuino can be used with shields that many people may already have lying around. My first experiences were pretty amusing. When I started up Scratch, the numbers the switches were connected to were counting up like crazy! I didn’t know that pull up or pull down resistors are needed when interfacing switches to a computer.


Once I used the pull up resistor, I was able to make a simple Scratch music game. When the wheel rotates, it actuates 3 switches at different times. Unfortunately, when the wheel stops, one switch is usually in a closed condition. In order for the interface to work, I’ll need to figure out how to fix this problem. There is a one-shot circuit that can be added or a custom Scratch module can be crafted in software.

With the fried circuit board removed, there were lots of open holes on the front panel. The Linker modules were easy to mount using some bailing wire. They covered up the open holes and provided a cool new functionality.

Stay tuned for more updates on this fun project. Let me know if you have any suggestions or comments!

There is a competition at CuteDigi until the end of January 2015, check it out! 

DJ Flip explains the taxonomy of scratches in this video: Link

I Can Still See the X

On November 20th, 2012, I was able to observe the Werner X from my back porch using my 4″ Vixen APO named Dionysus.

It was neat to see this lunar trick of the light. I was surprised it was so easy to find. I just set up the scope on a very windy porch and BAM! There it was! I used my  Vixen Zoom eyepiece and a lunar filter. Shown below is a snapshot of the X which I took with my iPhone.

Werner X, Nov 20, 2012
Observing from a windy back porch

The X definitely got me excited about observing the moon again. I’ve been meaning to work on the Astronomical League’s Lunar 100, but the Herschel’s have been occupying most of my observing energies. But now that I’ve observed the X, my next goal will be to catch some lunar rays.

When observing Lunar X’s, I like to listen to Dan Of Earth’s album “I Can Still See the X”. It’s a good soundtrack for backyard observing!

Location of Werner X, image from the Moon Atlas iOS app by Horsham Online Ltd

Getting Started in Sidewalk Astronomy Part 2

At long last is Part 2 of Getting Started in Sidewalk Astronomy! (Here’s Part 1 in case you missed it)

Click here to listen to the interview in MixCloud

It’s an audio interview with Jeff Setzer, who is currently the President of the Northern Cross Science Foundation (NCSF). The NCSF is my hometown astronomy club in Southeastern Wisconsin, which is in the northern midwest of the United States. The NCSF is a club that has a solid core of public outreach with many sidewalk astronomy events and public viewing nights.

In this interview we discuss how and why the NCSF set up a regular sidewalk astronomy event at the mall. In addition, we discuss the part that social media and dark sky advocacy plays.

Jeff Setzer with his 22″ Starmaster Telescope

This interview was recorded on July 12, 2012 and is licensed under the Creative Commons Attribution ShareAlike 3.0 unported licence.

The night sky full of stars is an amazing and inspiring sight. The pattern seeking human mind sees the outlines of familiar images. When I was growing up, our constellations included the Screwdriver, Allen Wrench and the Giraffe.
Here are two cool star maps which were show the constellations of the Ancient Greek and Chinese cultures. It’s an interesting juxtaposition to compare these two maps with our own modern notions.