Power Logger

With a design along the same lines as the Gas Sensor Logger, I made up a power consumption monitor for the house.
I installed 4 clamp on current transformers in my panel, one on each of the 230v legs coming in, and two that can be clamped on any circuits of interest. With the transformers and an arduino wired up pretty much exactly as described at this link I was able to load up a sketch that would provide a accumulated total of power consumed.

 

The arduino is connected to one of the USB ports on the raspberry pi that’s running my Thermostat Project, which means I was able to write an additional daemon that could poll the arduino for power measurements and log them to the same mysql database that all of my environmental data gets logged to. With that data being logged I’m able to make some pretty graphs to display power consumption.

The code for both the arduino and the raspberry pi side of things is on github at https://github.com/rhasbury/GasSensorLogger. I might break it into its own repo at some point but for the moment the two are so similar they can hang out in the same place.

I found that having the graph for reviewing the days consumption was cool, but for finding out what the different items in the house draw I really wanted to have a gauge with a needle, so one addition to the power logger that isn’t in the gas logger is a tcp socket that is made available for requesting realtime (down to ~2 sec) power measurements. If you send a “get_powers” string to port 50008 on the pi it’ll send you back a json string like so:

{“onetwentywatts”: 676.87, “clamp1watts”: 97.17, “clamp2watts”: 12.43, “twofortywatts”: 226.56, “totalwatts”: 903.43}

So with the help of a php script and some borrowed d3 code I got something rough put together. These are hosted on that same thermostat pi, so these graphs and gauges are available to any device connected to the lan. It’s nice to have this graph on my phone while I’m wandering around trying to figure out what’s burning so much power!!$!$$

The code for the graphs and gauges are in the github repo as well, under the rpi/http folder.

 

 

Advertisements

Tags: , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: