Page 1 of 1
Water flow sensor YF-S201C
Posted: 17 Jun 2018, 17:18
by olleman
Hello!
I'm wondering wether this sensor could be used with the pulse logic plugin i n EspEasy? My concern is that it will output roughly 450 pulses/litre of water and I'll have flows of up tp 10 litres/min. Will the hardware be able to coop with all these pulses?
https://www.aliexpress.com/item/Free-sh ... 3b59SZFNZE
Btw, the application is to monitor water usage in the water tank in my boat, thus giving me a good read on what's left in the tank.
Regards, Olle
Re: Water flow sensor YF-S201C
Posted: 17 Jun 2018, 18:02
by grovkillen
Shouldn't be a problem I think, but is that value even reasonable? I mean 450 pulses per liter is 2.2mL per pulse.
Re: Water flow sensor YF-S201C
Posted: 17 Jun 2018, 22:46
by olleman
Thanks for your quick reply. The specification says:
Flow Pulse: F(Hz)=(5.0*Q)±3% Q=L/Min
So, at 6 L/Min 30 pulses each second, right?
Does espeasy send each pulse to domoticz or does it buffer it somehow and send it like once every second or whatever? Seems like a lot to send 30 pulses each second but what do I know:)
Re: Water flow sensor YF-S201C
Posted: 17 Jun 2018, 23:07
by grovkillen
Yes it's a counter thus only publish on given interval.
Re: Water flow sensor YF-S201C
Posted: 18 Jun 2018, 08:23
by olleman
Cool , thanks!
Does anybody know of a way to measure the volume in a tank, preferably with Domoticz? The ideal case would be to be able to set the tank level to a certain volume eg. 100l and with the flow sensor withdraw volume from it. When I refill the water tank I would also need to "reset" or "fill" the tank again.
Re: Water flow sensor YF-S201C
Posted: 15 Jul 2018, 16:02
by Wiki
Hi,
I am thinking of a quite similar project, water level in freshwater tank in my caravan. I have already ordered this one
https://www.aliexpress.com/item/GY521-G ... 4c4dQ4NTx1 to get the level of the water.
Due to lack of time I didn't got far with the project right now. But at random I had found this project
http://www.ispindel.de/docs/README_en.html in the past. So it may be possible to get accurate readings of the water level using a float in the tank by measuring the angle and calculating the remainig volume.
Re: Water flow sensor YF-S201C
Posted: 16 Jul 2018, 20:28
by Shardan
As the flow sensors are cheap nowadays how's about using two of them?
One for fillup ond one for draining?
Just an idea i got while reading the post.
Re: Water flow sensor YF-S201C
Posted: 17 Jul 2018, 16:21
by waspie
As an alternative idea:
I'm using a pulse counter in one application but I didn't want so much data flowing so often to openhab over mqtt.
I used a trinket to do the detection (or you could use it to do the math) and then turn a digital pin on/off when it met a given threshold. I then picked up this high/low with espeasy as a switch and sent that over mqtt instead.
Say, use the trinket to count pulses and every time they add up to a liter ( or 2, or 5?) it could switch a leg on and off. Then espeasy would send that 1/2/5 liters has been used. That way your traffic is much less and less likely to get lost.
I don't know if this would be applicable for situation but maybe?
Re: Water flow sensor YF-S201C
Posted: 05 Aug 2018, 22:30
by Drum
something like this might work
https://www.adafruit.com/product/464
If there is a chance of an overflow (pump on too long) I suggest a tried and true analog automatic shut off float switch.
Re: Water flow sensor YF-S201C
Posted: 09 Aug 2018, 15:38
by olleman
Thanks for all your input. I have actually made a prototype with domotitcz and dZvents script to make something that might just work. The link to the code is here:
https://www.domoticz.com/forum/viewtopi ... 70#p184370 last post.
In the meantime I finally got my flow sensor delivered but I can't get it going. I'm getting nothing. I'm using a Wemos d1 and connect VCC to 5V, GND-GND and SIGNAL to D6 and I have also tried D7. I use pulse counter in ESPEasy but I haven't recorded one single pulse, it's "dead". I'm not good with electronics but I've tried a pull-up of 10K between VCC and SIGNAL and that didn't change anything. Any ideas how to connect this or how I can investigate if the sensor somehow was broken on delivery?
Re: Water flow sensor YF-S201C
Posted: 09 Aug 2018, 22:13
by TD-er
What is the output voltage of that sensor?
The ESP only can handle 3.3V. Some say it should be 5V-tolerant, but I am not so sure about that.
Do you have some kind of schematics of the sensor?
Does it pull a signal to GND to send a '0', or should you use a pull-down resistor and does it output 5V when it tries to send a '1' and is it floating when '0' ? (then you need 2 resistors to make the signal max. 3.3V)
Re: Water flow sensor YF-S201C
Posted: 10 Aug 2018, 08:33
by olleman
Seems like it sends 5V. I distinctly remember that the wemos d1 can handle 5V input, I think that the popular ultrasonic sensors sends 5V and I have used these without any additional resistors in the past.
Also tried with a NodeMcu yesterday with the same result.
Here's a technical datasheet but I can't really make anything out of it. Perhaps somebody else can?
https://www.google.se/url?sa=t&source=w ... mKZV_b9fJq
Re: Water flow sensor YF-S201C
Posted: 10 Aug 2018, 12:24
by olleman
Tried bridging with a jumper cable and pull up - same thing! BUT when configures as a switch input it gives med "0" or "1" as expected. I have tried every configuration I can think of in the pulse logic counter. Am I missing something fundamental?
Also tried the sensor with ha LED and it gives pulses as it should.
EDIT: hmm pulse counter needed to be one of the first 1-4 tasks, working now

