Electricity meter fun

At the place I live, the electricity meter looks like this:

The fancy display shows total kilowatt hours and maximum power consumption, but it doesn't show current consumption. Instead it has this blinking red light - the faster it blinks, the higher the power consumption. But to get the actual figure, I'd have to count how many times it blinked, measure the time and then do some arithmetic. And that would be pedestrian. Instead I wrote an application for my phone that does the measurements (with the phone's camera) and displays the current power consumption:

Here's the source code if anyone's interested.


  1. Hi...
    I have a question. I have three phase electric service connection. One of the wire of the three phase is broken. So practically I use only two phases. Recently I received a notice from the service provider saying that by not repairing the broken service line, my electricity meter is liable to show 30% less energy used. Is this a truth ? How is this possible ?

  2. Great idea! I just wrote an app for Arduino to read the same with photoresistor, but I read at 200hz for my meter's 8000imp/kwh. I guess phone camera will have a limit with more frequent flashings, what is this limit?

    1. I think the preview feed from the camera is usually 15 fps, so the limit would be pretty low compared to your solution. Probably no more than a few flashes per second, which would translate to something like 3 kilowatts max.

    2. Right, anyway the idea is cool for fun. I read your blog completely - very interesting posts, keep it up!

  3. Hi Jacek,

    Really like this idea. I have solar panels and a device called Watson which monitors my usage and generation and it is really quite inaccurate (under reads by about 10%). So, I have been thinking about building some hardware based on Arduino and the Raspberry Pi to utilise the LED lights on the meters, when I came acroos your blog.

    I was interested in the code! I've downloaded it and got it working on my Galaxy S3. It needed a small tweak as the minimum camera preview size was different and, interestingly, the meters here in the UK do 1,000 impulses per kWh rather than your 8,000.

    I've was a mainframe programmer for a bank until recently and I'm trying hard (and failing) to get into some Android phone programming. I find examples a fantastic way to get going so I really appreciate your example.

    I'm going to build on your example to do some research into the accuracy of the LED lights, on an older HTC phone, prior to embarking on the hardware side of things.

    Also, thanks for other articles I found in the blog, really liked the SimpleCV stuff.



  4. I imported this into github.


    That contains two small fixes. The one is to query the device for supported preview sizes and use the smallest one. That gets around the problem where a device might not support the specified preview size.

    I also made the flashes per kwh configurable (at least in code) as our local meters in South Africa are also more "metric", usually with 1000 flashes per kwh. That gives slightly more range as well.

    Since my own meter trips out at around 15kw (230V grid), all I need is to see 5 flashes per second, which means I need a frame rate of 10fps. I've only been messing with this for 24 hours or so and only tested it on the emulator, but I could quite easily do 4kw by "flashing" the webcam with a finger :-)

  5. I'm a total newbie. How do I compile the source code to run it on my android phone?

  6. What would prevent someone with a fake image reading fake readings instead of reading from the real meter?

  7. With these projected scarcity in supply that the state could potentially encounter in the coming months, it is expected that electric companies will increase Texas electricity rates to recoup their losses in revenues.