Water Flow Sensor for Flow Rate & Volume Measurement using Arduino

Water Flow Sensor for Flow Rate & Volume Measurement (Last Updated On: December 5, 2018)

Introduction:

In this project we will interface YFS201 Hall Effect Water Flow Sensor with Arduino for measuring flow rate and volume of water or any other liquid. This is a very wonderful project that can be used in industry or at home or at water flow measurement application in water tap, tunnel, river etc. Water Flow Sensor for Flow Rate & Volume Measurement using Arduino code along with circuit diagram is explained below.

This project can be used to measure liquid flowing through a pipe or container, or to create a control system based on the water flow rate or quantity. For example, you could use this while gardening to measure the amount of water used to water your plants, to prevent wastage.


Water Flow Sensor for Flow Rate & Volume Measurement using Arduino:

Components Required:

1. YFS201 Hall Effect Water Flow Sensor - (Buy Online from Amazon)
2. Arduino Uno Board
3. 16 x 2 LCD Display
4. Breadboard
5. Connecting Wires
6. Mechanical pipe & Funnel (for poring water) shown in video below

Circuit Diagram:

Water Flow Sensor for Flow Rate & Volume Measurement using Arduino


YFS201 Hall Effect Water Flow Sensor:

Introduction:

This sensor sits in line with your water line and contains a pinwheel sensor to measure how much liquid has moved through it. There’s an integrated magnetic hall effect sensor that outputs an electrical pulse with every revolution. The hall effect sensor is sealed from the water pipe and allows the sensor to stay safe and dry.

Water Flow Sensor for Flow Rate & Volume Measurement using Arduino

The sensor comes with three wires: red (5-24VDC power), black (ground) and yellow (Hall effect pulse output). By counting the pulses from the output of the sensor, you can easily calculate water flow. Each pulse is approximately 2.25 milliliters. Note this isn’t a precision sensor, and the pulse rate does vary a bit depending on the flow rate, fluid pressure and sensor orientation. It will need careful calibration if better than 10% precision is required. However, its great for basic measurement tasks!

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 Water Flow Sensor for Flow Rate & Volume Measurement using Arduino works on the principle of the Hall effect. According to the Hall effect, a voltage difference is induced in a conductor transverse to the electric current and the magnetic field perpendicular to it. Here, the Hall effect is utilized in the flow meter using a small fan/propeller-shaped rotor, which is placed in the path of the liquid flowing.

Water Flow Sensor for Flow Rate & Volume Measurement using Arduino

The liquid pushes against the fins of the rotor, causing it to rotate. The shaft of the rotor is connected to a Hall effect sensor. It is an arrangement of a current flowing coil and a magnet connected to the shaft of the rotor, thus a voltage/pulse is induced as this rotor rotates. In this flow meter, for every liter of liquid passing through it per minute, it outputs about 4.5 pulses. This is due to the changing magnetic field caused by the magnet attached to the rotor shaft. We measure the number of pulses using an Arduino and then calculate the flow rate in liters per hour (L/hr) and total volume in Litre using a simple conversion formula



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()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Water Flow Meter");
lcd.setCursor(0,1);
lcd.print("****************");
delay(2000);
pinMode(input,INPUT);
}
void loop()
{
X = pulseIn(input, HIGH);
Y = pulseIn(input, LOW);
TIME = X + Y;
FREQUENCY = 1000000/TIME;
WATER = FREQUENCY/7.5;
LS = WATER/60;
if(FREQUENCY >= 0)
{
if(isinf(FREQUENCY))
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("VOL. :0.00");
lcd.setCursor(0,1);
lcd.print("TOTAL:");
lcd.print( TOTAL);
lcd.print(" L");
}
else
{
TOTAL = TOTAL + LS;
Serial.println(FREQUENCY);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("VOL.: ");
lcd.print(WATER);
lcd.print(" L/M");
lcd.setCursor(0,1);
lcd.print("TOTAL:");
lcd.print( TOTAL);
lcd.print(" L");
}
}
delay(1000);
}

Video Preview & Demonstration:

8 Comments

  1. Dear sir water flow rate project practically very nice and I was making. Sir plz halp me for example- totaliser 100 ltr showing display then I power off then restart time why totalizer 0.00 showing? Any option shaving plz help me

  2. I tried this with an alternate flow meter, could not get it to work.
    Seems to be some discrepancies between the flow meter spec’ vs your text.

    Where did you get the Frequency = 1000000/Time

  3. Hi
    I want to build this device, and I would like to be ensure that the count is not lost if the power is lost.
    I want to write to EEPROM when the Arduino detects power down – I’m not sure it is ok… because EEPROM cycle use is limited.
    Could you help me?

  4. Nice tutorial. It has some of the features that i want to include in my project. I need some advice from you.
    Here i go
    So i want to develop a water utility system where people can go to fetch water and insert their cards with some credit on them and when they do so, the system first accepts the payment before it dispenses the water equivalent to the credit paid. Any advice in terms of what hardware i need to accomplish that?

    1. Use RFID System and a keypad.

      Rfid for access controlling and keypad for selecting amount/volume of water that is to be drawn.

Leave a Reply

Your email address will not be published. Required fields are marked *