Introduction: Inspector Roomba
Most of us use iRobot Roomba robots only for vacuuming, but few know that it is a great base for a new robotic projects. All makers should try the Roomba Open Interface (OI) to find out how easy it is to control this robot. In this instruction you will learn how to add some useful features to your Roomba. At the beginning I will describe how to remote control of Roomba via bluetooth and Android app. Later I will show you how to run video streaming based on the RPi and finally I outline the plan for further development of this project.
Parts needed in this project:
- BTM-222 bluetooth module or other working at 115200 baud rate x1
- 5V Step-Down Voltage Regulator D24V6F5 x1
- mini breadboard x1
- A few wires
version with casing:
- 8 pin mini DIN connector x1
- power switch x1
- led 3 mm x1
- resistor 10k x1
- small casing 50x40x20 mm x1
Step 1: Connection of Electronic Parts
This time, this step is very simple because we only need to connect two modules to be able to control our Roomba. The first is a Bluetooth module that can operate at 115200 bps. The second is 5V Step-Down Voltage Regulator D24V6F5. Charged Roomba battery has a voltage of about 14.4V and our bluetooth module need 5V so we need to reduce battery voltage to the level of 5V using voltage regulator. The D24V6F5 regulator has efficiency between 80 and 90% that is very good value compared to classic linear regulators that typically have an efficiency below 40%. The easiest way to connect these two modules is putting them in mini breadboard and wiring according to the wiring diagram as above. In addition, all connections are shown in numbered photos. Be careful when connecting to the battery terminals. Accidental short circuit may damage the battery!
Step 2: Using the Android Control App
I've developed an Android app that allows you to control Roomba 500 series robotic vacuum via bluetooth. You can download my app for free from Google Play - Roomb Control. It works with both smartphones and tablets.
How to use Roomb Control App:
- tap the upper right corner of the screen (3 vertical dots)
- select the tab "Connect"
- tap on the "BTM222" tab and after a while you should see the message "Connected to BTM222"
- after connecting, you can control your Roomba
- if you don't see your bluetooth device tap "Scan for devices" button
- on the first use of your bluetooth module please remember to pair it with your smartphone by entering the default code given in bluetooth module specification
Step 3: Roomba Open Interface in Examples
In this step you will find examples of common commands used to control the Roomba series 500. You can find more information about Roomba Open Interface in this document.
Roomba 500+ can operate in one of four modes:
- Full mode gives you complete control over Roomba (no safety restriction as it is for Safe and Passive mode)
- Safe mode introduces some safety-related exceptions when you can not control all the actuators:
- detection of a wheel drop
- detection of a cliff while moving forward or backward
- charger plugged in and powered
A secure and fully functional operation mode is Safe mode that is the preferred mode for remote control. To run safe mode firstly we need to send command 128 that starts the Open Interface and then command 130 (or 131) to put Roomba into Safe mode. If we want to run one of the built-in cleaning modes (clean, spot, dock, etc.) we should send the third command with appropriate code (Clean-135, Spot-134, Dock-143). The full serial sequence for these modes are as follows:
- Set Safe Mode - (128, 130)
- Spot - (128, 130, 134)
- Clean - (128, 130, 135)
- Dock - (128, 130, 143)
If the Roomba is in the Safe mode we can control Roomba's drive wheels using command 137. The full 5 bytes serial sequence is as follows: (137, Velocity high byte, Velocity low byte, Radius high byte, Radius low byte). Examples of the serial sequences for Roomba motion control:
- Go Forward - (137, 100, 0, 128, 0)
- Go Back - (137, 254, 12, 128, 0)
- Turn Right - (137, 100, 0, 255, 255)
- Turn Left - (137, 100, 0, 0, 1)
Alternatively to control robot motion we can use command 146. This command let us control PWM (Pulse-Width Modulation) for the right and left wheel: (146, Right PWM high byte, Right PWM low byte, Left PWM high byte, Left PWM low byte). Example of PWM control:
- Move Top Right - (146, 0, 130, 0, 255)
- Move Top Left - (146, 0, 255, 0, 130)
The command 139 control the LEDs colors. We can change the Clean/Power LED color by setting the the value of Color byte in serial sequence: (139, LED Bits, Color, Intensity). If Color byte is set to 0 we get green color. By increasing this value we get intermediate colors (orange, yellow, etc) and red color for the maximum value 255. Examples of LED's control:
- green - (139, 0, 0, 128)
- orange - (139, 0, 128, 128)
- red - (139, 0, 255, 128)
The last command that I would like to mention is the command 140 that allows you to play simple songs. Examples of the serial sequences for playing songs:
- song 1 - (140, 0, 5, 72, 32, 74, 32, 76, 32, 77, 32, 79, 32, 141, 0)
- song 2 - (140, 1, 5, 69, 16, 71, 16, 72, 16, 74, 16, 76, 16, 141, 1)
Step 4: RPi Remote Webcam
To be able to view video streaming from the camera on any devices connected to my local network (PC, smartphone, tablet, etc) I have installed Motion webcam serwer. You can find details of how to do this in this Instructable. The main steps are as follows:
- Edit: sudo nano /etc/modules - add at the end of the file: bcm2835-v4l2
- Install Motion: sudo apt-get install motion
- Open motion.conf file by typing: sudo nano /etc/motion/motion.conf and set video parameters (e.g.: daemon on, width 640, height 480, framerate 30, webcam_localhost off)
- Enable the Daemon (service): sudo nano /etc/default/motion and find and change start_motion_daemon=yes.
- Start service: sudo service motion start or sudo motion -n -c /etc/motion/motion.conf
- Now open web browser on your computer or smartphone and type: RPi IP:8081 (where "RPi IP" is IP of your Raspberry Pi and 8081 is the default port). Example: 192.168.1.14:8081. If everything works well after a while you should see the view from your camera in your web browser.
Step 5: Plans for Further Development
Currently my Roomba is equipped with a small robotic arm described in this instruction. This robotic arm can be remotely controlled via bluetooth from the Android app. In the next step I'm going to use view from camera for remote gripping and moving objects to the marked space (operation in the semi-autonomous mode).
If you would like to see my other projects related to robotics please visit:
Step 6: Connection of Electronic Parts - Version 2 With Casing
If you would like to build your own removable receiver to control the Roomba this extra step is for you. We add a few more elements and will close them all in a slim casing. The main component which we will need in this step is a 8 pin mini DIN connector. In addition, we will need the power switch and indicator based on LED and resistor 10k.
Now you don't have to worry about sticking out wires. The bluetooth receiver is closed in a small housing with dimensions of 50x40x20 mm. When you don't want to use it then you can easily remove it from your Roomba pulling the mini DIN plug.
We have a be nice policy.
Please be positive and constructive.