

A water flow sensor detects the flow rate of water in a system, providing real-time data for monitoring and control applications. It typically consists of a plastic body, a rotor, and a Hall-effect sensor. As water flows through the sensor, the rotor spins, and the Hall-effect sensor generates electrical pulses proportional to the flow rate. These sensors are widely used in applications such as water dispensers, irrigation systems, industrial fluid monitoring, and smart home automation.








Below are the key technical details for a typical water flow sensor:
| Parameter | Value |
|---|---|
| Operating Voltage | 5V to 24V DC |
| Output Signal | Pulse signal (digital) |
| Flow Rate Range | 1 to 30 liters per minute (L/min) |
| Accuracy | ±10% |
| Maximum Water Pressure | 1.75 MPa |
| Operating Temperature | -25°C to 80°C |
| Output Duty Cycle | 50% |
The water flow sensor typically has three wires for connection. Below is the pin configuration:
| Wire Color | Function | Description |
|---|---|---|
| Red | VCC | Connect to the positive voltage supply (5V to 24V) |
| Black | GND | Connect to ground |
| Yellow | Signal (Output) | Outputs pulse signal proportional to flow rate |
Below is an example of how to use the water flow sensor with an Arduino UNO to measure and display the flow rate:
// Water Flow Sensor Example Code for Arduino UNO
// Measures water flow rate and displays it on the Serial Monitor
const int sensorPin = 2; // Connect the yellow wire to digital pin 2
volatile int pulseCount = 0; // Variable to store pulse count
float flowRate = 0.0; // Variable to store flow rate in L/min
unsigned long previousMillis = 0; // Timer for flow rate calculation
const unsigned long interval = 1000; // Interval for calculations (1 second)
// Interrupt Service Routine (ISR) for counting pulses
void pulseCounter() {
pulseCount++;
}
void setup() {
pinMode(sensorPin, INPUT_PULLUP); // Set sensor pin as input with pull-up
attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, RISING);
Serial.begin(9600); // Initialize Serial Monitor
}
void loop() {
unsigned long currentMillis = millis();
// Calculate flow rate every second
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
// Flow rate calculation: (Pulse frequency / Calibration factor)
// Calibration factor depends on the specific sensor model (e.g., 7.5 for YF-S201)
float calibrationFactor = 7.5;
flowRate = (pulseCount / calibrationFactor);
// Reset pulse count for the next interval
pulseCount = 0;
// Display flow rate on Serial Monitor
Serial.print("Flow Rate: ");
Serial.print(flowRate);
Serial.println(" L/min");
}
}
No Output Signal:
Inaccurate Flow Rate:
Unstable Readings:
Sensor Not Detecting Flow:
Q: Can the water flow sensor measure other liquids?
A: Most water flow sensors are designed for clean water. Using them with other liquids may damage the sensor or reduce accuracy.
Q: How do I know the calibration factor for my sensor?
A: The calibration factor is typically provided in the sensor's datasheet or user manual. For example, the YF-S201 sensor has a calibration factor of 7.5.
Q: Can I use the sensor with a 3.3V microcontroller?
A: Yes, but you may need a level shifter or ensure the sensor's output signal is compatible with the microcontroller's input voltage levels.
Q: What is the lifespan of a water flow sensor?
A: The lifespan depends on the quality of the sensor and operating conditions. Regular maintenance can extend its life.
By following this documentation, you can effectively integrate and troubleshoot a water flow sensor in your projects.