Each XBee radio has a tiny computer on board. This internal microcontroller runs a program, also known as firmware, that performs all its addressing, communication, security, and utility functions. You can configure this firmware with different settings that define things like its local address, which type of security is enforced, who it should send messages to, and how it should read sensors connected to its local input pins.
To change or upgrade the firmware, we will use a program called X-CTU that you can download from the Digi website. On the upside, this program is totally free. On the downside, it runs only on Windows. Don’t worry if you have limited access to Windows, though. Chances are you’ll only need X-CTU initially, to load the proper firmware onto your XBee radio. Going forward, you can use serial terminal programs on Macintosh, Linux, or Windows to change many of the settings you’ll be working with on a day-to-day basis. Let’s take a look at some of these programs and how they operate.
There is only one option for updating the low-level firmware on XBee radios: Digi’s configuration tool, which is available for free.
The X-CTU program is the official configuration program for XBee radios. As noted, X-CTU is available only for the Microsoft Windows operating system. If you have access to a native Windows computer, a Macintosh running Windows under Boot Camp or Parallels, or a Linux computer running the WINE Windows emulator (see X-CTU in Linux in Chapter 2), you’re all set. Luckily X-CTU is required only for updating firmware, which is a relatively infrequent task. It does have a number of other handy features, though, including fully commented setup commands, range tests, and easier access to the API features we’ll be examining in Chapter 5.
To use X-CTU, plug your XBee radio into a USB adapter and plug that adapter into one of your computer’s USB ports. Next, launch the X-CTU program. It should show your USB connection as one of the available ports, similar to what you see in Figure 1-13. Select the appropriate port and then click on the Modem Configuration tab to get to a basic configuration screen (Figure 1-14). Clicking on the Read button will generally access the radio’s setup, though this depends upon which firmware is currently loaded. Don’t be concerned if you get an error message instead. We’ll go over the details in the next chapter.
Once you’ve loaded the firmware, you may want to use a different program to communicate with your XBee. It’s very helpful to have some familiarity with one or more serial terminals because you may not always have access to X-CTU when you need it. At a friend’s house, a hacking workshop, a public demo, or in the midst of a Maker Faire, you might need to check something or change a setting on a non-Windows computer. Or you may run into a Windows machine where you don’t have the rights to download and install new software. Here’s a host of different options that can save you in such cases. We’ll talk about how to set them up and use them in the next chapter.
CoolTerm is a terrific open source serial terminal program created by Roger Meier that runs well on both Windows and Macintosh. It’s a relatively simple program that’s perfect for most basic tasks you need to perform with XBee radios. CoolTerm is free. Consider making a small donation to show your appreciation and encourage continued support for the program (http://freeware.the-meiers.org).
Windows XP and older Windows versions come with a serial terminal program called HyperTerminal. If you are using Windows Vista or Windows 7, HyperTerminal may still be available as a free demo, or for purchase from http://www.hilgraeve.com/hyperterminal.html.
Tera Term is a free, open source Windows program that performs a wide variety of terminal functions, including acting as a serial terminal. Those using Vista or Windows 7 will appreciate having a free option, since HyperTerminal is no longer bundled with Windows and must be purchased separately. This is the Windows software we’ll use to demonstrate serial terminal use (http://ttssh2.sourceforge.jp/).
An old favorite terminal program on the Macintosh, ZTerm has been showing its age for quite some time. It was designed in 1992 and was last updated in 2002. Still, it is widely used and despite its anachronistic features and idiosyncratic design, it’s been stable for almost 20 years. You’ll find some brief setup documentation on my blog, and you can download ZTerm and pay its small shareware fee online (http://homepage.mac.com/dalverson/zterm/).
For Linux users and for those comfortable in the Macintosh
Terminal, there’s a command-line program named
screen that allows direct access to serial
ports, including USB devices. On Mac OS X, the command
ls dev/tty.* will list the available
ports, returning a list like this:
/dev/tty.Bluetooth-Modem /dev/tty.Bluetooth-PDA-Sync /dev/tty.usb-A410032.
On Linux, try
dev/ttyUSB*. Your serial port will probably be something
Once you know what your USB port is called, you can invoke the
screen program, using the port
and a data rate of 9600 baud. For example:
screen /dev/tty.usb-A410032 9600
To exit, type Ctrl-A followed by Ctrl-\ and then
y to quit.
The picocom program, described in the sidebar A Serial Terminal Program for Linux in Chapter 2, is an alternative to
screen and has certain features (such as
local echo) that can be useful for working with XBees.