Re: Water flow sensor YF-S201C
Posted: 10 Aug 2018, 19:32
by olleman
So, back to my project. I have tried today with water with different flows and at 5l/min and above it seems to be accurate but tat 1-3 l/min it's highly inaccurate which is a shame since it's rated for 1-30 l/min. Having bad values at this range wont work since this range is quite often used in my boat where I wanted to use this project. I'm gonna need something with better precision but I'm not sure where to find it.
Another way would of course be to use some kind of level measuring of the tank itself that's been suggested in the thread but I like this approach. If someone has experience with flow sensors that work well at 1-10 litres/min please direct me to these sensors

Re: Water flow sensor YF-S201C
Posted: 10 Aug 2018, 20:15
by grovkillen
I have used
this flow sensor for quite some time and even a flow of 10mL/second (0.6L per minute) is counted accurately. The sensor is used in many coffee machines and I would say that the cups used are 0.2L at most and that one is filled accurately within 30 seconds. So they are really good (and cheap).
Re: Water flow sensor YF-S201C
Posted: 11 Aug 2018, 08:45
by olleman
Thanks! Do you know anything how they perform upwards 10l/min even though they are rated to MAX 6l/min? I will occasionally have MAX flow in the boat which would mean about 10l/min.
Re: Water flow sensor YF-S201C
Posted: 11 Aug 2018, 13:14
by TD-er
olleman wrote: ↑11 Aug 2018, 08:45
Thanks! Do you know anything how they perform upwards 10l/min even though they are rated to MAX 6l/min? I will occasionally have MAX flow in the boat which would mean about 10l/min.
I can imagine the water pressure may also be an issue with these flow sensor with 10 liter/min.
Re: Water flow sensor YF-S201C
Posted: 11 Aug 2018, 15:39
by olleman
This one seems interesting, seems to be very similar to the one grovkillen recommended but with threaded connections and supposedly a MAX flow of 10l instead of 6.
https://de.aliexpress.com/item/Hall-Sen ... 78327.html
Re: Water flow sensor YF-S201C
Posted: 11 Aug 2018, 15:46
by olleman
On another note, I'm having problem making a rule that needs to contain a formula within the SendToHTTP command. Is it possible to do this?
Look at the last portion of below rule, I need to multiply the value by 6 (to get flow/min) but ESPEasy won't accept this formatting. Do I need to remind everyone that scripting and coding isn't my strong suit

? Having two tasks with the same flowmeter doesn't work since one of them always stops working...
on Flow#Liter>0 do
SendToHTTP 10.3.141.50,8080,/json.htm?type=command¶m=udevice&idx=21&nvalue=0&svalue=[Flow#Liter*6]
endon
Re: Water flow sensor YF-S201C
Posted: 12 Aug 2018, 09:40
by grovkillen
olleman wrote: ↑11 Aug 2018, 08:45
Thanks! Do you know anything how they perform upwards 10l/min even though they are rated to MAX 6l/min? I will occasionally have MAX flow in the boat which would mean about 10l/min.
I would think it'll work okay for short periods of time with a max flow of 10L/min. I haven't tested it myself but I guess it's easy to test with an air pressure hose and blow it into the sensor.