Irobot ROOMBA User Manual

iRobot
®
Roomba
®
Serial Command Interface (SCI) Specification
www.irobot.com
© 2005 iRobot Corporation. All rights reserved. iRobot and Roomba are registered trademarks of iRobot Corporation.
iRobot® Roomba® Serial Command Interface (SCI) Specification
SCI Overview
Versions of iRobot® Roomba® Vacuuming Robot manufactured after October, 2005 contain an electronic and software interface that allows you to control or modify Roomba’s behavior and remotely monitor its sensors. This interface is called the iRobot Roomba Serial Command Interface or Roomba SCI.
Roomba SCI is a serial protocol that allows users to control a Roomba through its external serial port (Mini-DIN connector). The SCI includes commands to control all of Roomba’s actuators (motors, LEDs, and speaker) and also to request sensor data from all of Roomba’s sensors. Using the SCI, users can add functionality to the normal Roomba behavior or they can create completely new operating instructions for Roomba.
Physical Connections
To use the SCI, a processor capable of generating serial commands such as a PC or a microcontroller must be connected to the external Mini-DIN connector on Roomba. The Mini-DIN connector provides two way serial communication at TTL Levels as well as a Device Detect input line that can be used to wake Roomba from sleep. The connector also provides an unregulated direct connection to Roomba’s batter y which users can use to power their SCI applications. The connector is located in the rear right side of Roomba beneath a snap-away plastic guard.
ROOMBA’S EXTERNAL SERIAL PORT MINI-DIN CONNECTOR PINOUT
This diagram shows the pin-out of the top view of the female connector in Roomba. Note that pins 5, 6, and 7 are towards the outside circumference of Roomba.
6
Serial Port Settings
Baud: 57600 or 19200 (see below) Data bits: 8 Parity: None Stop bits: 1 Flow control: None
By default, Roomba communicates at 57600 baud. If you are using a microcontroller that does not support 57600 baud, there are two ways to force Roomba to switch to 19200:
METHOD 1:
When manually powering on Roomba, hold down the power button. After 5 seconds, Roomba will start beeping. After 10 seconds, Roomba will play a tune of descending pitches. Roomba will now communicate at 19200 baud until the battery is removed and reinserted (or the battery voltage falls below the minimum required for processor operation) or the baud rate is explicitly changed via the SCI.
METHOD 2:
You can use the Device Detect to change Roomba’s baud rate. After you have awakened Roomba (using Device Detect or by some other method) wait 2 seconds and then pulse the Device Detect low three times. Each pulse should last between 50 and 500 milliseconds. Roomba will now communicate at 19200 baud until the battery is removed and reinserted (or the battery voltage falls below the minimum required for processor operation) or the baud rate is explicitly changed via the SCI.
Here is a Python code fragment that illustrates this method (Device Detect is connected to the PC’s RTS line via a level shifter):
ser = serial.Serial(0, baudrate=19200, timeout=0.1)
7
4
2
Pin Name Description
1 Vpwr Roomba battery + (unregulated)
2 Vpwr Roomba battery + (unregulated)
3 RXD 0 – 5V Serial input to Roomba
4 TXD 0 – 5V Serial output from Roomba
5 DD Device Detect input (active low) – used to wake up
Roomba from sleep
6 GND Roomba battery ground
7 GND Roomba battery ground
The RXD, TXD, and Device Detect pins use 0 – 5V logic, so a level shifter such as a MAX232 chip will be needed to communicate with a Roomba from a PC, which uses rs232 levels.
5
3
1
ser.open()
# wake up robot ser.setRTS (0) time.sleep (0.1) ser.setRTS (1) time.sleep (2)
# pulse device-detect three times for i in range (3): ser.setRTS (0) time.sleep (0.25) ser.setRTS (1) time.sleep (0.25)
www.irobot.com
iRobot® Roomba® Serial Command Interface (SCI) Specification
SCI Modes
The Roomba SCI has four operating modes: off, passive, safe, and full. On a battery change or other loss of power, the SCI will be turned off. When it is off, the SCI will listen at the default baud bps for an SCI Start command. Once it receives the Start command, the SCI will be enabled in passive mode. In passive mode, users can do the following:
• Request and receive sensor data using the Sensors command
• Execute virtual button pushes to start and stop cleaning cycles (Power, Spot, Clean, and Max commands)
• Define a song (but not play one)
• Set force-seeking-dock mode
Users cannot control any of Roomba’s actuators when in passive mode, but Roomba will continue to behave normally, including performing cleaning cycles, charging, etc. When in passive mode, users can then send the Control command to put the robot into safe mode.
In safe mode, the users have full control of the robot, except for the following safety-related conditions:
• Detection of a cliff while moving forward (or moving backward with a small turning radius)
• Detection of wheel drop (on any wheel)
• Charger plugged in and powered
When one of the conditions listed above occurs, the robot stops all motors and reverts to passive mode.
For complete control of the robot, users must send the Full command while in safe mode to put the SCI into full mode. Full mode shuts off the cliff and wheel-drop safety features. (The robot will still not run with a powered charger plugged in.) This mode gives users unrestricted control of the robot’s actuators. To put the SCI back into safe mode, users can send the Safe command.
If no commands are sent to the SCI when it is in safe or full mode, Roomba will wait with all motors off and will not respond to button presses or other sensor input.
To go back to passive mode from safe or full mode, users can send any one of the four virtual button commands (Power, Spot, Clean, or Max). These button commands are equivalent to the corresponding button press in normal Roomba behavior. For instance, the Spot command will start a spot cleaning cycle.
Allow 20 milliseconds between sending commands that change the SCI mode.
Roomba SCI Commands
Listed below are the commands that users send to the SCI over to the serial port in order to control Roomba. Each command is specified by a one-byte opcode. Some commands must also be followed by data bytes. The meaning of the data bytes for each command are specified with the commands below. The serial byte sequence for each command is also shown with each separate byte enclosed in brackets. Roomba will not respond to any SCI commands when it is asleep. Users can wake up Roomba by setting the state of the Device Detect pin low for 500ms. The Device Detect line is on Roomba external Mini-DIN connector.
Start Command opcode: 128 Number of data bytes: 0
Starts the SCI. The Start command must be sent before any other SCI commands. This command puts the SCI in passive mode.
Serial sequence: [128]
Baud Command opcode: 129 Number of data bytes: 1
Sets the baud rate in bits per second (bps) at which SCI commands and data are sent according to the baud code sent in the data byte. The default baud rate at power up is 57600 bps. (See Serial Port Settings, above.) Once the baud rate is changed, it will persist until Roomba is power cycled by removing the battery (or until the battery voltage falls below the minimum required for processor operation). You must wait 100ms after sending this command before sending additional commands at the new baud rate. The SCI must be in passive, safe, or full mode to accept this command. This command puts the SCI in passive mode.
Serial sequence: [129] [Baud Code]
Baud data byte 1: Baud Code (0 – 11)
Baud code Baud rate in bps
0 300
1 600
2 1200
3 2400
4 4800
5 9600
6 14400
7 19200
8 28800
9 38400
10 57600
11 115200
Control Command opcode: 130 Number of data bytes: 0
Enables user control of Roomba. This command must be sent after the start command and before any control commands are sent to the SCI. The SCI must be in passive mode to accept this command. This command puts the SCI in safe mode.
Serial sequence: [130]
www.irobot.com
Loading...
+ 7 hidden pages