Robot App Store Developer Program

robots-app-store-developer-program

Knowledge Base

Serial port connection and configuration

  By Anna Sandler

iRobot has developed a Serial port Command Interface (SCI) – an API for communication with Roomba.
The interface is bidirectional, and is being sent through Roomba’s serial port which is located here.

There are two ways to connect your program/app with Roomba:
  • Using a Bluetooth device (recommended)- like RooTooth the price is ~100$.
  • Or using "USB to serial" cable like this the price is ~30$.
RooTooth
RooTooth, a bluetooth device for Roomba
USB to Serial Port Cable
USB to serial port cable

Finding the right connection speed

Baud rate is the number of bits per second that are being transmitted.
Roomba's default baud rate vary by the version of your Roomba:
  • Create, Roomba 4XX series and Dirt dog are using 57,600 baud rate by default.
  • Roomba 5XX and 7XX series are using 115,200 baud rate by default.

Connecting with Serial-to-USB cable

If you choose the USB to serial cable, be aware that you are limited to a computer based programs (smart phones can’t accept USB cables (yet)), and the cable limits Roomba movement.
In order to start using the serial cable, please install the drivers from the installation disc that came with your cable.
Whether you use code (.NET or Java or C++) or a terminal software to send commands, make sure you initialize the serial port object, or configure the terminal with the correct baud rate according to your Roomba model as mentioned above.
That's it! We are ready to send some commands!
Skip to: "How to send commands to Roomba" chapter

Connecting with Bluetooth

How to pair Roomba with Bluetooth device to smartphone or computer

If you've decided to go with the recommended Bluetooth-based option, all you need to do is to turn on Bluetooth< on your smartphone or computer, and pair the Bluetooth device with the it.
Note that some of the computers don't have Bluetooth support (usually desktops). In this case, you can use a Bluetooth dongle.
and voile’ your computer now supports Bluetooth connections.

After you've enabled Bluetooth on the computer that is going to run the program/app, just pair the device with your computer.
If you use a PC, open Bluetooth devices -> add a device -> select the Bluetooth device -> enter the pin code (typically 1234), and you are paired!

Why the configuration of a baud rate is ignored

If you are using a Bluetooth device, things are a bit more complicated than with a cable.
There are two transmission zones:
  • First zone: (Computer to Bluetooth) - from a computer/smartphone to the Bluetooth device,
  • Second zone: (Bluetooth to Roomba) - from a Bluetooth device to the Roomba.
The baud rate of the first zone (Computer-Bluetooth) is set automatically during the pairing process between your computer/smartphone and the Bluetooth device;
The second zone- between the Bluetooth device and a Roomba must be configured.
Note that the Bluetooth device is a virtual serial-port, and the baud rate between the computer and the Bluetooth device (the first zone) is being selected during the handshake with the computer.
Thus the value that is specified as a baud rate in the terminal software’s connection window, or from the serial port initialization in your code, is ignored. (The Bluetooth driver is handling the connection speed for us, we only need to configure the second zone), so just make sure your device is connected and you are using the right port to send these commands.

How to configure a Bluetooth device to support the correct Roomba's baud rate

The baud rates on the sender and receiver must be identical.
In case the baud rates are not aligned between your Bluetooth device and your Roomba model, (the second zone) you will need to change the defaults on your Bluetooth device to match the baud rate of your Roomba.

Some of the RooTooth devices are configured with 57,600 baud rate as a default, while others are using the 115,200 default baud rate.
If you are not sure about the default baud rate of your Bluetooth device, you can check it by sending the following commands to your Bluetooth device using terminal software like RealTerm, or using a code to send those commands.
(Press the "Enter" at the end of each command if you are using a terminal, or add the '\n' character if you are using a code).
  • $$$
  • D
  • ---
RooTooth Configuration Status
RooTooth configuration status
Explanation:
  • [$$$] command is used to enter the configuration mode of your Bluetooth device;
  • [D] command is used to DISPLAY Bluetooth device's settings;
  • [---] command is used to exit Bluetooth device's configuration mode;
Baud rate values can be (Baudrt):
9,600, 57.6 for 57600 baud rate or 115K for 115,200 baud rate.

By default there is a 60-seconds configuration timeout after which no changes are allowed.
The following commands will remove the timeout (change the timeout to be infinite):
  • $$$
  • ST,255
  • ---
After changing the timeout, Rootooth is ready for the baud rate changes.

In order to change the baud rate permanently (for zone 2), send the following commands:
(Press the "Enter" at the end of each command if you are using a terminal, or add the '\n' character if you are using a code).
  • $$$
  • SU,[baud rate]
  • R,1
Explanation:
  • [$$$] command is used to enter the configuration mode of your Bluetooth device;
  • [SU,57.6] for Roomba 4XX, Create and Dirt dog
    or [SU, 115k] for Roomba 5XX or 7XX models.
    This command will permanently change the baud rate value in the Bluetooth device's settings.
  • [R,1] command is used to restart the device in order for the changes to take affect;
In order to change a baud rate temporarily, send the following commands:
(Press the "Enter" at the end of each command if you are using a terminal, or add the '\n' character if you are using a code).
  • $$$
  • U,[baud rate],N
Explanation:
  • [$$$] command is used to enter the configuration mode of your Bluetooth device;
  • [U,57.6,N] for Roomba 4XX, Create or Dirt dog,
    [U,115k,N] for Roomba 5XX or 7XX models.
    This command will change the baud rate and exit the command mode, but will not change the baud rate saved on the flash memory (you won't be able to see the new values when you use the command [D])
    On next Bluetooth device restart, the value will be changed again to its previous value.

When changing Bluetooth device configuration from code (.NET/Java..), a delay of at least 100 milliseconds must pass between commands (not including the New Line character that is added to the end of each command ['\n']). The delay is relevant for all commands except the first command [$$$].

What's next?

Let's move forward and learn how to send commands to Roomba








Related Robot-Apps™

Comments