Water meter ESPeasy Wemos TCRT5000 WIFI

Everything about esp8266 and more.
Post Reply
User avatar
JHO01
Posts: 28
Joined: Wednesday 02 November 2016 14:59
Target OS: Raspberry Pi
Domoticz version: 49700
Location: Netherlands
Contact:

Water meter ESPeasy Wemos TCRT5000 WIFI

Post by JHO01 » Monday 09 July 2018 16:44

With the help of this forum and many other sources I build a water meter.
In this post I want to share my build.

Hardware:
-water meter (see picture)
wm.jpg
wm.jpg (144.05 KiB) Viewed 824 times
-infrared sensor to pick up the rotation of the small red/silver wheel : TCRT5000 Infrared Sensor (Aliexpress)
-Wemos D1 Mini
-connect TCRT5000 VCC=>5V (Wemos), TCRT5000 GND=>G (Wemos), TCRT5000 D0=>D5 (Wemos)
-align the sensor on the rotating wheel and adjust the TCRT5000 sensitivity; make sure the led turns on/off when the wheel rotates

Software steps:

Domoticz:
-Create Virtual Sensor, General Counter Incremental,; note IDX
-Settings, Meters/Counters, RFXMeter/Counter Dividers: Water 100000 (each Rotation/pulse is 1 Liter)
-Utility, select the just created water meter and Edit: set the Meter Offset to the already consumed M3 according to the original meter.

Wemos:
-Flash Wemos with ESPeasy

ESPEasy:
-Config: Connect to your wifi network
-Controllers: Connect to your Domoticz HTTP or Domoticz MQTT
-Devices: Generic - Pulse counter, !st GPIO-14 (D5), Debounce Time 100, Counter type Delta, Mode type CHANGE, send to Controller use IDX from above created counter; make sure that both Device and send to controller is enabled.

Done
RPI-3, Z-stick Gen5, RFlink, 1-wire DS18B20, Fibaro switches, various RF-433 sockets, , BMP018

User avatar
sincze
Posts: 962
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by sincze » Tuesday 10 July 2018 21:05

:D nice one.

I hope it will be stable. As I've seen a faire share of false interrupts generated by the TCRT-5000. (especially when the reflecting part is on the 'edge' .
I can confirm it works as I've had to build my own application for it to get my sensor stable since 2014.
Recently I switched to an NPN watermeter and ESP, just to give it a try.

Why not add a flow meter as well in your ESP settings (rules), so you can see the actual usage per minute?
Waterflow.JPG
Waterflow.JPG (39.71 KiB) Viewed 790 times
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

User avatar
JHO01
Posts: 28
Joined: Wednesday 02 November 2016 14:59
Target OS: Raspberry Pi
Domoticz version: 49700
Location: Netherlands
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by JHO01 » Tuesday 10 July 2018 23:14

Why not , do you mind sharing the code for the rules?
RPI-3, Z-stick Gen5, RFlink, 1-wire DS18B20, Fibaro switches, various RF-433 sockets, , BMP018

User avatar
sincze
Posts: 962
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by sincze » Wednesday 11 July 2018 20:30

JHO01 wrote:
Tuesday 10 July 2018 23:14
Why not , do you mind sharing the code for the rules?
Sure.

Code: Select all

On System#Boot do     							// When the ESP boots, do
   TaskValueSet 4,1,0							// TaskValueSet TASKnr,VARnr,Value, Reset the Liters counter to 0
   TaskValueSet 4,2,0							// Previous Counter used for memory 
   TimerSet,1,60      								// Set Timer 1 for the next event in 60 seconds
EndOn
 
On Watermeter#Count do						// When Pulse is detected
	if [Watermeter#Count] > 0
		TaskValueSet 4,1,[Watermeter#Count]		// Set the Pulse to the Liters dummy sensor
	endif
EndOn

on Rules#Timer=1 do  							// When Timer 1 expires, do
	if [Liters#Liters] > 0 or [Liters#Previous] > 0		// Only send value if amount of Liters > 0 else 'keep the change ;-)'
		SendToHTTP 192.168.***.***,8080,/json.htm?type=command&param=udevice&idx=****&nvalue=0&svalue=[Liters#Liters]
		TaskValueSet 4,2,[Liters#Liters]
		TaskValueSet 4,1,0						// TaskValueSet TASKnr,VARnr,Value, Reset submitted Liters counter to 0
	endif
	TimerSet,1,60      							// Set Timer 1 for the next event in 60 seconds
endon
Remember that you need an additional device to do the counting!
Wemos_Domoticz.JPG
Wemos_Domoticz.JPG (63.74 KiB) Viewed 744 times
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

freijn
Posts: 379
Joined: Friday 23 December 2016 17:40
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands Purmerend
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by freijn » Wednesday 11 July 2018 22:10

JHO01 wrote:
Monday 09 July 2018 16:44
-Settings, Meters/Counters, RFXMeter/Counter Dividers: Water 100000 (each Rotation/pulse is 1 Liter)
Are you sure it must be 100000 ? I believe it must be 1000

Cheers,

Frank

User avatar
heggink
Posts: 540
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by heggink » Thursday 12 July 2018 9:25

I tried for ages to get the tcrt to work but dropped it for the inductive sensor because of the false positives when it gets stuck on an edge. Never happens with the inductive sensor.
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

freijn
Posts: 379
Joined: Friday 23 December 2016 17:40
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands Purmerend
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by freijn » Thursday 12 July 2018 9:44

Heggink

I noticed , during my experiments, that the position of the sensor is EXTREEM sensitive.

I ended printing a cap around the meter, with a larger hole in it for the sensor. The printed a circle around the sensor and glue the sensor on the
correct place experimenting the best posistion and best response. Till now, works fine.

My "biggest" worrie.. if the water company comes to read the meter visible output. My sensor needs to be removed and I have to start the
process again :-(

Cheers,
Frank

User avatar
sincze
Posts: 962
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by sincze » Thursday 12 July 2018 11:21

freijn wrote:
Wednesday 11 July 2018 22:10
JHO01 wrote:
Monday 09 July 2018 16:44
-Settings, Meters/Counters, RFXMeter/Counter Dividers: Water 100000 (each Rotation/pulse is 1 Liter)
Are you sure it must be 100000 ? I believe it must be 1000

Cheers,

Frank
I guess you are right.
Meters.JPG
Meters.JPG (14.27 KiB) Viewed 695 times
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

User avatar
JHO01
Posts: 28
Joined: Wednesday 02 November 2016 14:59
Target OS: Raspberry Pi
Domoticz version: 49700
Location: Netherlands
Contact:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Post by JHO01 » Thursday 12 July 2018 19:45

-Settings, Meters/Counters, RFXMeter/Counter Dividers: Water 10000 (each Rotation/pulse is 1 Liter ,typo sorry

-No false positives so far, perhaps because a used a piece of wood to attach the TCRT. this is then placed on top of the water meter without glue. This minimises the optical IR errors.
WhatsApp Image 2018-07-12 at 19.35.24.jpeg
WhatsApp Image 2018-07-12 at 19.35.24.jpeg (197.2 KiB) Viewed 675 times
RPI-3, Z-stick Gen5, RFlink, 1-wire DS18B20, Fibaro switches, various RF-433 sockets, , BMP018

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest