Programmable XBee Radios

When starting out on this space balloon project, I did a lot of research with a colleague and good friend of mine with similar interests. We came to the conclusion that Digi XBee radios were the way to go for OTH communication. And so, we purchased our Digi XBee radios.

What I didn’t anticipate was the nightmare of horrors into which I was descending.

I needed a distributor, and so DigiKey (absolutely nothing to do with Digi International) seemed the logical choice; they had loads of stock, many options for purchase, and their delivery is second to none (free with purchases over $100, and delivery time of about 1-2 business days).

While going through DigiKey’s inventory, I encountered many options. XBee Pro 900HP or XSC? 10K or 200K model? Programmable or non-programmable? U.fl or wire or SMA antenna?

Logically, the “best” choice would be a combination of the best options, right? XBee Pro 900HP (since it was a later model than the XSC), 200k transfer rate (beats 10k), programmable (obviously better than non-programmable), and U.fl antennae since I already had the hardware.

The single biggest mistake I’ve made in this radio transceiver endeavour is not a lack of understanding of the product, but rather the inability to disseminate seemingly endless options, many conflicting, from numerous outdated sources, that don’t appear outdated until you “get right into it”.

So here I was, about $120 bucks and 2 days (thanks, awesome DigiKey shipping!) later, staring at these two tiny little blue devices that promised to get Captain Polaris home safely after a launch.

Since making my purchase of two XBee Pro 900HP programmable radio transceivers, I’ve learned some valuable lessons:

  1. “Programmable” in the XBee sense means, from the manual (emphasis mine):

    The modules with the programmable option have a secondary processor with 32k of flash and 2k of RAM. This allows module integrators to put custom code on the XBee module to fit their own unique needs. The DIN, DOUT, RTS, CTS, and RESET lines are intercepted by the secondary processor to allow it to be in control of the data transmitted and received.

    This means that there is no way for an external UART (or serial) device to communicate through your XBee without you doing something about it yourself.

  2. Doing something involves a slew of extra tasks:
    1. Be using a Windows OS. If you’re not, download and install VirtualBox, a Windows VM, and all associated USB FTDI drivers. And anything else that might be incidental.
    2. Install an old copy of XCTU which enables you to upload content to the XBees via ZMODEM protocol.
    3. Install CodeWarrior and the XBee SDK, and compile one of the provided examples so you can bypass the Ember processor.
    4. Compile and upload your custom bypass bootloader (called serial_bypass in CodeWarrior) using really old-school means.
    5. Be comfortable with all the above steps. Be forewarned: hic sunt dracones.
  3. Don’t rely on forum posts to get anywhere. These are volunteers who have hemorrhaged time, money and frustration to get to where they are, and while they may want to assist you, you are not paying them for their time.
  4. Read books! There is one extremely good book by Robert Faludi. While dated, it provides valuable insight into the world of XBee.
  5. Learn AT commands in a serial prompt. XBees have a system similar to Vi: various modes depending on the conditions you place the XBee in.
    1. An XBee boots up in Transparent (or API) mode by default. Here, you can send (Transparent mode) text or (API mode) packet frames simply by sending text over the serial/UART connection. You can also enter Command mode to control how the XBee behaves.

      To enter Command mode:

      1. Wait 1 second since the last command issued
      2. Press +++, then wait for an OK (do not press Enter here)
      3. Once receiving the OK, you may:
        1. Read the value of various attribute stored in the XBee by using ATXX<Enter> (where XX is the AT command to be used)
        2. Set the value of these attributes by using ATXX YYY<Enter> (where XX is the AT command, and YYY is the value of the attribute you wish to set)
        3. Reset the XBee to factory default with ATRE<Enter>

      To exit Command mode:

      1. Wait 10 seconds after having entered Command mode
      2. Actively exit Command mode by issuing ATCN<Enter>
    2. It is an extremely good idea to get comfortable with performing a factory-reset the XBee (ATRE), then overwrite the values you need (ATNI, ATHP, ATID, ATCE, ATBD, ATAP, ATAO, ATDH, ATDL, ATWR) to make it talk to the network in the way that you want. Use an XBee AT command reference to understand the above minimal compliment of settings you’ll want to be able to control.
  6. Master serial control of your XBee! Don’t rely wholly on the shiny, pretty XCTU to get the job done above maybe learning what default parameters are for your devices, and using the built-in diagnostic tools to determine your XBee throughput and signal strength.

    Don’t get me wrong; XCTU is a valuable tool! But I have encountered some misleading issues with it (namely, tendency to repeatedly ignore my connected devices, requiring me to reset my devices when connecting via USB, and generally performing more slowly on a Mac than inside a Windows VM running on that same Mac!) which forced me to go “back to basics” and work with my XBee via AT commands over serial link with Cool Term.

  7. Listen to Rob Faludi. This guy knows his shit.
  8. Digi’s tech support team are fantastically intelligent guys, but it’s not their job to teach you how to use their products; they can only provide you with so much documentation before you have to burn some hours making breakthroughs of your own.
  9. Use Digi’s Knowledge Base, that’s what it’s there for.

I’ve only just gotten my XBee coordinator to receive data from and send data to an endpoint XBee connected to XCTU.

Happy radio-ing!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s