One of the devices I’m most excited about lately is the MaxStream XBee. The problem with this seemingly innocuous little device is that it wouldn’t behave the way any other tutorial I found said it would. I’ve been working through three different sources of information on the XBee. The first was the source was the always helpful Arduino Forum. Then there’s the excellent article on the Arduino Playground by M. Yarza — though this would have been more helpful initially had I spotted the next page links at the bottom of each page. The third resource is this fantastic book put out by O’Reilly called Making Things Talk. (I’d hazard to think that most people getting involved with the Arduino and XBee will be coming into it from this book and Make magazine)
The first issue I had was working out how to configure the XBee module. The Arduino serial interface doesn’t appear to like to send characters as they’re typed, and requires a line break before it executes. This proves to be an issue with the Command Mode in the XBee. The workaround is to move into a terminal application that does support direct TTY. On a Windows machine PuTTY should do the trick, or Screen on the Mac OS. I’m using a Mac, but the PC should be a matter of pointing the terminal at the COM port associated with the USB-Serial adaptor that you’re using. On a Mac you’d point this at /dev/tty.usbserial[identifier].
The Arduino can act as a USB-Serial adapter if you like. Just remove the ATMega168 chip and communicate directly through the TX/RX ports.
To execute Screen type:
screen /dev/tty.usbserial-A4001uBD 9600
Replace the usbserial name with the one that is present on your system. The name should only appear when the USB device is plugged in, otherwise you won’t see anything. The connection speed of 9600 baud is the default connection speed of the XBee radio. If you’ve altered this, call your new baud rate here.
Once you’re in type in:
This enters command mode. Here you can get or set the XBee parameters:
ATID1234 sets the ID for the XBee to
1234. It should return nothing.
ATID will now return
ATWR writes these values to the XBee.
ATCN exits command mode if it hasn’t automatically done so by timeout (~10s).
The configuration options go on from there, and they get increasingly complex.
Hopefully that helps others in a simillar situation I found myself in. Soon I’ll post a follow up detailing my setup.