Power Hungry

I finished my first significant electronics project in a while: Power Hungry.  The idea is that I use sensors to monitor the actual voltage & amperage usage of various devices in my apartment, and I wirelessly transmit that to a base station, which calculates various statistics.  The results are then beamed to my linode server, where I have some graphs of the data.  The ultimate goal is to use this data to reduce my overall energy usage, but for now I’m just working on establishing a baseline, so I can best judge the effectiveness of whatever changes I make.  The results so far, though, are fairly interesting.

The science (basics):

The power coming from the wall (aka mains) is alternating current, meaning that the electricity on the line continually changes polarity.  The name can be misleading, though, because the mechanism by which the alternating current is achieved is actually by alternating the voltage.  If a lightbulb is plugged into a socket, the voltage and current will rise and fall together.  One moment the voltage will be high (positive), and the current will be flowing one direction.  A moment later, the voltage will be low (negative), and the current will be flowing the other direction.  From this example, it isn’t clear which causes the other.  If, however, there is nothing plugged into the outlet, the current will be constant (zero), since current is the measure of the amount of electricity flowing past a point.  If you were to plug a precise voltmeter into the outlet (which I am *not* recommending you do), you’d still see the voltage as before (fluctuating between positive and negative).  It is this continual push/pull which causes (when something is hooked up) the current on the line to go back and forth.

The way Power Hungry works is that it takes very frequent (1KHz) measurements of voltage and current.  Being in the US, I know that the mains supply fluctuates 60 times a second, which means one full cycle is about 16.6 milliseconds.  Since I’m taking a measurement every 1ms, the averages from a 17-reading sample serve to represent the surrounding couple of seconds’ usage, which is what gets sent to the collector, and then the webserver.

The hardware:

I hardware is from an open source design created and sold by adafruit.  It uses off the shelf kill-a-watts, XBee radios, and some simple electronics.  There is also a base station which listens to all the wireless kill-a-watts, and collects the data.

The software (collector):

For the data collector/aggregator, I ported adafruit’s python library to ruby (both to get a better understanding of the XBee protocol, and because it’s my language of choice).  What resulted wasn’t a full-fledged XBee ruby library, but a solid foundation for one.  I’ll definitely extend it as other similar projects require, but it’s also on github in case anyone else is interested in it.

The software (web server):

Nothing too special here.  I use sinatra to serve a page with some simple flot graphs, and borrowed elements of the design from various open source CSS templates.  I show both “Right Now” graphs (a recent 19-millisecond sample from the meter showing voltage & current), and longer term graphs, showing wattage over time, as well as the running total.

The results:

I have two meters going now, for the two things I have the most flexibility with: my media center, and my kitchen appliances.  My kitchen appliances (toaster, toaster oven, and microwave) use effectively no power when not in use, but spike up to as high as 800W when in use.  Even for longer baking projects (in the toaster oven), the devices are in use for such a short period of time that it has a relatively small effect on my overall power consumption.  My media center, however, is another story. When it’s on, it uses about 300W.  When it’s off, though, it stays steady at about 125W.  That makes for a huge percentage (something around 70%) of my monitored power usage being done when I’m not even home.  The next step will be figuring out which devices in my media center are the hogs, and finding a convenient way to kill the power usage when it’s not needed (maybe actually disconnecting the power from things not in use, or getting more efficient devices).

Published by

Patrick Schless

I'm a (mostly) ruby/rails developer, living in Chicago. I work at Braintree, and I have lots of side-projects.

One thought on “Power Hungry”

  1. Nice weblog right here! Also your site rather a lot up
    fast! What web host are you the uuse of? Can I am getting your affiliate hyperink to your host?
    I wish my web site loaded up as quickly ass yours lol

Leave a Reply

Your email address will not be published. Required fields are marked *