# Water meter selfmade

**URL:** <https://community.openhab.org/t/water-meter-selfmade/79270>\
**Category:** DIY\
**Created:** [August 4, 2019, 1:47pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270 "2019-08-04T13:47:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 4, 2019, 1:47pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/1 "2019-08-04T13:47:10Z")

</div>

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](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:

 ![overview_ESP32-CAM](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/d/bd071e79e03662b02b29aca1107189169885d49b.jpeg)

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:

- **System overview** : [GitHub - jomjol/water-meter-measurement-system](https://github.com/jomjol/water-meter-measurement-system)
- Docker Image for image processing and automated readout: [jomjol/wasserzaehler - Docker Image](https://hub.docker.com/r/jomjol/wasserzaehler)
- WYSIWYG setup tool: [http://wasserzaehler.ignorelist.com](http://wasserzaehler.ignorelist.com)

Looking forward to your feedback and questions.

Best regards,

Jomjol!

---

<div class="post-metadata">

**Author:** ![lsiepel](https://community.openhab.org/user_avatar/community.openhab.org/lsiepel/32/17435_2.png) [@lsiepel](https://community.openhab.org/u/lsiepel)\
**Post date:** [August 6, 2019, 11:05am UTC](https://community.openhab.org/t/water-meter-selfmade/79270/2 "2019-08-06T11:05:48Z")

</div>

> [@jomjol](#):
>
> here you find the software for image processing, 3D-print files and electrical configuration of the camera system i

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?

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 6, 2019, 5:15pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/3 "2019-08-06T17:15:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rsemmens](https://community.openhab.org/user_avatar/community.openhab.org/rsemmens/32/36362_2.png) [@rsemmens](https://community.openhab.org/u/rsemmens)\
**Post date:** [August 6, 2019, 11:53pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/4 "2019-08-06T23:53:07Z")

</div>

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](https://banggood.app.link/36WjgrCCWY) module I’ll try it out on that as I see you have uploaded an untested code.

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 7, 2019, 5:46pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/5 "2019-08-07T17:46:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rsemmens](https://community.openhab.org/user_avatar/community.openhab.org/rsemmens/32/36362_2.png) [@rsemmens](https://community.openhab.org/u/rsemmens)\
**Post date:** [August 8, 2019, 12:26am UTC](https://community.openhab.org/t/water-meter-selfmade/79270/6 "2019-08-08T00:26:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rsemmens](https://community.openhab.org/user_avatar/community.openhab.org/rsemmens/32/36362_2.png) [@rsemmens](https://community.openhab.org/u/rsemmens)\
**Post date:** [August 10, 2019, 10:50pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/7 "2019-08-10T22:50:48Z")

</div>

@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:

```csv
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](https://github.com/lewisxhe/ESP32-Camera-Arduino) as a test for testing and it is working fine on my hardware.

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 11, 2019, 11:46am UTC](https://community.openhab.org/t/water-meter-selfmade/79270/8 "2019-08-11T11:46:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rsemmens](https://community.openhab.org/user_avatar/community.openhab.org/rsemmens/32/36362_2.png) [@rsemmens](https://community.openhab.org/u/rsemmens)\
**Post date:** [August 11, 2019, 9:53pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/9 "2019-08-11T21:53:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 12, 2019, 7:03pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/10 "2019-08-12T19:03:17Z")

</div>

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 😉.

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 15, 2019, 8:21pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/11 "2019-08-15T20:21:21Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![rsemmens](https://community.openhab.org/user_avatar/community.openhab.org/rsemmens/32/36362_2.png) [@rsemmens](https://community.openhab.org/u/rsemmens)\
**Post date:** [August 15, 2019, 9:37pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/12 "2019-08-15T21:37:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Laufeyjarson](https://community.openhab.org/user_avatar/community.openhab.org/laufeyjarson/32/72516_2.png) [@Laufeyjarson](https://community.openhab.org/u/Laufeyjarson)\
**Post date:** [August 15, 2019, 9:42pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/13 "2019-08-15T21:42:26Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 16, 2019, 6:12pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/14 "2019-08-16T18:12:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hakan](https://community.openhab.org/user_avatar/community.openhab.org/hakan/32/70815_2.png) [@hakan](https://community.openhab.org/u/hakan)\
**Post date:** [August 19, 2019, 4:50pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/15 "2019-08-19T16:50:59Z")

</div>

> [@jomjol](#):
>
> Feel free to test. Now I am on holiday, maybe I find some time to adjust the other topics.

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

I am trying to integrate the build with [PlatformIO](https://platformio.org/) 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

```

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 19, 2019, 8:58pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/16 "2019-08-19T20:58:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![halloween](https://community.openhab.org/user_avatar/community.openhab.org/halloween/32/7493_2.png) [@halloween](https://community.openhab.org/u/halloween)\
**Post date:** [August 22, 2019, 11:25am UTC](https://community.openhab.org/t/water-meter-selfmade/79270/17 "2019-08-22T11:25:55Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 22, 2019, 7:22pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/18 "2019-08-22T19:22:39Z")

</div>

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: [Watterott electronic](https://www.watterott.com/de/2MP-Mini-Kamera-Board-OV2640)

NodeMCU Mini: [Amazon.de](https://www.amazon.de/AZDelivery-D1-Mini-ESP8266-12E-kompatibel/dp/B01N9RXGHY)

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

---

<div class="post-metadata">

**Author:** ![jomjol](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jomjol](https://community.openhab.org/u/jomjol)\
**Post date:** [August 22, 2019, 7:23pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/19 "2019-08-22T19:23:19Z")

</div>

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](https://www.ebay.de/itm/WS2812B-LED-Streifen-5m-WS2812-RGB-Licht-SMD-5050-Individuell-Adressierbar-DC5V/173334927277?hash=item285b9117ad:m:mL5dpT_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

---

<div class="post-metadata">

**Author:** ![TRS-80](https://community.openhab.org/user_avatar/community.openhab.org/trs-80/32/55718_2.png) [@TRS-80](https://community.openhab.org/u/TRS-80)\
**Post date:** [August 22, 2019, 7:29pm UTC](https://community.openhab.org/t/water-meter-selfmade/79270/20 "2019-08-22T19:29:51Z")

</div>

What a clever, non-intrusive solution!

Bravo! 😃

[Next page](https://community.openhab.org/t/water-meter-selfmade/79270.md?page=2)
