In this project, we will interface the Hall-Effect water flow sensor with Arduino for water flow rate and volume measurement system with LCD display. This is a useful project for industry and home or for water flow measurement applications like a water tap, tunnels, etc. It helps to identify the actual water flowing and also reduces wastage of water which is a huge problem in today’s world.
This project can be used commercially by shops to measure how much liquid flowing through a pipe or container and calculate the exact billing through this system.
Must Read Water Level Indicator
Project
Circuit Diagram
Components Required
- Arduino Nano
- 16×2 LCD Display
- YF-S201 Water Flow Sensor
- Wires
- Breadboard
- 5V Power Supply
Circuit Connection for Water Flow Rate And Volume Measurement System
To display the value at the LCD display, we need to connect the LCD pins 1, 3, 5, and 16 to GND and 2, and 15 to +5V VCC. Finally connect LCD pins 4, 6, 11, 12, 13, and 14 to the Arduino digital pins D7, D6, D5, D4, D3, D2.
Connect YFS201 hall effect water flow sensor’s VCC pins to +5V VCC and GND to the ground. Since it is an analog sensor, we should connect its analog pin to the A0 of the Arduino.
Features of YF-S201 Water Flow Sensor
- Sensor Type: Hall Effect Sensor
- Voltage Range: 4.5V to 18V DC Voltage
- Maximum Current: 15mA
- Output Type: 5V TTL
- Flow Rate: 1-30 Liters/Min
- Temperature Range: -25°C to +80°C
- Humidity Range: 30%-80% RH
- Accuracy: ±10%
- Maximum Pressure: 2.0 MPa
- Output Duty Cycle: 50%±10%
- Pulses Per Liter: 450
Working Principle of Water Flow Rate And Volume Measurement System
The Arduino Water Flow Sensor for Flow Rate and Volume Measurement System works on the Hall-Effect principle. According to the hall effect principle, 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.
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 litre 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 litres per hour (L/hr) and total volume in Litre using a simple conversion formula
Application of Water Flow Rate And Volume Measurement System
- It is commonly used in HVAC systems, medical devices, chemical factories, and septic systems.
- Water flow sensors are able to detect leakage, blockage, and pipe bursts due to contamination or pollution.
- These are also usually used in domestic and various industrial sectors to measure the volume or mass of a liquid or gas, depending on the application.
Arduino Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #include <LiquidCrystal.h> LiquidCrystal lcd(7, 6, 5, 4, 3, 2); int X; int Y; float Time = 0; float Freq = 0; float Water = 0; float Total = 0; float LS = 0; const int sensor = 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(3000); pinMode(sensor, INPUT); } void loop() { X = pulseIn(sensor, HIGH); Y = pulseIn(sensor, LOW); Time = X + Y; Freq = 1000000 / Time; Water = Freq / 7.5; // Corrected line: changed from = Freq/7.5 to Water = Freq/7.5 LS = Water / 60; if (Freq >= 0) { if (isinf(Freq)) { 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(Freq); 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); } |
I have updated the code. Please re upload the new code from this article. Your problem will be solved.
Hi,
I am trying to run this little circuit and found that line 29 in the code says ” = Freq/7.5;”
This causes the code not to compile. I am a NOOB to this and wondered if you could help me figure that out. I temporarily used “Freq = Freq/7.5;” and it compiled but I am not sure if that is what was intended. Also when I uploaded it the LCD display just lit up. No characters displayed at all. Help!
Yes but need to be modified
I am planning on using this design basis for a new project. Can you tell me if the program is accumulative in its volume measurement ( with intermittent cycles over a period of time) and can a “reset” button be added to zero the values for a restart of flow and volume