

The YF-S201 is a water flow sensor designed to measure the flow rate of water in a pipe. It features a durable plastic body with an internal turbine that rotates as water flows through the sensor. The rotation generates electrical pulses, which can be counted to calculate the flow rate. This sensor is widely used in applications such as irrigation systems, water monitoring, and other scenarios requiring accurate flow measurement.








The YF-S201 water flow sensor has the following key specifications:
| Parameter | Value |
|---|---|
| Operating Voltage | 5V to 18V DC |
| Operating Current | ≤ 15 mA (at 5V DC) |
| Flow Rate Range | 1 to 30 liters per minute (L/min) |
| Output Pulse Frequency | F = 7.5 * Q (Q = flow rate in L/min) |
| Maximum Water Pressure | 1.75 MPa |
| Operating Temperature | -25°C to 80°C |
| Output Signal | Pulse signal (digital) |
| Sensor Body Material | Plastic (Nylon) |
| Connector Type | 3-pin JST connector |
The YF-S201 has a 3-pin JST connector with the following pinout:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply (5V to 18V DC) |
| 2 | GND | Ground |
| 3 | Signal | Pulse output signal (connect to microcontroller pin) |
Flow Rate (L/min) = Pulse Frequency / 7.5 to determine the flow rate.Below is an example of how to use the YF-S201 with an Arduino UNO to measure water flow:
// YF-S201 Water Flow Sensor Example Code
// Connect the Signal pin to Arduino digital pin 2
// Ensure the sensor is powered with 5V and GND is connected
volatile int pulseCount = 0; // Variable to store pulse count
float flowRate = 0.0; // Variable to store flow rate in L/min
unsigned long lastTime = 0; // Time of the last calculation
void setup() {
pinMode(2, INPUT_PULLUP); // Set pin 2 as input with pull-up resistor
attachInterrupt(digitalPinToInterrupt(2), countPulse, RISING);
// Attach interrupt to count pulses on rising edge
Serial.begin(9600); // Initialize serial communication
}
void loop() {
unsigned long currentTime = millis(); // Get current time
if (currentTime - lastTime >= 1000) { // Calculate flow rate every second
detachInterrupt(digitalPinToInterrupt(2)); // Temporarily disable interrupt
flowRate = (pulseCount / 7.5); // Calculate flow rate in L/min
pulseCount = 0; // Reset pulse count
lastTime = currentTime; // Update last calculation time
attachInterrupt(digitalPinToInterrupt(2), countPulse, RISING);
// Re-enable interrupt
// Print flow rate to serial monitor
Serial.print("Flow Rate: ");
Serial.print(flowRate);
Serial.println(" L/min");
}
}
// Interrupt service routine to count pulses
void countPulse() {
pulseCount++; // Increment pulse count on each rising edge
}
countPulse function is an interrupt service routine (ISR) that increments the pulse count whenever a rising edge is detected on pin 2.No Output Signal
Inaccurate Flow Rate
Sensor Not Responding
High Pulse Noise
Q: Can the YF-S201 measure other liquids besides water?
A: The sensor is designed for water and may not provide accurate readings with other liquids. Additionally, certain liquids may damage the sensor's plastic body.
Q: What is the maximum cable length for the sensor?
A: The maximum cable length depends on the environment and signal quality. For best results, keep the cable length under 2 meters.
Q: Can I use the YF-S201 with a 3.3V microcontroller?
A: Yes, but you may need a level shifter to ensure the pulse signal is compatible with the 3.3V logic level.
Q: How do I clean the sensor?
A: Disconnect the sensor, flush it with clean water, and remove any debris from the turbine carefully. Avoid using harsh chemicals.