This project is used to control a gas fireplace in my house to maintain a constant temperature.
The hardware for the thermometer includes:
Two series 2 XBees
One XBee Explorer
One XBee Adapter Kit
The XBee Adapter Kit was my first soldering attempt and I'm told I did a great job. A PanaVise Junior and a Third Hand helped immensely, along with choosing a 1/64“ soldering iron tip over the 1/32” tip that came with my soldering iron.
I also cut three jumper wires, stripped them and soldered them to the DHT22. This was more difficult, but placing the sensor in the vise and using the Third Hand to hold the wire with a folded up piece of paper to protect the insulation helped line everything up.
I attached the XBee Adapter to the breadboard and wired up 5V power and ground. I attached the TX pin of the adapter to digital pin 2 of the Arduino and the RX pin of the adapter to digital pin 3 of the Arduino. I attached the sensor's data pin to port 7 (from the DHT22 source) and the ground and power to the proper pins on the breadboard.
I use X-CTU from Digi International to set up the XBees. The destination radio is using coordinator firmware while the monitor radio is using router firmware.
Originally I bought XBees with the chip antennas, but they only had a range of about 3m without careful alignment of the antennas. I replaced these with series 2 radios with U.FL connectors and antennas (even though that may be over-compensating).
For the original series 1 antennas I used xbee_modem_setup.rb set up the to XBees to communicate with each other. Be sure to use the Arduino XBee's serial number as the destination address of the XBee Explorer and vice versa.
`bin/watch` can be used to monitor the temperature the Arduino reads.
Excluding the cost of soldering equipment the wireless thermometer cost under $150.
I plan to add two more thermometers to the setup which will cost another $250. Instead of the Arduino Uno I'll be using the cheaper Arduino Pro Mini now that my soldering skills are proven.
Most of the software used in this project was already written by third-parties that I adapted to my needs. The DHT22 library was changed from returning float to int (that I can decode on the ruby side). xbee_modem_setup.rb was updated to work with a newer serialport gem for ruby and the documentation was reformatted.
`bin/indigo_monitor` reads data from the thermometer and populates a variable in Indigo. Through Indigo's database support (I use Postgres) the values for the temperature are recorded.
`bin/indigo_control` uses a PID controller (currently only Proportional control, I and D gains are set to zero) to turn the fireplace on and off.
The desired temperature (set point) is controlled by a wall switch attached to an event group that raises or lowers the set point by one degree per press.
Every minute the control loop reads the current temperature from Indigo, feeds that into the PID controller, checks the output value and turns the fireplace on if it is over 0.2 and off if it is under -0.2 (to avoid flutter in the temperature measurement). The current control position is also recorded in Indigo for debugging purposes.