Water meter selfmade

In my house I measure all kind consumables (electricity, heating energy, …). Only the water consumption was missing up to know, due to the analog nature of my water meter / water clock.

Update 23.02.2020: Meanwhile a graphical WYSIWYG tool is available to support the setup of the server (extract reference images, ROIs, parameters, …):
http://wasserzaehler.ignorelist.com
It is still in beta state, therefore I kindly ask for feedback and a bit patience.

I have developed a selfmade solution, that works fine and reliable and I want to share it with the community for house automatiziation and controll, in order to get into discussion and further input for improvements.

The systems relies on a camera with ESP822-controller, which regularly takes an image of the water meter / water clock. This image is going through an automated image processing, which digitalizes the counter value and provides it in a simple http-server, that can than be transfered to any database for further processing:

The compoments for the signal chain shown above are published on Thingiverse (Hardware) or Github (Software, server, …). There you find the software for image processing, 3D-print files and electrical configuration of the camera system including lightning:

Looking forward to your feedback and questions.

Best regards,

Jomjol!

18 Likes

That looks like a complex setup. Nice work! If i understand it right, all the work is done on the esp (images, cutting, ocr etc). The ESP webservice would be the (poll) interface for openHAB or other system? If so, it could be improved to have the webservice let you subscribe to it or make the webservice also publish to MQTT (or both)

Do you have an idea about the power consumption for the whole unit (per day?) and how accurate is it?

Hello Isiepel, the system is separated into to parts: taking the image is indeed running on an ESP8266, which provides the image from a very simple web server.
The image processing itself (cutting, OCR, …) is done on a server running with ubuntu. But can be done with any system that support node.js.
I have no idea about the power consumption, as I am running the ESP8266 with a USB-power supply and the server is a virtual one on a NAS-station.
Accuracy is pretty good, the water meter has a resolution of 0.1liter, basically thats the resolution. You can take an image basically each second. I do it only every 10 minutes, as a family house is not consuming too much water.

Oh it’s not the simplest approach but I do like it alot!

This could be used for any meter. I have a different style of water meter then you which has an output to an external meter (it’s a read switch basically) so the water company can read the meter from outside. I was going to tag onto this connection but I think I might give this a stab now.

Worst case I might use your solution in conjunction with the pulses per x amount as I was going to use an esp8266 anyway. I do have an esp32-cam module I’ll try it out on that as I see you have uploaded an untested code.

I would be interested, if the ESP32 code is working, as I cannot test it and had several questions about it.

Well tomorrow it my 2 year anniversary with the better half, I think if I don’t spend the day with her it could damage the WAF, but I’ll get a look Friday/Saturday.

@jomjol Well i finally got to sit down and take a look, Your ESP32 code compiled and uploaded with no issues, i get the following serial output:

Connected to Infected Network
IP address: 192.168.0.174
ArduCAM Start!
SPI1 interface Error!

I’m guessing its going to be down to the defining of the pins? I did take a look through your code but couldn’t see anything that looks like pin definitions (i might have missed it).

I uploaded this as a test for testing and it is working fine on my hardware.

The errors tells, that the connection to the camera through the SPI-interface is not working. My code will only work with the OV2640, that has the SPI-interface as seperat chip on the board.
If you have the ESP32-CAM, then this has a different communiction interface towards the ESP32. This means, that you have to adapt the part of my software, where the JPEG is send to the web server. This is done within the Code JomjolGitArduCAMComm.cpp.

There are more people, who want to use the ESP32-CAM for this, so I decided to order one and test, if I can offer a modified code soon

Sounds good.

I’ll take a look but i think it might be beyond my capabilities (but i’m always willing to try expand those).

In the mean time if you want me to test any code i’m happy to help, i’m guessing your’s is on the slow boat from china.

I bought it at Amazon, so should be faster than shipping from China. Never the less, I
'm on holiday with family and kids. Don’t know if this gives me more or less time :wink:.

