RPi 23.1 - YF-S201 Water Flow Meter/Sensor, Polling, IMPULSE Trigger - ADVANCED

  Рет қаралды 15,170

tsbrownie

tsbrownie

6 жыл бұрын

Measure water flow with the Raspberry Pi. This is an advanced version of an earlier RPi experiment using the YF-S201 flow meter. This one is based on polling and triggers on input pulses. It also ensures that a stopped impeller does not lead to bad data.
NOTE: The pi is not a real time computer (for example like the Arduino) and its ability to react to polling or interrupts is dependent on other code being executed. As a result, at higher input rates, the pi will begin to miss inputs and the results will be less and less accurate. You can put in factors based on assumptions (as in this example) to get reasonable approximations.
Good demo of measuring and controlling water flows - home watering use, irrigation water use tracking, livestock water tanks, etc.
The sensor is inline and uses an impeller with an embedded magnet. The magnet triggers a Hall effect switch sending a pulse 6x per revolution.
There are 3 wires, red (power, 2-24 volts, but I've gotten it to work at 3 volts), black (ground) and yellow (Hall effect output).
From the spec sheet:
16 Hz = 2 L/min = 120 L/hr
32.5 Hz = 4 L/min = 240 L/hr
49.3 Hz = 6 L/min = 360 L/hr
65.5 Hz = 8 L/min = 480 L/hr
82 Hz = 10 L/min = 600 L/hr
etc. Max 30 L/min
Pulses per Liter: 450
Frequency (Hz) = 7.5 * Flow rate (L/min)
Model: YF-S201
Sensor Type: Hall effect
Working Voltage: 3.5 to 24V DC (min tested voltage 3.3V)
Max current draw: 15mA @ 5volts
Output Type: 5volt TTL
Working Flow Rate: 1 to 30 Liters/Minute
Accuracy: ±10%
Maximum water pressure: 2.0 MPa
Operating Temperature: ≤80℃
Liquid Temperature: ≤120℃
Output duty cycle: 50% ±10%
Output rise time: 0.04us
Output fall time: 0.18us
Min Durability: 300,000 cycles
Cable length: 15cm
1/2" nominal pipe connections, 0.78" outer diameter, 1/2" of thread
Size: 2.5" x 1.4" x 1.4"
Notes:
YOU NEED A VOLTAGE DIVIDER WHEN OPERATING ABOVE 3.3 VOLTS!!!
MATERIALS
- Raspberry Pi (and Pi power supply)
- Breadboard
- YF-S201 Water meter / sensor
- Jumpers
- Resistor (yellow purple red 4700 ohms)
- Resistor (brown black orange 10k ohms)
WARNING: Warning: mis-wiring or mis-programming your Pi or miswiring of accessories can ruin the Pi and accessories.
Information/drawings offered as is. Use at your own risk. If you don't know, learn first.
RASPBERRY PI EXPERIMENTS
Experiment 1 - Blink LED
• Video
Experiment 2 - Stoplight / Traffic-light
• Video
Experiment 3 - Massive Power Control
• Video
Experiment 4 - Polling to Detect Input
• Video
Experiment 5 - Interrupts to Detect Input
• Video
Experiment 6 - Counter
• Video
Experiment 7 - Tachometer (Beta)
• Video
Experiment 7x - Laser Morse Code Transmitter
• Video
Experiment 08 - Chronograph / Timer
• Video
Experiment 09 - Ultrasonic Distance Measurement
• Video
Experiment 10 - Ultrasonic High Accuracy Distance Measurement
• Video
Experiment 11 - Ultrasonic Velocity & Speed Measurement
• Video
Experiment 12 - Raspberry Pi Ultrasonic Accelerometer - 12 (FAIL)
kzfaq.info?video_id...
Experiment 13 - The Speed of Pi - How Fast Are The GPIO Ports?
• Video
Experiment 14 - Raspberry Pi Stepper Motor 1
• Video
Experiment 15 - Analog to Digital Converter (I2C-ADS)
• Video
Experiment 15.1 - 8 Channel Upgrade to A2D Converter Software
• Video
Experiment 16 - In Progress...
Experiment 17 - Experiment on RFI & The RPi - Does RFI Cause Inconsistent Readings?
Experiment 18a - Part 1/2: Stepper Motor using DRV8825 driver board
• Video
Experiment 18b - Part 2/2: Stepper Motor using DRV8825 driver board
• Video
Experiment 18-1 Pre-Programmed Stepper Motor Control
kzfaq.info?o=U&vide...
Experiment 19-1 Raspberry Pi - PIR Motion Detector Exp 01
• RPi 19.1 - PIR Motion ...
Experiment 19-2 Raspberry Pi & PIR Motion Detector via Interrupts
• RPi 19.2 - PIR Motion ...
Experiment 20 - RPI & YF-S201 Hall Effect Water Flow Meter / Sensor
• RPi 20 - YF-S201 Hall ...

Пікірлер: 48
@rtenerife
@rtenerife 4 жыл бұрын
Nice one and very well explained. You made my Saturday !
@bhaveshbusa
@bhaveshbusa 6 жыл бұрын
Hi TSBrownie, Amazing video and great detail. I am very new RPi and with your video I was able to setup the sensor and run the program. I have a question, how do you work out litres from revolution? From the program it seems it is calculated as constant / time of one revolution. Is that correct?
@tsbrownie
@tsbrownie 6 жыл бұрын
The best way to do it is set up the system. Run water through the system into a bucket or known volume and measure the time it takes to fill. Then use that info to set your constant. In the description I gave the specs from the manufacturer which is probably a good beginning value.
@jamesjamess2312
@jamesjamess2312 7 ай бұрын
is there any way to download your code?
@ryanh6589
@ryanh6589 4 жыл бұрын
Hi, nice video thanks for sharing. I'm wondering; any ideas on how to array the information to then perhaps email you a text file or something with the data? I'm wondering how to take this to the next level to graph daily water use in a home
@tsbrownie
@tsbrownie 4 жыл бұрын
To be honest I don't know how to graph stuff in python. I'd probably export the data to a Libre Office spreadsheet and use its graphic package.
@kevinharris9116
@kevinharris9116 5 жыл бұрын
Hi. Im looking to make a bidirectional flow meter to fill and empty a container. From the data sheet it looks like it should pulse in both directions, but as there is a direction indicator I wonder if there is a reason it doesnt? Thanks for any info before I purchase one.
@tsbrownie
@tsbrownie 5 жыл бұрын
The insides are most likely machined / formed for max efficiency in measuring water in 1 direction. They are not expensive, you could always give it a try and see if you got equal numbers in both directions.
@jacklammiman
@jacklammiman 4 жыл бұрын
@tsbrownie I wanted to check, for the value of the constant, would that be a self calculated liters/minute. For example, I want to install the turbine sensor, in line with the water in-flow pipe of my sink. I measured the rate of flow to be around 5.5 litres/min. Would my constant be 5.5?
@tsbrownie
@tsbrownie 4 жыл бұрын
The manufacturer's specs are included in the description. For example, 16 Hz = 2 L/min = 120 L/hr and 32.5 Hz = 4 L/min = 240 L/hr. Beware there is a minimum and maximum flow rate limit.
@jacklammiman
@jacklammiman 4 жыл бұрын
@@tsbrownie so do I put the Hertz value in or the liters per min in, as my constant
@tsbrownie
@tsbrownie 4 жыл бұрын
@@jacklammiman It depends on how you write your program. Mine is really bare bones and as I mention in the video I did not try to calibrate it. The pi will measure pulses, which is Hertz, so if you want to know liters / gallons you will have to include the conversion. If you pour 2 liters in 1 minute through the meter, the pi should register 16 pulses in that minute. If you pour 4 liters through it in 1 minute you should get 32.5 pulses. Going the other way, it is ROUGHLY 8 pulses / liter / minute (16/2 and 32.5/4), so you can begin there and then fudge your constant up and down based on your actual measurements (8.1 or 7.9 or ...) Note that the manufacturer shows that at the higher flows 65.5 Hz = 8 L/min is more like 8.19 and 82 Hz = 10 L/min is 8.2.
@pslmoorthy
@pslmoorthy 5 жыл бұрын
Hi, can you list those resistor values and circuit to connect all of them please?
@tsbrownie
@tsbrownie 5 жыл бұрын
Thanks for pointing that out, I added that to the description. Resistor (yellow purple red 4700 ohms) Resistor (brown black orange 10k ohms)
@manuchaudhary7902
@manuchaudhary7902 4 жыл бұрын
please give me the LINK to purchase the Flow Sensor PLEASE? I am presently in USA.
@tsbrownie
@tsbrownie 4 жыл бұрын
I listed the one I used. I bought it at a local shop near me.
@yonathankristianto8824
@yonathankristianto8824 4 жыл бұрын
sir, do you have python code for hall effect flow meter using wemos d1 r1 mini?
@tsbrownie
@tsbrownie 4 жыл бұрын
I'm not familiar with that one.
@mashfiqrizvee2537
@mashfiqrizvee2537 4 жыл бұрын
Hey..my flow data is looking unreal for some reason..is the volume in liters? Or milileters? Because whenever i am blowing some air into the sensor, the data just starts running like usain bolt. The data increases 100L per blow :3 please reply
@tsbrownie
@tsbrownie 4 жыл бұрын
This will not give accurate data with air. The impeller will move way too fast and the sensor will record and skip. The air is just for demonstration because my wife won't let me run water in our tv room. The manufacturer data is in the description, it will give you a pretty good first approximation of the calibration.
@premithmendis8004
@premithmendis8004 3 жыл бұрын
maybe the coefficient should be adjusted
@veerabiopower2250
@veerabiopower2250 3 жыл бұрын
Hi can you share the coses
@MiguelValenciaGalindo
@MiguelValenciaGalindo 4 жыл бұрын
Thank you so much for the video it is very useful. I have a question. How can I calibrate the sensor to reach a better accuracy? How can I obtain a constant appropriate for the sensor? Thanks
@tsbrownie
@tsbrownie 4 жыл бұрын
The manufacturer's data is in the description. For best accuracy you will have to calibrate it under your conditions.
@jackf.4785
@jackf.4785 5 жыл бұрын
Hey, how did you know that it was 6 pulses per revolution, is this also obtained from the manufacturer?
@tsbrownie
@tsbrownie 5 жыл бұрын
Yes, that data is in the description. Plus I took it apart and tried it by hand.
@jackf.4785
@jackf.4785 5 жыл бұрын
@@tsbrownie hey thanks for the reply. I have another question: how come you are using a 5V supply for the flow meter when 3.3V is apparently sufficient ? Essentially bypassing the need for the voltage divider circuit in the first place.
@tsbrownie
@tsbrownie 5 жыл бұрын
@@jackf.4785 Another excellent question! It's been a while, but as I recall the hall effect switch was rated at 5 volts (that may be different in newer models). I tried it with 3 volts and it seemed to work, but lower voltage could create unreliability my tests missed.
@TheSae24
@TheSae24 5 жыл бұрын
@@jackf.4785 U have miss previous series :-) where author talk about noise on 3.3V :-)
@ZiFrenZie
@ZiFrenZie 5 жыл бұрын
The amount of litres reported seems quite great... You didn't even breathe much into the pipe, and it's reporting a total of 159.3 litres!!
@tsbrownie
@tsbrownie 5 жыл бұрын
Yes, blowing through the turbine will make it spin much faster than actual water would.
@allendavecatucag6931
@allendavecatucag6931 5 жыл бұрын
Good day sir, Do you have a computation of voltage divider ? Study purposes thank you in advance :)
@tsbrownie
@tsbrownie 5 жыл бұрын
I googled voltage divider calculator.
@allendavecatucag6931
@allendavecatucag6931 5 жыл бұрын
@@tsbrownie follow-up question sir, where did you get the constant 1. 79? I tried to timed water flow how fast to pass through flow meter, within 1 minute i get 7.5 litters per minute is that my constant value now?
@tsbrownie
@tsbrownie 5 жыл бұрын
I have data on the water flow from the manufacturer in the description. The hertz (pulses per time) are a rough estimate of the flow rate. The constant can change depending on your code. The number I used was just a wild guess before I found the mfg's data. Start with their data and then adjust based on your actual tests. Repeat until you are within the accuracy you need.
@allendavecatucag6931
@allendavecatucag6931 5 жыл бұрын
@@tsbrownie thanks for the reply sir!
@joseantonioreyna
@joseantonioreyna 4 жыл бұрын
@@tsbrownie how do you know the value of each resistor?
@djquano
@djquano 4 жыл бұрын
Nice and very clear explanation. I've seen and doing stuff with this and all codes works great. I was experiencing some stuff to upload data to adafruit via mqtt. And alarming via Telegram. But it's there a way or a github place where you uploaded this code? if not ill copy from screen as usual :-P hope you dont care about it. Thanks a lot again.
@tsbrownie
@tsbrownie 4 жыл бұрын
Thanks. No I don't post it. If I did no one would watch my videos! ;)
@michaelmcpherson7859
@michaelmcpherson7859 Жыл бұрын
How did you find the PPR for your meter?
@michaelmcpherson7859
@michaelmcpherson7859 Жыл бұрын
nm I saw a previous comment
@michaelmcpherson7859
@michaelmcpherson7859 Жыл бұрын
I do still need help thoiugh. I'm trying this and I am not receiving any pulse input when i blow through my meter. I also have wires for a Reed switch, I'm not sure if that helps orr
@tsbrownie
@tsbrownie Жыл бұрын
@@michaelmcpherson7859 How are you testing for pulses? It can be a hardware issue (you need to use the voltage divider as shown for most devices). Or you don't have the Arduino/RPi port configured for input. It can be a software issue where you are not getting data because of a code error.
@raul5572
@raul5572 2 жыл бұрын
What is this profession called?
@tsbrownie
@tsbrownie 2 жыл бұрын
In my case it is called "Retirement." ;)
@Van-..-z._-_z.-._-._.-z.
@Van-..-z._-_z.-._-._.-z. 6 жыл бұрын
What is boxing day?
@tsbrownie
@tsbrownie 6 жыл бұрын
Boxing Day is a holiday celebrated on the day after Christmas Day. It originated in the United Kingdom, and is celebrated in a number of countries that previously formed part of the British Empire. Boxing Day is on 26 December, although the attached bank holiday or public holiday may take place either on that day or two days later. In the liturgical calendar of Western Christianity, Boxing Day is the second day of Christmastide,[1] and also Saint Stephen's Day.[2] It is also celebrated as Saint Stephen Day in the Catalonia region of Spain.[3] In some European countries, such as Germany, Poland, the Netherlands, and Scandinavia, 26 December is celebrated as a Second Christmas Day.[4] Etymology There are competing theories for the origins of the term, none of which are definitive.[5] The Oxford English Dictionary gives the earliest attestations from Britain in the 1830s, defining it as "the first week-day after Christmas-day, observed as a holiday on which post-men, errand-boys, and servants of various kinds expect to receive a Christmas-box".[6] The term "Christmas-box" dates back to the 17th century, and among other things meant: A present or gratuity given at Christmas: in Great Britain, usually confined to gratuities given to those who are supposed to have a vague claim upon the donor for services rendered to him as one of the general public by whom they are employed and paid, or as a customer of their legal employer; the undefined theory being that as they have done offices for this person, for which he has not directly paid them, some direct acknowledgement is becoming at Christmas.[7] Etc. From wikipedia. Why do you ask?
How to Measure Flow with Magnets - (Magnetic Flow Meters)
10:14
Practical Engineering
Рет қаралды 489 М.
Неприятная Встреча На Мосту - Полярная звезда #shorts
00:59
Полярная звезда - Kuzey Yıldızı
Рет қаралды 7 МЛН
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 2 МЛН
Waterproof Ultrasonic Distance Sensors - JSN-SR04T & A02YYUW 💧☔
32:11
DroneBot Workshop
Рет қаралды 173 М.
Medición de Caudal con Arduino y YF-S201
25:41
Sergio A. Castaño Giraldo
Рет қаралды 8 М.
GPS Disciplined Oscillator
10:14
Gary Ramsey
Рет қаралды 8 М.
Arduino YF-S201 Flow Sensor calibration and usage
16:34
Tonguç Endem
Рет қаралды 61 М.
Arduino Prototyping Inputs #46: Measuring Water Flow
4:17
Marc de Vinck
Рет қаралды 10 М.
Turbine Flow Meter Explained | Operation and Calibration
8:05
Build Your Own Drone Tracking Radar:  Part 1
20:08
Jon Kraft
Рет қаралды 475 М.
Water sensors with a raspberry pi:  flow, pressure, moisture
8:06
Water Flow sensor and Raspberry pi - Testing & Setting
18:13
hydrosys4 raspberry
Рет қаралды 21 М.
How an ASML Lithography Machine Moves a Wafer
16:15
Asianometry
Рет қаралды 414 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 4,6 МЛН
Simple maintenance. #leddisplay #ledscreen #ledwall #ledmodule #ledinstallation
0:19
LED Screen Factory-EagerLED
Рет қаралды 10 МЛН
Ультрабюджетная игровая мышь? 💀
1:00