Poor Man's (Electricity) Smart Meter...


Senior Member
Most Many UK electricity meters seem to have a (visible) LED, that flashes at a predetermined rate to indicate energy usage. This is separate to the 'Irda'? port that can be used for two way communication with the meter, though in the case of my Landis & Gyr 5325 5235 it is integrated into the same physical space. (The irda port can only be accessed if you have knowledge of the 'password'; in the case of an energy company supplied meter, this won't be the case. This is a shame, since it turns out that many parameters of the meter are configurable...)

By counting the pulses from the meter (and knowing the starting reading), it is trivial to make the updated count available to a remote reader. My reason for starting this project was different though - I wanted to derive the instantaneous Power usage from the time between pulses. This will form the basis of a general purpose Solar PV diverter. My particular meter has a very useful "Anti-creep" function enabled, whereby the LED is illuminated constantly when the Power usage falls below a certain, preset limit (which appears to be 9.6W, in my case).

Assuming 1000 pulses = 1KWh (which seems common), then Power = 3600/Time. Unfortunately, this results in anything other than a simple straight-line graph (see: Multiplicative inverse - Wikipedia ), meaning that the time between pulses varies wildly! (At maximum power (24KW? in a UK domestic setting), the pulses are 150mS apart; at 1W, they are 1 hour apart!). I tackled this, by sending reports every 5 seconds from the 'idle' loop, thus filtering short-lived, high power bursts. As the power falls and the time lengthens, Power values are synthesised every 5 seconds and converge rapidly on the final result. (The first such synthesised value at 5 secs, equates to 720W - already a massive reduction from a potential previous reading of 24KW).

More details are given in the code and I can document the physical implementation, if anyone is interested.

Here is a 'block diagram' of the functionality required :-

This is much simpler than it may at first appear...

The Fixed Voltage Reference and DAC are combined to give a stable, but adjustable voltage which is higher than that available in ambient lighting, at the collector of a Phototransistor. The two voltages are compared using a Picaxe comparator and the output is brought out to a pin. Although not immediately obvious, this output signal can be used to trigger a software interrupt, whenever the phototransistor collector drops below the reference voltage, as a result of it 'seeing' a flash from the meter LED.

The Picaxe counter TIMER1 is used to count pulses from the Picaxe's PWM, which is running at 1KHz. This signal is 'gated' by the comparator, when its output is low. The result is that the time between LED flashes can be measured to 1mS resolution, up to a maximum of 65.535 seconds. Since this represents a Power of 3600/65.5 = 54W, an overflow counter is used to reset it every 60 seconds.

The practical implementation of the above block diagram, on a Picaxe 08M2 is shown below. (It also has a switch, which is used to 'nudge' the meter if required on initial setup and assist with programming. An LED is provided as a replacement for that on the meter, which will be obscured by the phototransistor. Both are non-essential. Finally, a HC-12 sends the meter readings to a remote receiver).


Unfortunately, the Picaxe code cannot be posted 'inline' - due to 'Forum Limits', which seem to have been set some time in the 1980's :( , so you'll have to download the attachment if you're interested.


Last edited:


Senior Member
Great project. My meter was updated last summer to one which uploads usage to the power company, which advertises that the homeowner can download daily/hourly usage stats. I asked the installer when that would be available. He said, when enough units have been installed. Still waiting.


Senior Member
Right on - I'm in sthe States but still waiting for instant access to power usage info. The meter seems to have an IR port but not the blinking usage LED which could be monitored with a PICAXE - at least I've never seen any light from it, even when using a lot of power (central air). I think all the local power co-op's meters (about 140,000) have been replaced but our access to the usage info is only via the monhly bill. I do track that - and the other utilities - in a spreadsheet so I have month-by-month historical records which go back to the month we bought this house (15+ years). You can see when I caulked the gaps that hadn't been touched in years, added insulation, replaced the single windows with double-glazed, replaced the 35-year-old central heat with a new high efficiency model, had a water leak caused by a County contractor and which months I've been working on regrowing the grass from seed after some major tree work - and I have the running 12 month cost of each utility. Spreadsheets can be very useful.


Senior Member
... The irda port can only be accessed if you have knowledge of the 'password'; in the case of an energy company supplied meter, this won't be the case. This is a shame, since it turns out that many parameters of the meter are configurable...
Yes, lots of parameters to twiddle, including the 'usage' registers and how to reset them. That's why the password is secret !.

Slightly OT, but many years ago I was involved in testing of a domestic meter development project which included this port. During testing I found it was possible to reset the usage registers without a password. In fact, the registers could be reset using just about any domestic IR remote control, with absolutley no knowledge of the protocol at all.

When I pointed this out to the development team there was some consternation, as 20,000 of these meters had already been installed nationwide.

I don't think I'm giving away any secrets now, as after 20 years these meters will have all been replaced with new ones, which don't have the 'reset' bug any more.

You might think software development has improved in twenty years, but who saw the recent news about the management software in WD NAS drives that required a password for local access, but not for remote access from the internet ?. This was because a software engineer involved in the testing of the software had 'commented out' the security check to speed up his testing !.

Now we trust this same generation of engineers to write software for self-driving cars and our banking.


Senior Member


Senior Member
You can only truly test software if you have some geek testers with twisted minds, devilish imaginations and strong hacker tendencies ;-)

