Get our free book (in Spanish or English) on rainwater now - To Catch the Rain.
Wireless Upgrade for Typical Consumer Power Meter
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.
The article below is not complete!! Full details can be expected on or before August 31, 2010.
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/.
In this demonstration we will be using a Kill-A-Watt. We will be receiving current and voltage data from the Kill-A-Watt’s Op-Amp and is wirelessly transmitted using the Zigbee module. You can use other power meters but you cannot know if will work unless you open it and examine it. Also the Kill-A-Watt'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 too, without an a third party micro controller you can't insert nonvolatile memory. As a result if there was 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 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|
All resistors listed are 1/4W and 5%, the total cost is approximately $47 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.
|1||Solder on LED and its respective resistor to reduce the current. The voltage regulator regulates the voltage to 3.3 V which is required by the XBee, the 220uf capacitor helps keep a constant flow of power and also a 0.1uF capacitor to filter out unnecessary high frequencies from the power supply. A jumper is soldered between VREF and VCC to set them equal to each other. The 10k resistors are soldered onto analog input pin AD0 and AD4 and to ground.|
|2||Solder on two 4.7k Resistors at the end of the input wires for the voltage divider.|
|3||Finish soldering the 4.7k resistors onto the 10k resistors to successfully reduce the voltage of the kill a watt sensors from 5V to 3.3V|
|4||Solder on the 220uF cap to the reset pin and ground.|
|5||Now for the 10000uF capacitor. Solder the diode ( make sure the diode is pointing to the capacitor) to the positive lead of the capacitor and then connect it to the XBee's power source through the voltage regulator. Then solder then negative lead to it's respective ground|
|6||Solder on a wire to the positive and negative lead, make sure you use a heat shrink to cover the leads once you are done. This will be used to connect to the Kill-A-Watt's power source.|
|7||This step can be different for everyone depending on what revision of the Kill-A-Watt you received. But it's functionality is still the same. Crack open the Kill-A-Watt and locate the Op-Amp, in this example the Op-Amp was located under the LCD Screen which will make soldering on the leads a bit harder. The Op-Amp is circled in the picture.|
|8||Make a hole big enough for the LED on top of the Kill-A-Watt's casing.|
|9||This step is optional depending on revision. Make a hole on the PCB board in this case we did the left of the Op-Amp in order to feed through the wires to the other side. Make sure you do not cut through any connections|
|10||This step can be different due to revision. According to the data sheet for the this particular Op-Amp the 2 outputs are located at the far left top and bottom pins. It doesn't matter which lead you solder on as long as you account for it in the program. I would personally suggest connecting voltage lead (AD0) to top pin and current lead (AD4) to bottom pin to avoid having to modify the program. Finally solder the capacitor's positive and negative lead to the Op-Amp's VCC and ground leads respectively.|
|11||You should end up with something like this before closing the Kill-A-Watt. You can also use an adhesive to prevent the components from moving within the device. In this particular construction we did not.|
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 python, as the code is readily available 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 believed gave less useful information. In the follow steps I will demonstrate how to modify the code for your own power meter.
|1||You will have to install quite a bit of new software, python version 2.5 http://www.python.org/download/releases/2.5/, pyserial http://sourceforge.net/projects/pyserial/files/pyserial/2.4/ , win32file http://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063, simplejson http://pypi.python.org/pypi/simplejson, and the python code which includes the python-eeml needed by pachube http://www.2shared.com/file/VbPR3p89/Python_Power_Meter_Code.html (extract the files into a new easily accessible folder on your root C:/ folder or Desktop Note: If you only have one power meter hooked up use the original pachube-tweetawatt code from Brian Naughton you can find it here: http://naughtorious.com/files/pachube-tweetawatt.py|
|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.|
|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|
|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.|
|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.|
|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.|
|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 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. Although. problems did arise when multiple power meters were added. The original program was written for only one power meter. I was able to get around it by modifying the program to upload the data from the power meters as two separate entities.
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 this was risky as precautions were needed to made in order to avoid disconnecting anything. Another problem that I came across was calibration, The Kill-A-Watt was changing it's ampdata reference numbers overtime. I came to the conclusion that it was due to the wiring onto the Op-Amp 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.