Page 1 of 2

Watermeter with ESP8266

Posted: Friday 11 November 2016 12:29
by juppetup
Hi,

Here some pictures of my watermeter for Domoticz. I use two CNY 70 (Reflective couplers) instead of one like in most other designs. With only one sensor you'll always get spurious pulses one day..... I use a ESP8266-01 to communicate by Wifi with Dz. So no wires between RaspberryPi and watermeter! Adjusting is made easy with two green LED's. They will light if there is reflection. A blue LED will light when a pulse is send to the ESP8266.

Image

With some logic inside a PIC i create a pulse-output which is connected to a GPIO of the ESP8266.
The ESP8266 runs ESPEasy software. I'm still able to see the readings on the meter with this shape of board.

Image

Two CNY 70 reflective sensors:
Image

Image
The board needs 5V power which can be connected via the mini USB-connector.
The watermeter has an opto-coupler output so you can connect it the way you like. For instance a Nodemcu-board. Also 5V is available on the 4-pin header. The power can also be supplied on this 4-pin header instead of the mini USB-connector.

If you want to build it yourself: send me an e-mail and i''ll send you on request the diagrams, Gerberfiles and hex-file for the PIC.

Re: Watermeter with ESP8266

Posted: Monday 14 November 2016 22:15
by sincze
Very nice design!

Sent from my SM-G925F using Tapatalk

Re: Watermeter with ESP8266

Posted: Thursday 17 November 2016 22:00
by jmleglise
Bravo !

Do you know the power consumption of your card ?
And do you think it's possible to use battery ?

Re: Watermeter with ESP8266

Posted: Thursday 17 November 2016 22:49
by sincze
Battery most of the time not ideal for this kind of meters. Or you should be very good in customising an arduino. But I am still waiting for a good solid solution. For now it is usb powered for me.

Sent from my SM-G925F using Tapatalk

Re: Watermeter with ESP8266

Posted: Tuesday 22 November 2016 9:20
by juppetup
jmleglise wrote:Bravo !

Do you know the power consumption of your card ?
And do you think it's possible to use battery ?
Hi, i do not know the exact power consumption. At the moment i don't want to switch it of because i'm testing how long the ESP8266 runs without a reboot.... 22 days now....
The ESP8266 consumes quite lot so a battery isn't a good idea. Peak current 300mA at startup! But thats only for a short period. I think +-150mA idle.

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 12:09
by juppetup
The ESP8266 runs 104 days now without any problem and has counted 48.813 liters...

Image

Domoticz V3.4834

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 12:26
by NdyGen
Could you tell me how go got domoticz to count decimals in the m3 measurement. My pulse meter sents the correct values to domotics but it seems the daily usage is rounded down.

So if I use 500 litres per day I only register 1m3 every second day.

thnx!

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 12:35
by Kubra
NdyGen wrote:Could you tell me how go got domoticz to count decimals in the m3 measurement.
In Domoticz, which value do you have under "Settings > Meter/counter > RFXMeter/Meter dividers:"?

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 13:12
by juppetup
@ NdyGen

These are my settings:

Image

My watermeter gives one rotation / liter

Domoticz V3.4834

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 13:51
by Kubra
Divider of 1000 seems ok. Setting it higher, for instance 100000, makes no difference?

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 14:03
by juppetup
1000 seems right to me: 1m3 is 1000 liter. Try and find out what happens.

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 15:01
by Kubra
What value do you get from the ESP (menu Devices)?

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 15:16
by Kubra
juppetup wrote:1000 seems right to me: 1m3 is 1000 liter. Try and find out what happens.
Sorry, I thought I was answering @ NdyGen. It works for you :lol:

BTW I myself am using a inductive proximity sensor (my water meter has a metal rotating disc). I find this design much more sturdy, no electronics involved (except for the esp) and fairly accurate (< 0,3% p/wk, mostly due to instability/reboots of the esp). I have also tried the infrared sensor but got false readings/offset all the time.

Re: Watermeter with ESP8266

Posted: Sunday 12 February 2017 18:19
by juppetup
@ Kubra

I use the V120 ESP-easy firmware and don't have any reboots at all! As mentioned, it's running non-stop for 104 days now!
With this pcb and the two reflective infrared devices i don't miss a rotation at all.

Re: Watermeter with ESP8266

Posted: Monday 13 February 2017 8:09
by NdyGen
@kubra,

thnx, that was the solution. I had the dividers in Domoticz set on 1 and did all the pulse to kwh, m3 gas/ water calculations in the script. Once I let domoticz do the math and send the raw values from the script I got fractional values.

Watermeter with ESP8266

Posted: Monday 13 February 2017 11:29
by mvzut
Nice solution juppetup!

I also have an Aquadis water meter that I connected to Domoticz. I personally use a simple TCRT-5000 infrared contrast sensor module, and don't experience any missed or double pulses (running stable more than half a year already).
Note that there are several versions of the TCRT-5000 module, I used the most simple version without a pot meter for threshold control. I tried a more "advanced" version first, but I couldn't find the right pot meter setting for it. It does involve careful fixation at the right position and angle, but I quickly found the "sweet spot" and fixed it with nothing else than hot glue.
The largest component on the picture is actually the power supply PCB, as I needed both 3.3 and 5 volts. If I would have to do it again I would probably have used a NodeMCU which can easily be powered with a micro USB adapter and supplies all the voltages.
Total cost is around 10 euros!
Image

Re: Watermeter with ESP8266

Posted: Monday 13 February 2017 21:58
by juppetup
@ mvzut

Ok, it might work but there is a change that one day the metal reflective part will stop just under the TCRT-5000 module (or edge) and you'll get many pulses!

Watermeter with ESP8266

Posted: Tuesday 14 February 2017 7:27
by mvzut
juppetup wrote:@ mvzut

Ok, it might work but there is a change that one day the metal reflective part will stop just under the TCRT-5000 module (or edge) and you'll get many pulses!
Yes, I was afraid of that myself. But this hasn't happened once since more than half a year! I guess there's some kind of debouncing function programmed in the ESPeasy code?!

Re: Watermeter with ESP8266

Posted: Friday 28 April 2017 15:32
by MaikelK
mvzut wrote:Nice solution juppetup!

I also have an Aquadis water meter that I connected to Domoticz. I personally use a simple TCRT-5000 infrared contrast sensor module, and don't experience any missed or double pulses (running stable more than half a year already).
Note that there are several versions of the TCRT-5000 module, ...........
Hi mvzut,

Im currently working on the same style-project as you.

Would you share with me your settings in ESPEasy and in Domoticz? Which counter do you us in Domoticz?

Thanks in advance!

Watermeter with ESP8266

Posted: Friday 28 April 2017 22:10
by mvzut
MaikelK wrote:Hi mvzut,

Im currently working on the same style-project as you.

Would you share with me your settings in ESPEasy and in Domoticz? Which counter do you us in Domoticz?

Thanks in advance!
I created an incremental counter using the virtual device hardware component in Domoticz. Write down the IDX it gets (check under Setup > Devices). Edit the device and tell Domoticz it is a water meter.
In ESPEasy, I added a device on the Devices tab with the following settings:

Image

Fill in the Domoticz IDX of the device you just created, and the GPIO port you connected your TCRT-5000 to. Of course, don't forget to tell ESPEasy where it can find your Domoticz system, you can do this under the Config tab. As protocol I use "Domoticz HTTP".
I think this was it. It's already a while ago I set this up, can't exactly remember if there were more steps involved.