Posted on

Pic Power Meter finally LIVE!

Power Monitor
Power Monitor

So, after google killed the Google PowerMeter api I got the incentive to finish my own project using it. Odd huh.
I wrote loads of code to hook into the google API ages ago, but never got the hardware setup. Now After Google announce the death of the API I finally cracked the last part of my hardware issues and have live power monitoring of my electricity meter.

The key difference to most here is that its NOT a clamp type sensor. It counts rotations of the meter disc itself. It is therefor accurate and matches exactly what I will be charged for.

There are three parts,
1> Pic (UBW board) with IR reflectance sensor
2> Moxa Serial to Ethernet convertor
3> Database server

The Pic board counts rotations of the disc in 1 minute increments. Every ten minutes it connects to the server over serial (to ethernet UDP) and uploads all ten readings
The server saves these into a mysql database.
I wrote some PHP code to generate graphs of various data, this is proving to be the hardest part. Getting the data to look good.

Power Use
Power Use

Please excuse the awfull graph but I shrank it to make it fit nicely in the blog post, in the full version you get it nicely labelled and some extra info like average KW/h and total KW/h for the time period selected.
The biggest problem is the jaggedy graph, this is a side effect of the fact I count rotations per minute. Rather than time each rotation. Because the average rpm is low I only get about 1 rotation each 30 seconds. So its very easy to get a reading of 1 followed by 2 by 1 by 2 etc as that second rotation moves slightly back and forth over the 60 second boundry.
I am looking at ways to smooth this out without distorting the data too much.

I used the PIC UBW board because the USB port allowed me to compile code and program the pic in <30 seconds without unplugging anything. The serial to ethernet converter remained connected to the serial port so my development cycle was quite fast for the PIC code. I did some simple software debounce of the IR sensor (just in case) but it doesn't seem to be needed. The end result is completely non-invasive to the meter (yes, in the pic you can also see my OWL clip on sensor, this is not part of the new system and only runs a small LCD by my PC). The next step is to find a sensor that will trigger from the gas meter and allow me to monitor that too. They are close together so the hope is I can use another input on the same PIC and upload both sets of readings at the same time. This graph has allowed me to identify individual appliances by time and watch their power use, with a little more detailed study I will eventualy work out the power profile for each device and possibly predict when each one is turned on and off purely from the graph data! I can spot my fridge, my oven and washing machine already.