We continue to develop resources related to the COVID-19 pandemic. See COVID-19 initiatives on Appropedia for more information.
Wireless Upgrade for Typical Consumer Power Meter
|This page was developed by the Queen's University Applied Sustainability Research Group.|
The Queen's Solar Design Team, in collaboration with the Queens Applied Sustainability Group hopes to modify a typical consumer power meter to provide live internet monitoring and recording of residential power consumption.
With today's rising prices in energy more attention has been towards energy conservation. Manufacturers are now trying to create green versions of their products that utilize less energy. Green options can sometimes be more expensive than their more energy hungry counterparts. Power monitors can help you reduce your energy consumption by identifying phantom loads, by helping you reduce your power consumption, and by helping quantify the savings you could make by upgrading to energy efficient devices. Commercial power monitors can cost upwards of 500 dollars. Fortunately a much cheaper alternative exists. Using a plug-in power meter such as a Kill-A-Watt, while less accurate than a commercial power monitor, can provide useful data at a reasonable cost. You can retrofit a Kill-A-Watt with a ZigBee wireless transmitter to create more functionality. For this we will be using Adafruit’s Zigbee adapter receiver ( not covered here please see  for more information ) and transmitter which uses the popular XBee module by Digi. You can look at the pachube page for this project @ http://www.pachube.com/feeds/8383/.
Check out our live power feed from our office power meters at qsdt.org
In this demonstration we will be using a Kill-A-Watt meter. We will be receiving current and voltage data from the Kill-A-Watt’s Op-Amp which will then be wirelessly transmitted using the Zigbee module. You can use other power meters but you cannot know if it will work unless you open it and examine it as the op-amp may be different. As an added justification for using the Kill-A-Watt, this particular power monitor's size is excellent to house the ZigBee unit.
The ZigBee RF chip has an embedded micro controller which allows you to do some simple operations without having to program a micro controller. The software provided by Digi X-CTU allows you to change variables such as sleep timer easily. Unfortunately, it also limits you, without a third party micro controller you can't insert nonvolatile memory. As a result if there is a power outage a portion of your data will be lost.
The XBee unit receives it's power from the Kill-A-Watt. Unfortunately the current received is lower than required to run the Xbee and as a result a large capacitor is used to account for the current needed. The C1 and C2 is to provide a constant voltage to the 3.3V regulator and C3 capacitor on the reset pin of the Xbee will help delay the transmitter to allow the other capacitors to charge up again. The voltage divisor is used to decrease the sensors inputs received from the Kill-A-Watt at 5V to 3.3V. The last resistor is used to power the LED. In this demonstration we did not create our own circuit board but instead used one that was meant for the receiver. Creating your own transmitter circuit board will greatly increase the speed and simplicity of putting this together.
|Material||Quantity||Approximate Cost ($ USD)|
|Xbee Chip (XB24-AWI-001 or XB24-ACI-001)||1||$20|
|3.3V linear voltage regulator, 250mA current ( MCP1700-3302E/TO )||1||$0.415|
|220 uF capacitor||1||$0.189|
|100000 uF capacitor||1||$1.085|
|0.1 uF capacitor||1||$0.302|
|1/8” Heat Shrink||1||$1.62|
|PCB Board ||1||$5|
All resistors listed are 1/4W and 5%, the total cost is approximately $52 for one Kill-A-Watt.
Programming the XBee Unit
Using the host controller we programmed each XBee unit into a transmitting mode using the X-CTU software provided by Digi. You must change these options within the program:
1. MY address to 1 increment this with every transmitter added. 2. SM to 4 (Cyclic Sleep) 3. ST to 3 (3 milliseconds timer) 4. SP to C8 (Hexidecimal value for 2 seconds between transmits.) 5. ADC 4 D4 to 2 (Enable pin AD4) 6. ADC 0 D0 to 2 (Enable pin AD0) 7. Samples to TX IT to 13 8. Sample Rate IR to 1
I decided to use the PCB board created for the XBee host controller by adafruit this saved some time in creating a new PCB board and also using just a breadboard.
Note: You can skip this entire section and use a third party program EnergyLogger ( http://www.miloslick.com/EnergyLogger.html ) It does have some limitations, such as that calibration is less accurate and does not have pachube support at this time. It can twitter the energy usage and also upload your data into a spreadsheet in google docs. I will not be covering how to use this program here.
You are able to use any almost any programming language to communicate with the Xbee unit. Most popular programming languages have third party APIs for the Xbee. I am going to be using the open source language python python, as the code is readily available, free and will save time. I added support for two meters to adafruit's original code  and Brian Naughton's modification for pachube . The modification will average the data received from both power meters into two separate variables and upload it to pachube. Without the modification the program would combine the average into one variable which I feel provides less useful information. In the following steps I will demonstrate how to modify the code for your own power meter.
|Step 1: You will have to install quite a bit of new software:
|Step 2: Open Wattcher.py with a text editor such as notepad to edit the COM port. Locate SERIALPORT = "COM3" and change the value to whatever COM port your host controller is located at.|
|Step 3: Once you extracted the zip file we will now calibrate the code. If you are running XP go to Start > Run > Then type in CMD and press enter. If you are running Vista or 7 press start then type in cmd into the search area and open the Command Prompt. Once the program is open you will need to navigate to where you extracted the zip folder. To go down a level type in cd .. to go into a folder type in cd foldername. Once in the folder type in C:/Python25/python.exe wattcher.py -d to run the program|
|Step 4: You will get random series of data we are interested in the ampdata the most common number displayed will be your calibration number remember to unplug anything connected to the device at this point. You should be getting nice numbers around 500 if you are not check the troubleshooting section to isolate the problem.|
|Step 5: Once you record the number it is time to change it in the program. Open pachube-tweetawatt and modify the vrefcalibration number for sensor 1. (Sensor 0 is your host controller it should be set to 0). Do the same for the second sensor too. You can edit it using pythonwin/idle or even notepad.|
|Step 6: Now create an account at www.pachube.com and register a new feed, and get your api key from settings. Once you figure out your feed number and api insert it into pachube-tweetawatt code where it is stated to change. Makes sure you change the host controller COM port.|
|Step 7: You are now ready to run the program. Using the same method in step 2 to navigate to the program and run it using the C:/Python25/python.exe pachube-tweetawatt.py . You should getting a steady stream of data and after 2 minutes it should send the average of the data to the pachube website.|
Troubleshooting and problems encountered
Most of the design was straight forward but I did come across several problems when adding multiple Kill-A-Watts also the new Kill-A-Watt revision did not make things easy either.
One of the problems I encountered with the software was to find a good website to host the data. Google powermeter was my first choice but it did not allow me to share the data publicly. Instead it required every person who wanted to see the data to be invited. The next website I found was Pachube, it was a very straight forward website and allowed me to publicly share the data. Problems did arise when multiple power meters were added. The original program was written for only one power meter. The modification above was necessary to account for this challenge.
The new Kill-A-Watt revision did not allow a simple way to route the wiring around to the other side. A notch was needed to be made on the PCB which was risky as a wrong move could break a connection. Another problem that I came across was calibration. It appeared that the Kill-a-Watt's ampdata reference numbers were drifting with time. I came to the conclusion that it was due to the wiring onto the Op-Amp and it was creating a connection with something it shouldn't of. It was also very hard to fix the problem as the Op-Amp was surface mounted onto the PCB board.