Step 4: Configure
OK so far you have assembled one of the XBee adapter boards and connected it to your computer using the FTDI cable. (The other adapter is for later so don't do anything with it yet!) The XBees respond to the X-CTU software and are blinking just fine. Next we will update the firmware
Upgrading the firmware
There's a good chance your XBees are not running the latest firmware & there's a lot of features added, some of which we need to get this project running. So next up is upgrading!
Go to the Modem Configuration tab. This is where the modem is configured and updated
Click Download new versions... and select to download the latest firmwares from the Web
Once you have downloaded the newest firmware, its time to upgrade!
Click on Modem Parameters -> "Read" to read in the current version and settings
Now you will know for sure what function set, version and settings are stored in the modem
Select from the Version dropdown the latest version available
Check the Always update firmware checkbox
And click Write to initialize and program the new firmware in!
That's it, now you have the most recent firmware for your modem. You should now uncheck the Always update firmware checkbox. If you have problems, like for example timing out or not being able to communicate, make sure the RTS pin is wired up correctly as this pin is necessary for upgrading. FTDI cables are already set up for this so you shouldn't have a problem
Rinse & Repeat
Upgrade the firmware on both of the XBees so they are both up to date
At this point it might be wise to label the two XBees in a way that lets you tell them apart. You can use a sharpie, a sticker or similar to indicate which one is the receiver and which is the transmitter
Configure the transmitter XBee
Both XBee's need to be upgraded with the latest firmware but only the transmitter (which is going to be put inside a Kill-a-Watt) needs to be configured. The configure process tells the XBee what pins we want to read the sensor data off of. It also tells the XBee how often to send us data, and how much.
Plug the transmitter XBee into the USB connection (put the receiver XBee away) and start up X-CTU or a Terminal program. Connect at 9600 baud, 8N1 parity.Then configure each one as follows:
1. Set the MY address (the identifier for the XBee) to 1 (increment this for each transmitter so you can tell them apart, we'll assume you only have one for now)
2. Set the Sleep Mode SM to 4 (Cyclic sleep)
3. Set the Sleep Time ST to 3 (3 milliseconds after wakeup to go back to sleep)
4. Set the Sleep Period SP to C8 (0xC8 hexadecimal = 200 x 10 milliseconds = 2 seconds between transmits)
5. Set ADC 4 D4 to 2 (analog/digital sensor enable pin AD4)
6. Set ADC 0 D0 to 2 (analog/digital sensor enable pin AD0)
7. Set Samples to TX IT to 13 (0x13 = 19 A/D samples per packet)
8. Set Sample Rate IR to 1 (1 ms between A/D samples)
if you think there will be more XBee's in the area that could conflict with your setup you may also want to
1. Set the PAN ID to a 4-digit hex number (its 3332 by default)
You can do this with X-CTU or with a terminal program such as hyperterm, minicom, zterm, etc. with the command string
You'll need to start by getting the modem's attention by waiting 10 seconds, then typing in +++ quickly, then pausing for another 5 seconds. Then use AT
Basically what this means is that we'll have all the XBees on a single PAN network, each XBee will have a unique identifier, they'll stay in sleep mode most of the time, then wake up every 2 seconds to take 19 samples from ADC 0 and 4, 1ms apart. If you're having difficulty, make sure you upgraded the firmware!
Make sure to WRITE the configuration to the XBee's permanent storage once you've done it. If you're using X-CTU click the "Write" button in the top left. If you're using a terminal, use the command ATWR !
Note that once the XBee is told to go into sleep mode, you'll have to reset it to talk to it because otherwise it will not respond and X-CTU will complain. You can simply unplug the adapter from the FTDI cable to reset or touch a wire between the RST and GND pins on the bottom edge of the adapter.
Now that the transmitters are all setup with unique MY number ID's, make sure that while they are powered from USB the green LED blinks once every 2 seconds (indicating wakeup and data transmit)
Configure the receiver XBee
Plug the receiver XBee into the USB connection (put the receiver XBee away) and start up X-CTU. If you set the PAN ID in the previous step, you will have to do the same here
- Set the PAN ID to the same hex number as above
Now that the XBees are configured and ready, its time to go to the next step where we make the Kill-a-Watt hardware