Hi rsemmens,
got yesterday my ESP32Cam (AI-Thinkerboard with OV2640) and did a first code adaption. First draft is working, but this is still very early Beta - so LED-Light not correct implemented, Picture size not adjustable, …
Never the less, loaded a first Beta version uncommented to Github:
https://github.com/jomjol/water-meter-picture-provider/tree/master/ESP32CAM_Server-GitHub_v0
Feel free to test. Now I am on holiday, maybe I find some time to adjust the other topics.
Best regards, jomjol

That’s great, I’ll test it Saturday.

I’m back at work after a week off, didn’t get anywhere near done what I wanted!

What a cool system! Very nicely done!

Does your water company care that you’ve put a thing over the meter? Do they read it, and is your camera in the way?

Where is your meter located? Is it indoors? Mine’s outside in a hole in the ground that fills with rainwater, bugs, moss, etc…

Really cool idea, though! And, as others have said, the image processing idea should work with any mechanical meter. I really like how you’ve lit it evenly for better image recognition.

Well done!

Thanks for the great feedback!

The holder is just put over the meter. There is no fixation or mechanical change at the meter necessary, it is just clamped on top. So you can take it away in a second. To read it by hand or by the water company you need to take it away, but as the alignment is correcting for small angle mismatch, it is very robust on taking off and on.

My water meter is indoor in the basement, so no problem with water, bugs, … and electrical power is also available.

Could you perhaps document which libraries you are using in your ArduinoIDE ?

I am trying to integrate the build with PlatformIO for hands-off automated building, and am not really sure that I have the right ones identified yet.

What I have so far is the list below, and I still cannot get everything to compile, the latest error being something about a DynamicJsonBuffer…

lib_deps =
    Adafruit NeoPixel
    Basecamp
    Esp8266Configuration
    WiFi

I have installed a lot for different projects. For the ArduCam-Server I think I’m using:

  • ESP8266
  • Adafruit NeoPixel
  • ArduCam (not installed, just included)
  • Wifi, WifiClient, WebServer (comming with ESP8266)
    This DynamicJsonBuffer Problem is new to me and I’m not using this kind of function explicitly

I´m from germany, can i get the printed cam housing from anywhere? Is there a service which will print me this things from your thingiverse page and will send it to me?

Can you post a list with links to all the needed parts, cam and so on? Maybe amazon.de links or aliexpress?

I´m a hardwarenoob, so the software-part will not be the big problem, only the hardware part is a little problem for me.

Hallo halloween,

ich habe das Gehäuse selbst gedruckt. Du kannst es aber auch bei vielen Internet-Shops drucken lassen. Geht aus Thingiverse heraus sogar direkt - glaube ich.

Als Hardware habe ich folgende Komponenten:

Kamera: https://www.watterott.com/de/2MP-Mini-Kamera-Board-OV2640

NodeMCU Mini: https://www.amazon.de/AZDelivery-D1-Mini-ESP8266-12E-kompatibel/dp/B01N9RXGHY

Rest in zweiter Mail, da nur 2 Links möglich

LED-Strips: https://www.ebay.de/itm/WS2812B-LED-Streifen-5m-WS2812-RGB-Licht-SMD-5050-Individuell-Adressierbar-DC5V/173334927277?hash=item285b9117admL5dpT_Qf14xUwIDImuRHYQ&var=472045414448

Vor allem die Kamera ist recht teuer. Da gibt es mit dem ESP32-CAM inzwischen viel billigere Lösungen (China: < 5 EUR). Dazu muss man aber die Software und auch das Gehäuse anpassen. Software ist in Arbeit, braucht eine andere Ansteuerung der Kamera, da anders angebunden - geht prinzipiell schon (siehe GitHUB), Feinanpassung (z.B. LED-Ansteuerung) noch notwendig.

Gruß,

jomjol

1 Like

What a clever, non-intrusive solution!

Bravo! :smiley: