Home voltage monitoring (using OCR)
The goal of this small project is to monitor my home voltage using a voltmeter and a webcam. There are better ways to interface a voltmeter with your computer and here's two techniques that I wish to cover in future projects:
- Interface in serie with the multimeter micro controller using an opto-isolator
- Build a custom voltage detection device
- A computer that is always on (I will use a raspberry pi)
- A digital multimeter (ideally with a backlight, otherwise plan external lightning)
- A webcam
- A SPDT relay if you want to monitor two circuits (Eg X and Y on split-phase supply)
How it works
I originally did this project using my multimeter but the auto-off feature was triggered even if there was power on the test leads... I eventually got this project working using a kill-a-watt
. Unlike the multimeter, the KAW doesn't need an external power supply for continuous usage and we can monitor anything the kill-a-watt can report (Amperage or Power for example).
2. Display lightning
The kill-a-watt lacks a backlight but its power plug was ideal to connect a LED night light with the light "dissipator" removed.
3. Image capture
I attached a cheap webcam
to the kill-a-watt using card board and white paper to reflect light(It increased the contrast dramatically).
4. Data collecting
I hooked the webcam to a raspberry pi
running linux. The raspberry pi also controls the relay(JZC-11F
) for monitoring two circuits. The capture is done with a tool called fswebcam and the "dumb" OCR is implemented in PHP. Lighttpd allows remote voltage querying. I use my remote munin machine to create graphs (using ocr.php?silent=1).
Fswebcam is actually called by the OCR php script in this way:
fswebcam -r 160x120 -S 10 --jpeg 95 --set sharpness=15 --set contrast=60% --set brightness=50% --set "White Balance Temperature"=0 --no-banner --save /tmp/power.jpg
5. The OCR
I tried several tools for that (like SSOCR) but for some reason they all failed to detect the digits on my snapshots. I ended up writing a small php script that compares several points to a reference. In other words it will detect if a segment is on or off on a 7-segment display type.