Reading pulse output from kWh meters.
Document status: First draft created on the 30 July 2010: by Trystan Lea
Many kWh meters have pulse outputs the pulse output may be a flashing LED or a switching relay (usually solid state) or both. This page details how to read the switched output. Although the software can be used with both. For info on the flashing LED method see bottom of page, this method is preferable in most cases due to safety and also it is the most widely available pulse output type.
The pulse usually corresponds to a certain amount of Wh. Some meters may be 1 Wh per pulse (1000 pulses per kwh) other 10Wh per pulse etc.
Example meters

Many of the meters have connection diagrams similar to this one that comes with the A100C. The two smaller holes are the pulse output connections. I have added Vin and Vout labels to make it a little clearer. Vin is the pulse output supply provided by an external power supply. Vout is the pulsed output created by the meter by switching an internal solid state relay (like a switch in between Vin and Vout)

Supply Voltage
From what I understand 24V is a fairly standard supply for such meter systems, but other voltages can usually be used. Meters often have a fairly wide pulse output supply voltage range around 3V to 35V. So the 5V supply from an arduino could be used. Higher voltages are better when there is more noise in the environment and the cable runs are longer.
Safety
Watch out for mains connected pulse outputs
Make sure your meter's pulse output is not connected to high voltage mains (within the meter) some meters have one of the pulse output connectors connected to neutral. If your meter is one of these you will need other isolation circuitry to interface with an arduino.
Live wire proximity
The pulse outputs are usually very close to live wires, so watch out for those too!
Electronics
Pulse output meter to Arduino connection diagram:

The 10k resistor keeps the digital input at GND (digital level 0) when the pulse output 'switch' is open.
Software
There are two methods here for detecting the pulses:
- The continuous sampling method
- The interrupt method.
The interrupt method is nicer than the continuous sampling method as it gives more space for the arduino to do other things, however most Arduino boards only have two external interrupts numbers 0 (on digital pin 2) and 1 (on digital pin 3) so it is limited to the use of 2 meters.
The continuous sampling method can use all the digital input pins so if you have many meters to read try that one. I put together a library too to make the sketch look a bit cleaner when reading from in my case 3 kwh meters.
Continuous sampling method
Download PulseOutput Library: PulseOutput.tar.gz
Download PulseOutput Sketch: PulseOutputSketch.tar.gz
Interrupt method
Download PulseOutput Sketch using interrupt method: PulseOutputInterrupt.tar.gz
Accuracy
Power measurement accuracy depends quite critically on time resolution and how close to pulse fall the time measurement is taken.
kWh measurement is less dependent on time resolution as power measurement but still requires enough measurements to detect the pulse.
Further development questions
- Does the continuous sampling method miss any pulses?
- How does its accuracy compare with the interrupt method?
- How does the continuos sampling method perform when reading from more than 3 meters? and when the arduino is running other things like ethernet shields, etc?
- It would be good to do a good investigation into factors that determine accuracy of both methods.
Flashing LED, photodiode/transitor detection links
Thanks to Jerry for the links and comment below.
Lots of people have done
Lots of people have done this. It looks like most use a photodiode or phototransister to detect the LED pulses that many electric meters emit. See, for example, http://www.btinternet.com/~jon00/electmon.shtml and http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1276096046 .
It seems that usually one pulse corresponds to 1 or 1.25 kw.
Some electric meters don't emit readable pulses. If they have a rotating aluminum disk with a black line on the edge, rotation can be detected with combination laser or LED in combination with a photodetector. One rotation usually means 7.2 kw, but the value will be stated on the face of the meter.
There are even commercial products like the Black and Decker Energy Monitor that have a device that does either LED pulse or disk rotation detection, and sends the counts wirelessly to a display. They have a page that explains which meters are compatible and which aren't, at http://www.blackanddecker.com/energy/PowerMonitorCompatibility.htm?WT.mc...
These are available for under $100. If someone could figure out a way to intercept the wireless signal from one of these, or get their display to output data to another device, it could be useful.
Meters that don't have LED pulse output, or rotating disk, but that have a mechanical odomoter-style readout, often have a reflective circle inside the 0 or 6 on the first dial. Some people have found that this can be optically detected as it goes around. This approach can also work with some gas and water meters. Here's an example of one person that did this with an Arduino, with parts list and code, http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-...
Many water meters have a strong rotating magnet in the meter body that is magnetically coupled to the usage counter. Rotation of the magnet can be detected with a reed switch or Hal-effect sensor. See http://www.edcheung.com/automa/water.htm
Other meter types with rotating dials often have a magnet embedded in one of the dial shafts, which might be detectable as it spins around.
Less likely to be successful is optically detecting the spin of the little pointers on a rotating dial.
Some people have even played with trying to intercept the radio transmissions of various types of meters, with limited success.
There are a couple limitations to all these approaches.
One, the utility company tends to frown upon unauthorized equipment attached to their meters. Their field staff has no way of knowing whether your sensor will interfere with the meter or is some attempt to defraud the utility. I read one story about someone with one of the Black and Decker units, who had the unit removed, broken, and thrown away, and received a bill for several hundred dollars for a field service call.
In some countries, utilities are required to provide customer-readable LED pulse outputs on their meters.
Secondly, what is being measured with all of these approaches is the output of the meter, not the actual usage. If the meter is inaccurate, the data won't be reliable. This happens more than the utility companies like to admit. An independent reading of usage, for example with a Wattnode or Brultech ECM-1240 for electricity, can be more flexible and provide verification of meter and billing accuracy.
Thirdly, in many cases the utility company already has data in sufficient detail for many purposes, but perhaps just won't share it. My gas and electric service is provided by the same company, which has installed "smart" meters throughout their territory. Every 15 minutes, the electric meter sends the current reading to the utility over a mesh radio network. The gas meter sends its reading once an hour. The utility stores all the readings. They won't make the data available to residential customers. Commercial customers can get access for a small fee. I've actually thought about switching to a commercial tariff just to get access to the data. While not as good as real-time readings every second or minute, it would provide enough granularity to correlate usage with the weather, time of day, and similar factors.
Some utility companies do share meter data with all their customers, although it might be a daily total instead of the hourly or more frequent readings they actually have.
A few utilities make the data they have available for specific customers through services like Google Powermeter or Microsoft Hohm.
Thanks Jerry for the info and
Thanks Jerry for the info and taking the time to write! Interesting to hear about the rotating magnet type used in some water meters, didnt know about those and thanks for the links I will add those to the page.
Marcel and Apoorva Garg: Have a look at the links Jerry has posted and also another link thats worth looking at: Using an arduino to monitor gas by Ken Boak: http://sustburbia.blogspot.com/2009/11/using-arduino-to-monitor-gas.html
Thanks Apoorva Garg for the offer of contribution, if you would like to document your implementation here, that would be most welcome. The photodiode/transitor method is certainly something I would like to try sometime.
I also thought on the same
I also thought on the same lines as Michael suggested, putting a photo-diode or LDR in front of the blinking LED and measure the energy in a non-intrusive manner. I'm sure this can be done, as we have built similar proximity sensors for robots.
Actually we started this when we tried to address the problem faced while doing automated meter reading(AMR) in India, the protocol on which the electronic meters exchange data (Over the optical port) was a proprietary one, therefore it was difficult to make your own custom solution for reading the data from meter. These LDR/Photo-diode based solution were suggested as a possible solution.
I'm still interested in doing this project and would take it up in sometime. Also if you guys are interested in doing this, let me know if there is a way in which I can contribute.
Thanks
I've been thinking about this
I've been thinking about this for a little while and was thinking about using a photodiode sat in front of the flashing LED on the meter. That way I'm not having to touch anything inside the meter - which apart from being a little hazardous (!) wouldn't probably go down well with my electricity supplier!
Any thoughts?
[m]