Optical detector for Electricity Meter

Poul-Henning Kamp
Initial 2007-02-17

This picture shows my electricity meter. It is a very common model from one of the worlds major manufacturers of such.

The circular feature at the bottom right is for infra-red two-way communication using DLMS or "Device Language Message Specification", a terribly complicated way to read electricity, gas and water meters.

My beef with this meter is that it provides no useful indication to me about the instantaneous power usage in my installation. If you look at the display, there is anice little bar-graph in a logarithmic sort of scale which tells me that I probably use somewhere between 1 and 10 kW right now.

Very useful.

Very precise.


Below the display is a LED which flashes 10000 times per kWh.

Only, on my meter it does not.

I know from other meters I have seen, that this LED can work, I have seen nice yellow flashes for instance. But on my meter there is nothing to see, what so ever.

Initially I expected that the LED was simply disabled, a not at all unreasonable assumption, giving the pricing mentality of my local net company. It would not have surprised me a bit, if they charged $20/y for flashing the LED.

Fooling around with a toy infrared camera one day, I noticed that the LED did indeed flash, but infrared flashes.

It boggles the mind why anyone would order electricity meters with a flashing infrared LED. I take it as further proof of the deranged imaginations that run the net company.

In one of my boxes of junk I found a BPW34F pin-diode and a couple of BC547 transistors and set to work.

The transistors are connected in darlington cascade and the pin diode is reverse biased on the input.

When you shine a (infrared) light on the PIN diode, the two transistors will conduct and you get a usable electrical signal.

You can test this with an oscilloscope and a infrared remote-control on your workbench.

I mounted this on a bit of strip-board, with only the pin diode on the front side, so that it could be mounted on the electricity meter as closely as possible.

Duct-tape is a great thing btw.

In the other end I have a 9 SUB-E female connector and a 5.6k resistor which is all that is necessary to interface to a serial port.

TXD and RTS will have opposite polarities when the port is open, so they form a nice power-supply. The resistor holds DCD down and the pin diode + transistors will pull it up when the light pulses.

Hook this to a COM port (USB serials will not work!) on a FreeBSD computer, download and compile this program.

Give it the name of the serial port as argument and you should see:

# ./foo /dev/cuad0
              Time           dT pulses       kW      kWh    DKR
    1171714387.186  0.253315926      1   1.4212   0.0001   0.00
    1171714387.948  0.761820316      3   1.4177   0.0004   0.00
    1171714388.958  1.010000944      4   1.4257   0.0008   0.00
    1171714389.963  1.005472898      4   1.4322   0.0012   0.00
    1171714391.188  1.224430084      5   1.4701   0.0017   0.00
    1171714392.165  0.977486849      4   1.4732   0.0021   0.00
    1171714393.140  0.974605322      4   1.4775   0.0025   0.00

If you have a parallel port, add the "pps" feature to your kernel and put the signal on pin 10 (havn't tried this, figure pull-up/down out for yourself).


Poul-Henning Kamp

Valid HTML 3.2!