Finished “Chapter 4 – Romantic Lighting Sensor” of “Building Wireless Sensor Networks” Book. Check out the hardware demo:
This chapter introduces the XBee API mode which allows the Arduino to send commands over the wireless bridge to a remote XBee. I had the hardest time confirming that the sensor node was working. Couldn’t figure it out. The Sensor board accepted the AT commands just fine when plugged into the X-CTU. The LED and photocell worked. But still … nothing was working! I finally figured out that when I reseated the XBee on the Arduino side that I accidentally seated it upside down in the daughter board. (Note to self, buy a digital oscilloscope!) Sensor board was sending … but the Arduino side wasn’t receiving! (Dang) Once I got that fixed everything started to work much better.
Or course some troubleshooting hints:
1) Before connecting the battery pack to the XBee on the sensor side, confirm that it is putting out ~3.3 V.
2) Connect up the battery pack to the XBee and connect power, the power light should light.
3) Verify the resistance of the photo resistor using a multimeter. If you have a mismatched resister for the voltage divider, the values out of the analog pin may be biased (IE the values read will not be as high or low as possible.)
4) The code in the book is out of date, in the “SetRemoteState()” method the “Serial.print(blah,BYTE);” won’t compile. The Arduino version 1.0 (or higher) no longer supports the BYTE keyword. Change these lines to read “Serial.write(byte(blah));” (byte in lower case)