Arduino Water Flow Sensor to Measure Flow Rate & Volume

In this project, we will connect an Arduino to a YFS201 Hall Effect Water Flow Sensor to measure the volume and flow rate of any liquid. This is a fantastic idea that may be applied to the measurement of water flow in water taps, tunnels, rivers, etc., as well as in business, at home, and in other settings. The circuit design and water flow sensor for flow rate and volume measurement using Arduino code are described below.

With the help of this project, you can gauge the amount of liquid flowing through a pipe or container or design a control scheme that depends on the volume or flow rate of the water. For example, you may use this when gardening to gauge how much water is being used to irrigate your plants and avoid wasting it.

Hardware Required

  • Arduino UNO R3 Development Board
  • YFS201 Hall Effect Water Flow Sensor
  • JHD162A 16×2 LCD Display
  • Potentiometer-10K
  • Water Pipe
  • Connecting Wires
  • Breadboard

Circuit Diagram:

  • Connect pins 1, 3, 5, 16 of the LCD to GND and pins 2, 15 to 5V VCC. Connect the LCD pins 4, 6, 11, 12, 13, and 14 to the digital pins D7, D6, D5, D4, D3, and D2 of the Arduino.
  • Connect the VCC pins and GND pins of the YFS201 Hall Effect Water Flow Sensor to a 5V power source. Since the sensor is analog, attach its analog pin to Arduino pin A0 as indicated in the diagram above.

YFS201 Hall Effect Water Flow Sensor:

This sensor, which has a pinwheel sensor to gauge how much liquid has passed through it, is installed in line with your water line. With each rotation, an embedded magnetic hall effect sensor produces an electrical pulse. The water line is shut off from the hall effect sensor, allowing the sensor to remain secure and dry.

Water Flow Sensor for Flow Rate & Volume Measurement using Arduino

Three cables are included with the sensor: black (ground), red (5-24VDC power), and yellow (Hall effect pulse output). You may quickly determine the water flow rate by counting the pulses coming from the sensor’s output. About 2.25 milliliters make up each pulse. The pulse rate does fluctuate slightly based on the flow rate, fluid pressure, and sensor orientation because this is not a precise sensor. If better than 10% precision is desired, thorough calibration will be necessary. But it’s fantastic for simple measurement jobs!

Features of Flow Sensor:

  • Model: YF-S201
  • Sensor Type: Hall effect
  • Working Voltage: 5 to 18V DC (min tested working voltage 4.5V)
  • Max current draw: 15mA @ 5V
  • Output Type: 5V TTL
  • Working Flow Rate: 1 to 30 Liters/Minute
  • Working Temperature range: -25 to +80℃
  • Working Humidity Range: 35%-80% RH
  • Accuracy: ±10%
  • Maximum water pressure: 2.0 MPa
  • Output duty cycle: 50% +-10%
  • Output rise time: 0.04us
  • Output fall time: 0.18us
  • Flow rate pulse characteristics: Frequency (Hz) = 7.5 * Flow rate (L/min)
  • Pulses per Liter: 450
  • Durability: minimum 300,000 cycles

Working of YFS201 Hall Effect Water Flow Sensor:

The Hall effect is the basis for how the Water Flow Sensor does Flow Rate & Volume Measurement using Arduino functions. The magnetic field perpendicular to the electric current induces a voltage differential in a conductor, according to the Hall effect. Here, a tiny fan- or propeller-shaped rotor is positioned in the liquid’s flow path to use the Hall effect in the flow meter.

Water Flow Sensor for Flow Rate & Volume Measurement using Arduino

The rotor rotates as a result of the liquid pushing up on its fins. A Hall effect sensor is attached to the rotor’s shaft. A voltage or pulse is produced while the rotor rotates thanks to an arrangement of a current-flowing coil and a magnet attached to the shaft. For each liter of liquid that passes through this flow meter in a minute, it produces around 4.5 pulses. This is a result of the magnet attached to the rotor shaft changing its magnetic field. Using an Arduino to count the pulses, we can then use a straightforward conversion formula to determine the flow rate in liters per hour (L/hr) and the total volume in liters.

Source Code/Program:

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
int X;
int Y;
float TIME = 0;
float FREQUENCY = 0;
float WATER = 0;
float TOTAL = 0;
float LS = 0;
const int input = A0;
void setup()
lcd.begin(16, 2);
lcd.print(“Water Flow Meter”);
void loop()
X = pulseIn(input, HIGH);
Y = pulseIn(input, LOW);
TIME = X + Y;
LS = WATER/60;
if(FREQUENCY >= 0)
lcd.print(“VOL. :0.00”);
lcd.print( TOTAL);
lcd.print(” L”);
lcd.print(“VOL.: “);
lcd.print(” L/M”);
lcd.print( TOTAL);
lcd.print(” L”);

I hope all of you understand how to use Arduino Water Flow Sensor to Measure Flow Rate & Volume. We MATHA ELECTRONICS will be back soon with more informative blogs.

Back to list

Leave a Reply

Your email address will not be published.