<<<--- Back to www.seanadams.com

Electric meter reader


6/21/01 - John Bolhuis has built one! Here a link to his MRTG plot

8/26/02 - Adam Sampson has done a similar project which interfaces to the blinking light on a British electric meter.


Schematic (jpeg)
Source code (C)

Here is the plot of my energy usage over time, using MRTG - temporarily not updating... I just moved, and haven't yet hooked it up again.


Have you ever wondered:

If you're losing sleep due to any of these burning questions, then perhaps you should build this project. This contraption uses a laser and photo resistor to non-intrusively measure the rotational speed of that ominous disk inside the electric meter. With this information, we can calculate how many Watts we're pulling. Then we can feed the data into a monitoring program such as MRTG, and get a nice plot of energy usage over time.

There are basically three parts to this:

You'll need one pair of wires to get from your computer to your power meter. I had an extra pair of telephone wiring available, so I didn't have to run any wires. I made every effort to keep the electronics simple and minimize the amount of wiring, because I didn't want to spend more than a weekend getting this to work.

The photo interrupter

I wish this picture were better, but there is thirty years worth of crud cemented to the glass.

Click here for more photos of the laser assembly

Disassemble the laser pointer, drill a hole in the end, feed a couple wires through, and connect them to the battery contacts. Then strap the button down with a wire tie, and seal everything up with epoxy. To mount the laser, coil one end of a coat hanger wire into a spring shape, spread the spring open a little, and slip the laser inside. Make a loop on the other end of the wire, so you can mount it to the wall using a screw. Now attach the negative lead from the laser to the coat hanger wire, which will serve as ground (you need to file off the coating from the coat hanger wire). AFAIK all of these little laser pointers have regulated power supplies and will work fine on 5 volts. To be safe you might want to use a resistor to bring it down to whatever the battery voltage is supposed to be.

Mount the photo resistor in the same manner. Glue a red peice of plastic over it, to serve as a filter. Tie one lead to ground.

Now run the wires from the laser and the photo resistor to the location where you will install the detector circuit. I installed it in my phone box - I'm not sure if this is kosher... if PacBell complains, I'll have to put it somewhere else.

Detector circuit


Close up - top side (640K)
Close up - bottom side (696K)

I built the detector circuit on a small peice of perf-board. The schematic is posted at the top of this page. This circuit removes the DC component of the signal (ambient light) and generates a logic pulse whenever the laser beam passes through the disc. The trimmer sets the sensitivity.

Software

The top trace is the signal from the photo resistor, the bottom trace is what gets sent to the computer.

The output from the detector circuit is fed into pin 11 of the parallel port on a linux machine. pge.c is a program which measures the period of the pulses coming from the detector, and calculates total power consumed (Watthours) and the amount of power presently being drawn (Watts). To get these numbers, we need to know how many Watthours to a revolution. This constant "Kh" is printed on the front of the meter - mine is 7.2. Also, because the disc has two holes in it, we need to divide this number by two to get the number of Watthours per pulse.

Compile the program with " gcc -O -o pge pge.c " and then make it suid root with " chmod u+s pge ".

Here's what the output looks like. The first few lines are with the usual complement of lights, TV, and computers turned on. Then I turned on my stove for ten seconds, and turned it off again:


  # ./pge
  1033.49 W       3.60 WH     
  1047.87 W       7.20 WH
  1037.71 W       10.80 WH
  1046.93 W       14.40 WH
  1193.48 W       18.00 WH
  3746.75 W       21.60 WH
  3611.03 W       25.20 WH
  3651.73 W       28.80 WH
  3591.02 W       32.40 WH
  2634.68 W       36.00 WH
  1033.58 W       39.60 WH
  1032.75 W       43.20 WH
  1016.55 W       46.80 WH

The program also creates a file "/var/pge.mrtg" which you can import into MRTG. This file contains total power usage in watt hours. You need to specify several options in MRTG to get correct output: Here's a sample config:


  Target[electric_meter]: `cat /var/pge.mrtg`
  MaxBytes[electric_meter]: 20000
  Title[electric_meter]: Electric Meter
  PageTop[electric_meter]: <h1>PG&amp;E Electricity usage</h1>  
  Options[electric_meter]: growright,perhour
  YLegend[electric_meter]: Watts
  ShortLegend[electric_meter]: W