Page 102 - Hacking Roomba
P. 102
Chapter 4 — Building a Roomba Bluetooth Interface 83
The BlueSMiRF has many other AT commands besides the two shown here. It is a fairly capable
device, suitable for many tasks. To see some of the other commands, download the BlueSMiRF
datasheet at www.sparkfun.com/datasheets/RF/BlueSMiRF_v1.pdf or send an
e-mail to SparkFun asking for the complete command set.
Testing Bluetooth
All the tests performed for the RS-232 serial adapter should be done with the Bluetooth
adapter, too. Here’s why: It enables you to get a feel for how the Bluetooth adapter responds
compared to the serial cable. Because Bluetooth is a wireless protocol, it can suffer from inter-
ference, dropouts, and signal strength issues like any other wireless protocol. This is reflected in
various pauses in data transfer between the computer and the Bluetooth device. Normally it’s
not really an issue, but it is something to be aware of.
The most noticeable difference between using a cable and using Bluetooth to control the
Roomba is the initial connect time can be longer if the computer has to re-connect and
re-pair with the BlueSMiRF. It can be several seconds if the Bluetooth adapter has been idle
or turned off.
While you’re doing echo tests, it is a good idea to walk around while typing, get a feel for the
range you can achieve. Since the BlueSMiRF is a Class 1 Bluetooth device, it theoretically has
a range of about 100 meters (about 300 feet). Imagine controlling your Roomba from down the
street.
If your connection tests repeatedly fail, go back to the serial tether and verify that it still works. If
everything seems like it should work but you still cannot connect, try a different computer.
Using the Adapter
With the adapter fully tested with your computer, you can run RoombaCommTest or any of
the other tests from the previous chapter, and they should work exactly the same. The beauty
of the Bluetooth serial adapter is that it appears just like a serial port to your operating system.
All software that can use RS-232 serial ports can also use these Bluetooth serial ports.
There is one caveat for Windows. In the RoombaComm software you’ll find an option
called hwhandshake that should be used when connecting over Bluetooth. This only
applies to Windows and is used to get around an odd interaction between the serial library
RoombaComm uses and the operating system. This will probably eventually be fixed. After
you download RoombaComm, read the release notes to see if the hwhandshake situation has
changed. The hwhandshake option is discussed further in the section “RXTX Serial Port
Library.”