That was one positive thing about working in a corporate "skunkworks". If the system developers couldn't solve users' problems, those users came to us because we almost never said "That can't be done." We were more likely to be like the SeaBees of WWII and say "The difficult we do right away. The impossible takes a little longer." We had a wide variety of experience and "geekiness" in the group so very little ever got by multiple testers. One of the more interesting places I've worked ;-)

I have zero interest in self-driving cars. Research has shown that the best multi-taskers can only manage 7 items before they begin to lose track - that's about how much attention you need to pay when driving so distractions can be fatal. If you can't pay attention to keep yourself and others alive, you should be on public transit. I don't like poorly human engineered touch screen interfaces that bury the heater fan speed three screen deep (rental Chrysler 200 several years back when my wife's SUV was in the shop). Heat, defrost, cooling and other essentials should be immediately available without having to read a screen. My teenaged truck has physical controls for everything and I can find the correct knob or switch with a quick glance - I'm not burning seconds scrolling through the screens and ignoring traffic. And some touch screen don't work well when you're wearing gloves...


Senior Member
Ah, self-driving cars. I'm ready. Don't care if I never drive again. None of this "must still pay attention to the road" stuff--I want to be able to read a book or take a nap. May well not happen in my remaining lifetime, but if I never have to buy another car, I'll be happy.


New Member
Buzby. Your comments on code and security errors struck a cord. 25 years ago I was contract installing for a big electronic security company. The most common stand alone codepad we used on alarm systems and door strikes would operate via 4 digit code or static from a comb rubbed down your pants. I also pointed out that their basic alarm of which I installed many, had a design floor meaning the ability to dial out and all sounder fuses and strobe fuses could be blown without entering the building or triggering alarms. I was told not to tell anyone.


Senior Member
I'm desperately trying to avoid having a Smart Meter fitted (having no desire for my Tariff to be dynamically varied (or my power turned off remotely by Chinese hackers ;) )).

The M-bus protocol used, is documented here: Overview – M-Bus , though building your own interface to it is 'non-trivial'. Apparently, Texas Instruments (Germany) have developed an interface IC (TSS721), but it only seems to be available from China! (or on ready-made boards, also from China).

I'm not sure if UK Smart Meters have this HAN port, but they definitely don't seem to have the flashing LED - so at some point I'm going to have to use an alternative method of obtaining power usage information.

I think I may have to take the "AD7755" approach, as used in Jeremy Harris' project here: (4) Photo Voltaic - Immersion heater power diverter.