Files describe how to move towards smart home and make readout system  for energy and water meters.

- Optical sensor reading out Electricity meter disk. Works well. Live at http://barbara320.gotdns.com:8083/

- Webcam picturing hot water meter. LCD screen contrast too low for OCR.

- Control of hot water supply valve using Arduino and servo motor.

- Webcam picturing  cold water meter. OCR or optical readout sensor will come.

Please have a look at  system live here:

<p>I have previously tried to read the water meter using a phototransistor and a IR diode, but have not managed to get it hundred percent stable.</p><p>Instead, I have now used a little more technically challenging solution but it works perfect.</p><p>I use a webcam and calculates one of the dialers position and movements.</p><p>The solution consist of:</p><p>- A webcam with USB connection.</p><p>- Two white LEDs. Used to have a constant uniform illumination of the meter.</p><p>- A Raspberry Pi with some image processing software.</p><p>I have adapted this opensource software <a href="http://www.cl.cam.ac.uk/downloads/freshers/image_processing.tar.gz" rel="nofollow">http://www.cl.cam.ac.uk/downloads/freshers/image_p...</a> to my camera and this specific application.</p><p>The Raspberry Pi is managing to read and process approx 10 frames per second. I have defined four zones in the image and keeps track of when these zones goes from light to dark when the dial passes. My dial makes one revolution per liter of water so it will be a resolution of 0.25 liters.</p><p>Attached is it a couple of pictures and a video that shows how it looks like in practice.</p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/UUX_kbjbVP4" width="500"></iframe>&quot; frameborder=&quot;0&quot; allowfullscreen&gt;</p>
Hello Goran!<br><br>You made a great comment and demonstration. It could become a popular instructable, if you publish it in Instructables.<br><br>Thanks for the image processing link. I will look at it closer how to use and compile it. And would be happy to get some help from you if get stuck. <br><br>I am presently experimenting with dust in air sensing using strong laser light that is scatered by dust and photographed by a webcam. Image recognition would be needed to count bright spots. http://www.element14.com/community/community/design-challenges/in-the-air-design-challenge/blog/2014/12/07/in-the-air-challenge-beagle-bone-black-counting-dust-with-a-webcam<br>
Thank you for your instructable. My electricity meter readout system works pretty good now.<br> <br> List of used parts:<br> + IR reflection light sensor MRL601<br> + transistor 2N2222<br> + breadboard, some resistors, LED, clamps, wires, ...<br> + mini WLAN router T-Link TL-MR3020<br> + USB hub with integrated micro SD card reader<br> + micro SD memory card<br> <br> The CNY70 light sensor couldn't recognise the red mark on the wheel. Although expensive the MRL601 sensor does this very well if it is mounted in a certain angle. I copied the OpenWrt installation to the SD card (extroot) to have more available memory. My code is written in python. I dropped the debounce check which seems not to be necessary here. RRDtool rocks!
hello mr fxspaet...your electricity meter readout system how its work can explain about it or if u can give a document ? what are the thinks need to do this system? please help me ....
Thanks for sharing info about what you use. <br> <br>Python is a nice language but of course needs much space. I got a problem with SD card after some 3 months. Ca 150k write cycles. And now send data away (without writing to SD) to some real server with a HDD. <br>Writing in RAM is OK. and creating rrdtools plots in RAM is OK. <br> <br>Unfortunately, I could not figure out how to save absolute meter readings. (Arduino counter values are lost after power reset). Arduino has EEPROM but it has limited write cycles. May be could save not every turn but once a full kW is used.
I played around with RRDtool and found a solution to get absolute (or cumulative) meter readings saved and plotted. Let me sketch it here.<br> <br> The Python script running on TL-MR3020 creates a second data base cumulative.rrd:<br> <br> def midnight():<br> &nbsp;&nbsp;&nbsp; ts = datetime(1970, 1, 1)<br> &nbsp;&nbsp;&nbsp; t = datetime.utcnow()<br> &nbsp;&nbsp;&nbsp; td = datetime(t.year, t.month, t.day) - ts<br> &nbsp;&nbsp;&nbsp; return int(td.total_seconds())<br> <br> def createCumulativeRrd():<br> &nbsp;&nbsp;&nbsp; rrd = RRD('cumulative.rrd',<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # heartbeat: at 20 watt it takes 2400 seconds for 1 revolution<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 75 rev/kWh * 0.02 kWh = 1.5 rev/h<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3600 sec/h / 1.5 rev/h = 2400 sec/rev<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2400 sec/rev * 1 rev/update = 2400 sec/update = 40 min/update<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ds = [DataSource(dsName = 'revolutions', dsType = 'GAUGE', heartbeat = 2400)],<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # steps: take 6 steps to calculate 1 new data point in archive<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 600 sec/step * 6 step/point = 1 h/point<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # rows: store data points in archive for a maximum of 366 days<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 h/point * 1 point/row * 8784 row/archive = 366 day/archive<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rra = [RRA(cf = 'LAST', xff = 0, steps = 6, rows = 8784)],<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; start = midnight() - 10,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # calculate a step every 10 minutes = 600 seconds<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; step = 600)<br> &nbsp;&nbsp;&nbsp; rrd.create()<br> &nbsp;&nbsp;&nbsp; return rrd<br> <br> Remaining Python code which cummunicates with Arduino board and filles in data bases is omitted here for brevity. It resets the counter at midnight which is useful for plotting later.<br> <br> The following shell script plot-cumulative-daily.sh plots the graph:<br> <br> #!/bin/sh<br> <br> # first argument specifies the number of days in the past and is optional<br> if [ -z &quot;${1}&quot; ]<br> then<br> &nbsp;&nbsp;&nbsp; # for today<br> &nbsp;&nbsp;&nbsp; offset=&quot;&quot;<br> else<br> &nbsp;&nbsp;&nbsp; # for number of days in the past<br> &nbsp;&nbsp;&nbsp; offset=-${1}days<br> fi<br> <br> # date formatted as YYYY-MM-DD<br> day=$(date -d &quot;today0${offset}&quot; +%F)<br> <br> # delete old image<br> rm -f cumulative-daily-${day}.png<br> <br> # calculate time range in whole days<br> start=$(date -d &quot;today0${offset}&quot; +%s)<br> end=$(date -d &quot;today0+24hours-1secs&quot; +%s)<br> <br> # create new image from RRD file<br> # + scale image to 1600 x 800 px<br> # + put title on top<br> # + left scale is kWh (kilo Watt hour)<br> # + bottom line is always at 0<br> # + plot data between this time range<br> # + fetch data from RRD file and name it rev (revolutions)<br> # + create new data points kWh: 75 revolutions are 1 kWh<br> # + draw kWh using a 2 px thick line in red color<br> rrdtool graph cumulative-daily-${day}.png \<br> &nbsp;&nbsp;&nbsp; --width 1600 --height 800 --full-size-mode \<br> &nbsp;&nbsp;&nbsp; --title &quot;Electricity Consumption - Cumulative For Each Day - Starting At ${day}&quot; \<br> &nbsp;&nbsp;&nbsp; --vertical-label &quot;kWh&quot; \<br> &nbsp;&nbsp;&nbsp; --lower-limit 0 \<br> &nbsp;&nbsp;&nbsp; --start=${start} --end=${end} \<br> &nbsp;&nbsp;&nbsp; DEF:rev=cumulative.rrd:revolutions:MAX \<br> &nbsp;&nbsp;&nbsp; CDEF:kWh=rev,75,/ \<br> &nbsp;&nbsp;&nbsp; LINE2:kWh#FF0000<br> <br> # display image on desktop<br> feh cumulative-daily-${day}.png<br> <br> Have fun! :)
Liked a lot your idea for cumulative representation of daily data. Then can immediately see which day used more current.
Well, you're right. Python requires lots of RAM. However it is a powerful tool and apparently the TL-MR3020 box has enough RAM for running Python.<br> <br> Thank you for the hint about the wear out of SD cards. Hence I reduced the writes to the SD card. Fortunately the PyRRD wrapper supports data buffering already. Now the Python script buffers the data for one kilowatt in RAM till it updates the RRD archive file in flash memory of the SD card.<br> <br> (Sorry for answering here but the captcha in the Reply section didn't work...)
Here are some info how to use tesseract to OCR only numbers: <br>http://code.google.com/p/tesseract-ocr/wiki/FAQ#How_do_I_recognize_only_digits? <br> <br>Cheers, <br>Valent.
I took photos of my gas meter and then tested all ocr engines that I could find, after doing that I got to my conclusion.
After doing some research I found out that best OCR engines on Linux are tesseract and gocr
Can't wait for OCR part!

About This Instructable




Bio: I am a researcher working on development of optical atomic clocks. Electronics is my hobby since childhood when my uncle was bringing me old phones ... More »
More by janisalnis:Arduino Webservers Ethernet ENC28J60 with thermometer DS18B20, I2C LCD and Power Over Ethernet POE  for ZABBIX IOT data logging Mini-spectrometer From a DVD and Folded Paper 1 single digit Nixie clock  
Add instructable to: