I'm using an XBee mesh radio network and Arduino boards to measure the efficiency of the way we use our central heating system at home. We've done a similar thing with power consumption previously using an
MQTT feed and graphs at
http://www.taoma.co.uk to reduce power consumption by around 15% through better awareness of which behaviours in appliance use are most expensive - the next step is to do the same for natural gas use, which is rising in cost with every quarterly bill.
Initially I planned to measure gas consumption by fitting a modern meter I could read using an Arduino board or gas company web service. I may still go down this route, but since I don't know the sampling interval here, and since nearly all the gas is used by the central heating system, it looks easier just to identify when the boiler fires up and shuts down by putting a temperature sensor in the exhaust manifold. A quick test with a measuring probe indicates this reaches 147°C when the burner has been running for a few seconds. The LM35 temperature sensor conveniently reads to 150°C, which would be an ideal sensor package, however what I've got in stock are TMP36 ICs which read to around 124°C, so we'll have to cheat a little with the readings. The flue is at head hight at the back of the house, making it straightforward to mount a sensor in the exhaust gas flow.
The remainder of this post describes tools, the bill of materials, an overview of the project, and the steps required to build it.
Tools
* Stanley knife and cutting board
* Wire stripper
* Soldering iron and solder
* Glue gun
* Hack saw for cutting sensor mount
* Electric drill and 5mm drill bit for securing the sensor mount to the house
Bill of Materials (I'm in the UK, so some component suppliers are UK-specific)
* 2x XBee Series 2 mesh network devices (www.digi.com,
coolcomponents)
* 2x ArduinoXBee v1.1 shields ( see the
ArduinoXbee page at www.arduino.cc for an overview)
* 4 metres Cat-5 patch cable
* short length of threaded rod for sensor mount arm (hardware store)
* 4x cable ties to secure sensor to sensor mount arm (hardware store)
* 6x patch-cable sized cable clips, 5mm, to secure patch cable to the wall (hardware store)
* 2x
Lock&Lock Arduino-sized plastic food containers to act as enclosures for boards. CoolComponents sells an
ABS enclosure for the Arduino, but the ZigBee shield is just a bit too wide for this.
Project Overview
The wiring for the probe is CAT.5 patch cable, which given that it wraps eight wires, provides for six sensors (two of the wires are reserved for common +5v and GND, six are free for connection to the middle pin of each LM35 sensor at one end, and to analogue pins 0 to 5 on the Arduino Duemilanove board at the other).
The XBee Series 2 mesh radio chips are used because it's not convenient to connect the Arduino board measuring the sensor inputs to the Internet - it's in a fairly inaccessible position on the inside of the house in what used to be the kitchen larder, near an air brick that provides a convenient hole to thread the patch cable through. So the sensor unit board has an on-board ArduinoXBee v1.1 shield mounted on it, with a XBee transmitter/receiver configured in "ROUTER/END DEVICE AT" firmware mode. The sensor unit board is responsible for polling each sensor, smoothing out readings, and sending network packets to the remote Monitor Unit board.
The Monitor Unit board is connected via a USB cable to the low-power 8-watt Ubuntu PC in the workshop that monitors power consumption and handles home automation. The Monitor Unit is another Arduino with an ArduinoXBee v1.1 shield and XBee configured in "COORDINATOR AT" firmware mode. This establishes the mesh radio network, and receives messages from the sensor board, which is physically located about 15 metres away and on the floor above the workshop. The USB cable powers the board and interfaces it to the PC using the Arduino Serial library, so that messages from the remote sensor board can be processed, logged in an
RRD database , and sent over the Internet using
MQTT.
Step by Step
1. Attach sensors at various points on the patch cable after establishing a colour coding convention for each wire - I used blue for Ground, orange for +5v, and green for the signal from the flue sensor, sensor 0. Then it's blue/white for sensor 1 (outside the house for ambient outside temperature), green/white for sensor 2 (zone A), orange/white for sensor 3 (zone B), and brown for sensor 4 (zone C). Tin the ends of the wires; you could solder each wire to header pins at this stage for easy insertion into the sensor board but consider how you're going to thread the cable through the building first.
2. Set the XBee firmware for the sensor board to ROUTER/AT END DEVICE using X-CTU on a Windows PC with the radio chip mounted on the Sparkfun Explorer board; make sure you set the PAN identifier to a number unique to your new network (I chose "254").
3. Set the XBee firmware for the monitor board to "COORDINATOR AT" and set the PAN identifier to match the ID chosen for the other XBee.
3. With the sensor Arduino board disconnected from the XBee Shield, download code to read each sensor ,average the values, and print them using the Serial library with a delay of 1000 milliseconds between each set of readings. Example source for monitoring temperature and writing values to the serial port (which the ZigBee relays data from) is available from a number of helpful Arduino suppliers. I chose to start with
http://oomlout.com/TMP36/TMP36-Guide.pdf, which contains a link to an easily adapted source code listing.
4. Attach the XBee shield and ROUTER/AT END DEVICE XBee chip to the Arduino sensor board, connect it to your computer, and use the Arduino IDE Serial Monitor function to check for messages from the sensor program running on the Arduino.
5. I'm working out the details of the monitor board software as I write this, update due when I've cracked it.
Labels: sensor arduino temperature zigbee heating