Water flow rate and volume measurement using Arduino in 2020

Water flow rate and volume measurement using Arduino in 2020 © GPL3+

  • 25 respects

Components and supplies

Apps and online services

About this project

By using a flow sensor with a microcontroller like Arduino, we can calculate the flow rate, and check the volume of liquid that has passed through a pipe, and control it as required.

Applications of Flow Sensor:

Apart from manufacturing industries, flow sensors can also be found in the:

· Agriculture sector,

· Food processing,

· Water management,

· mining industry,

· Water recycling,

· Coffee machines, etc.

Further, a water flow sensor will be a good addition to projects like Automatic Water Dispenser and Smart Irrigation Systems where we need to monitor and control the flow of liquids.

In this project, we are going to build a water flow sensor using Arduino. We will interface the water flow sensor with Arduino and LCD, and program it to display the volume of water, which has passed through the valve. For this particular project, we are going to use the YF-S201water flow sensor, which uses a hall effect to sense the flow rate of the liquid.

YFS201 Water Flow Sensor

The sensor has 3 wires RED, YELLOW, and BLACK as shown in the figure below. The red wire is used for supply voltage which ranges from 5V to 18V and the black wire is connected to GND. The yellow wire is used for output (pulses), which can be read by an MCU. The water flow sensor consists of a pinwheel sensor that measures the quantity of liquid that has passed through it.

The Working of the YFS201 water flow sensor is simple to understand. The water flow sensor works on the principle of hall-effect. Hall-effects the production of the potential difference across an electric conductor when a magnetic field is applied in the direction perpendicular to that of the flow of current. The water flow sensor is integrated with a magnetic hall-effect sensor, which generates an electric pulse with every revolution. Its design is in such a way that the hall effect sensor is sealed off from the water, and allows the sensor to stay safe and dry.

The picture of the YFS201 sensor module alone is shown below.

To connect with the pipe and water flow sensor, I used two connectors with a female thread as shown below.

According to YFS201 Specifications, the maximum current it draws at 5V is 15mA, and the working flow rate is 1 to 30liters/minute. When the liquid flows through the sensor, it makes contact with the fins of the turbine wheel, which is placed in the path of the flowing liquid. The shaft of the turbine wheel is connected to a hall-effect sensor.

Due to this, whenever water flows through the valve it generates pulses. Now, all we have to do is to measure the time for the pluses or to count the number of pulses in 1 second and then calculate the flow rates in liter per hour(L/Hr) and then use simple conversion formula to find the volume of the water which had passed through it. To measure the pulses, we are going to use Arduino UNO. The pic below shows you the pinout of the water flow sensor.


The connection of the water flow sensor and LCD (16x2) with the Arduino is given below in table format. Note that the pot is connected inbetween 5V and GND and pot’s pin 2 is connected with the V0 pin of the LCD.

I used a breadboard, and once the connection was done as per the circuit diagram shown above, my testing set-uplooked something like this.

Arduino Water Flow Sensor Working

In our project, we connected the water flow sensor to a pipe. If the output valve of the pipe is closed, the output of the water flow sensor is zero (No pulses). There will be no interrupt signal seen at the pin 2 of the Arduino, and the count of the flow_frequency will be zero. In this condition, the code which is written inside the else loop will work.

If the output valve of the pipe is opened. The water flows through the sensor, which in turn rotates the wheel inside the sensor. In this condition, we can observe pulses, which are generated from the sensor. These pulses will act as an interrupt signal to the Arduino UNO. For every interrupt signal (rising edge), the count of the flow frequency variable will be increased by one. The current time and clop Time variable ensure that for every one second the value of the flow frequency is taken for calculation of flow rate and volume. After the calculation is finished, the flow frequency variable is set to zero and the whole procedure is started from the beginning.

The complete work can also be found in the video linked at the bottom of this page. Hope you enjoyed the tutorial and enjoyed something useful, if you have any problems, please leave them in the comment section or use our forums for other technical questions


Soiurce CodeC/C++
No preview (download only).


Schematic Diagram
Subscribe to my channel for more interesting projects
Water omy9mirmxu qkpzsll7b6
Circuit Diagram
Arduino water flow sensor circuit diagram zhl1mtkkoj


Similar projects you might like

Arduino Bluetooth Robot for Android Device

Project showcase by aip06

  • 24 respects

Water Quality Monitoring System

Project tutorial by Hao Jie Chan

  • 172 respects

Raise the Volume with Remote Controller

Project tutorial by Gabriele00111

  • 2 respects

How To Use DS18B20 Water Proof Temperature Sensor

Project showcase by Team IoTBoys

  • 36 respects

Water Quality Monitoring and Notification System

Project showcase by Emmanuel Ani

  • 216 respects
Add projectSign up / Login