Tried googling first but could not find any interesting hits relevant to what i am looking for.

The wild idea is to put a camera in front of an energy meter or watt meter display and read the accumulated total in the display, and process it down to digital information like an integer or a float that i can save. It might be enough to capture a still, crop the image and do some ocr-like operation.

Energy meter example

The advantage over monitoring pulses is that You would keep track of the actual meter total, not a forever running incremental.

I'm looking for suggestions and ideas and if anyone have experience of solving similar problems. Pointers to software or libraries appreciated. I know there are posts about bar code reading, but that is not matching my needs.


4 Answers 4


I recently used Tesseract which is an OCR software that's open source and it gives highly accurate results.

To install it on pi, type in the command line:

sudo apt-get install tesseract-ocr

Then set a camera to periodically take pictures preferably using Cron (which schedules tasks) and fswebcam (takes pictures using USB cams) Save the pictures in a special directory and set (also using Cron) Tesseract to extract the text from the pic and output the text in a separate .txt file. Deal with the extracted text according to your preferences.

I know I didn't offer much but I hope I've given some general pointers


Assuming you are able to store the image somewhere, that you can setup Python's PIL dependencies, and have pytesseract you'll need : https://github.com/madmaze/pytesseract

open and crop the image so that only interesting data remains : http://matthiaseisen.com/pp/patterns/p0202/

then try something like :

import pytesseract
import Image
img = Image.open(path_to_your_file)
cropped = img.crop( ... )
pytesseract.image_to_string(cropped, config='outputbase digits')

I understand that link-only answers are really not the way of StackExchange, but this page is too good a fit to this question to not point to it. This tutorial completely covers all aspects of relevance to capture the image and use OpenCV on a Pi process the image to read the value of the electricity meter.

Side note: if you do not want to use a Pi on this, try an ESP32.

  • All great pointers. The mathematica tip is partially interesting, the emeocv is a complete solution. I might have failed to explain that i already have an application with a web interface saving statistics in a database and display real time data from my meter. I will get the emeocv and see if i can get the parts of it working that i need. If the tag 'OCR' would have been allowed i could have found this myself.
    – chgus
    Feb 15, 2016 at 6:38

I used a photoresistor to monitor the led blinking and count the blinkd using interrupt when it goes low. It works very well. I of course had to manually tell the beaglebone the starting number of the meter and then it just continues to count. BOM beaglebone/raspberry/arduino photoresistor resistor and three wires.

My kamstrup meter blinks a led for every watt consumed. I can then calculate Wh by measuring the seconds and milliseconds between the blinks. It works better than I thought. I feed that data into openhab and elasticsearch so I have perfect overview of my energy consumption at any time amongs other things.

  • if there is downtime, your counter is out of sync with the energy meter! Feb 19, 2020 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.