ITP Temperature Sensing Network
Description
In fall 2009, ITP will implement an XBee–based wireless network throughout its home on the fourth floor of Tisch. Our class project was to build this new mesh, then test it by creating a network that senses temperature in four different regions of the floor. We were given five XBee radios and a day to finish the project. I was in charge of writing code.
Parts List
The prototypes were built using the following:
- Wire
- Breadboard (× 4), available at Radio Shack
- XBee module/radio (× 5), available at Mouser
- Arduino Mini (× 1) USB serial adapter/programmer, available at Makershed
- XBee breakout board (× 5), available at Sparkfun
- 22k Ω resistor (× 4), available at Radio Shack
- Thermistor (× 4), available at Sparkfun
- Power Adapter (× 4), available at pending
- 3.3 volt regulator (× 4), available at Jameco
- 0.1 μf capacitor (× 4), available at Mouser
- 10 μf capacitor (× 4), available at Mouser
XBee Configuration
One radio was setup to receive and the other four to send, with the former configured as a coordinator in API mode and each of the latter configured as a router in AT mode.
- Receiver (× 1) — Coordinator API
ATID666
- Senders (× 4) — Router AT
ATID666
ATDH0013A200
ATDL4054AE03
ATD02
ATIR3E8
Code
If you're reading this because you want to implement a similar network and need some code for your project, then you can download all the code files as one compressed tarball from the subsection below marked “All In One File,” or you can copy and paste code from the individual, browser–viewable code pages listed under the subsection marked “Separate Files (and viewable in a web page).”
All In One File
Separate Files (viewable in a web browser)
In either case, you'll need to make sure that the
Arduino sketch folder is titled
TemperaturSensingWithFiveXBees
and
contains globals.h
, xbee_api.h
,
temperature.h
and TemperaturSensingWithFiveXBees.pde
.
Note: the tarball
uncompresses a folder with all this organization in
place.
You sketch should look like the following:
Although the following code works, in the sense that it properly maps and processes received sensor data from each of the four sending XBee radios, the values from the temperature sensors are incorrect. These values were simply used to determine an approximation of temperature.
The rest of the code makes up the beginnings of a small
library I'm building for the Arduino. And, like any
library, not all of the code within the library is
being used. In this program, a function called
print_api_packet
in
xbee_api.h
is implemented but not used by
this program, but may be of use for debugging purposes.
You may keep or delete — it makes no difference.
The original implementation of the code ran at ITP, but was buggy. These bugs were removed later in the week at my apartment. Hence the feedback information for “Foyer”, “Bedroom”, “Living Room,” and “Kitchen.”
Lastly, the program was designed to run under UNIX's
screen
program. I tested under Debian
Linux with the command screen /dev/ttyUSB0
and under Mac OS X, version 10.5.8 with the command
screen /dev/tty.usbserial-A4001bf1
.
How It Worked
The coordinator/receiver had to be turned on first, after which the routers/senders could be turned on. If the coordinator/receiver was turned off then turned on for any reason, all the routers/senders had to also be shut off then turned on again for the network to work again.
Roy Vanegas
Last modified: Mon Aug 10 19:32:32 EST 2009