3) Configure the Radios
If you’re not familiar with configuring radios using AT commands, review the steps in the Basic XBee 802.15.4 Chat tutorial, which walks you through configuring CoolTerm to program the radios.
Program the PowerSwitch Tail Radio
This is the radio that will receive commands and, in turn, activate the PowerSwitch Tail to turn the lamp on.
- Label one XBee with “PST,” insert it into the Explorer USB, and connect it to your computer.
- Launch CoolTerm and connect to the XBee.
- Here are the commands we’re going to use to configure the radio:
| Function | Command | Parameter |
|---|---|---|
| Reset | ATRE | N/A (resets the radio to its factory settings) |
| PAN ID | ATID | 3001 (any address from 0 to FFFE will do) |
| MY Address | ATMY | 2 |
| Pin 0 I/O configuration | ATD0 | 4 (digital output, low on startup) |
| I/O input address | ATIA | 0 (the default ATMY address of the XIG radio) |
| Write to memory | ATWR | N/A (save the settings to flash memory) |
- Here’s what your terminal session might look like. The user input is in bold:
+++ OK ATRE OK ATID 3001 OK ATMY 2 OK ATD0 4 OK ATIA 0 OK ATID 3001 ATMY 2 ATD0 4 ATIA 0 ATWR OK
Note: Remember to issue the ATWR command when you’re done so that the settings are saved in the radio’s flash memory. If you don’t issue this command, the radio will revert to its old settings when it loses power.
Program the XIG Radio
This is the radio that will act as the gateway between the internet and your XBee network using XIG, the XBee Internet Gateway.
- Label the other XBee with “XIG,” insert it into the Explorer USB and connect it to your computer.
- Launch CoolTerm and connect to the XBee.
- Here are the commands we’re going to use to configure the radio:
| Function | Command | Parameter |
|---|---|---|
| Reset | ATRE | N/A (resets the radio to its factory settings) |
| PAN ID | ATID | 3001 (any address from 0 to FFFE will do) |
| API Mode | ATAP | 1 (basic API mode) |
| Pin 6 I/O configuration | ATD6 | 1 (RTS monitoring disabled) |
| Serial baud rate | ATBD | 6 (57,600 bps) |
| Write to memory | ATWR | N/A (save the settings to flash memory) |
- Here’s what your terminal session might look like. The user input is in bold:
+++ OK ATRE OK ATID 3001 OK ATAP 1 OK ATD6 1 OK ATBD 6 OK ATID 3001 ATAP 1 ATD6 1 ATBD 6 ATWR OK
Note: Now that you’ve changed the baud rate on the XIG radio, you’ll have to update the connection settings in CoolTerm if you decide to reconnect to adjust that radio’s settings.


