Arduino based Digital Water Flow Meter (DIY)

Arduino based Digital Water Flow Meter using YF-S201 Hall Effect Sensor(DIY)


Water Flow Meter is an automatic system for measurement of water flow. This project is using Arduino microcontroller with Hall's effect based water flow sensor (YF-S201) and LCD is to display output. Sensor is using Hall's effect; when the water or air flows through the sensor the fans inside the sensor rotate and counts the fluid flow per minute. After calculations on input data, output is displayed on LCD screen.

What is Water flow meter- an introduction

Water flow meter for measurement of volume of water flowing. For public water supply system, it provides basis of water meters. On industrial scale, it finds many applications in controlled flow of fluids for mixing with solenoid valve for control purposes. The flow rate of water measured in cubic m (m3) or litter on an electronic or mechanical register.

YF-S201 Hall's Effect Water Flow Sensor:

This sensor has a Hall's effect based working principle. When fluid flow through it, it rotates and generates pulsated output after each cycle. This pulse is read by microcontroller and it sends command accordingly.

The sensor comes with three wires: red (5-24VDC power), black (ground) and yellow (Hall effect pulse output). Number of pulses over specified time interval is compared with standard (2.25 ml/pulse approx.) and current flow rate can be calculated. This output is dependent on fluid pressure, flow rate, orientation and location of sensor. (limitations and operating range is given in table below)

We have as example Arduino sketch that can be used to quickly test the sensor, it will calculate the approximate flow of water in liters/hour.

The pulse signal is a simple square wave so it’s quite easy to log and convert into liters per minute using the following formula:

\frac{pulse frequency}{7.5} = flow rate in \frac{L}{min}

Features of YF-S201:

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℃
Maximum water pressure: 2.0 MPa
Output duty cycle: 50% +-10%
Flow rate pulse characteristics: Frequency (Hz) = 7.5 * Flow rate (L/min)
Pulses per Liter: 450

Connection of YF-S201 Water Flow Sensor:

Water Flow Sensor (YF-S201)
Figure 1: Water Flow Sensor (YF-S201)

Flow meter is shown in figure 1. its colored connection wires are for:

  • Red wire : +5V
  • Black wire : GND
  • Yellow wire : PWM output

 

Circuit Diagram:

Circuit Diagram of water flow meter using FY-S201 sensor
Figure 2: Circuit Diagram of water flow meter

Working of Water Flow Meter using Arduino and YF-S201:

In water flow meter, a small fan wings like rotor is placed in way of fluid. Shaft of this structure has magnetic link with Hall's effect sensor. When rotor rotates, magnetic field cuts the sensor and when it comes in perpendicular, electrical pulses are generated. With each liter of fluid passing through this sensor, it shows 4.5 pulses on output side (as given in data sheet).  We note total pulses over a specified sample time and with comparison to base value, current water flow rate can be calculated (in liters per hours) with simple following formula:  

%%Pulse Frequency (Hz)/7.5 = flow rate in L/min%%

Connecting Arduino with Flow Sensor:

The connection of this flow sensor with Arduino is simple. There are only three wires coming from the sensor. The 5V VCC (Red wire), The GND (Black wire), and the signal/pulse (Usually yellow) line. Connect the VCC and GND of the flow meter to the Arduino’s VCC and GND. The pulse line of the flow rate sensor is connected to the Arduino’s digital (pin 2 in this case). The Arduino’s digital pin 2 serves as an external interrupt pin (interrupt pin 0). 

(learn about arduino interrupts)

Uploading Code to Arduino and Measuring:

Upload the water Flow Meter Code to the Arduino. The code uses an external interrupt on the Arduino’s digital pin 2. This is used to read the pulses coming from the flow meter. When the Arduino detects the pulse, it immediately triggers the pulse Counter () function. This function then counts the total number of pulses.

Dividing the total pulse count obtained by 4.5 will give you the total amount of liquid passing through it in liters per minute. Dividing that by 60 will give you the flow rate in liters per hour, which gives us the total amount or quantity of water/liquid that has passed through it. (Reading is accurate within range of +-3%)

Use this Arduino flow rate sensor with a solenoid valve to monitor and control the water used. we can use it in our gardening system, or interface it with an LCD display for other applications that require to measure water flow rate and quantity.

Code for Arduino Based Water Flow Meter:

You can download basic sketch and working code (for learning purposes) of arduino based water flow meter in attached document. You can extend this code for your own convenience.

For More Articles and projects stay tuned with us. Like our facebook page to stay tuned.
In case of query and question, comment below or contact us.
Share your experience with world with engineerexperiences.com 🙂

Young Engineers

This article is linked to a project "Young Engineers' Experiences" to give platform to the 'engineers to be' so they can share their experiences with the world and gain confidence for future work. Articles of students of engineering will be published under this project.

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.