Рет қаралды 15,170
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 ...