Back to Sensors & Actuators Series

Hall-Effect Water Flow Sensor: YF-S201

April 10, 2026 Wasil Zafar 8 min read

YF-S201 deep dive — Hall-effect turbine flow sensing, pulse counting, calibration, Arduino code, and water metering applications.

Contents

  1. Working Principle
  2. Electrical Characteristics
  3. Interfacing with MCU
  4. Calibration
  5. Code Example
  6. Real-World Applications
  7. Limitations

Working Principle

The YF-S201 is a Hall-effect turbine flow sensor used to measure liquid (water) flow rate. Inside the sensor body, water flows through a chamber containing a small pinwheel rotor with embedded magnets. As water spins the rotor, the magnets pass a Hall-effect sensor mounted on the outside of the chamber, generating a square-wave pulse output. The pulse frequency is proportional to the flow rate.

Conversion: The YF-S201 outputs approximately 7.5 pulses per litre (at its rated flow range). By counting pulses per second and dividing by the calibration factor, you get litres per minute. Integrating over time gives total volume.

Electrical Characteristics

ParameterValue
Flow Range1–30 L/min
Pulse Output~7.5 pulses/litre (F = 7.5 × Q)
Supply Voltage5–18 V DC
Output TypeOpen-collector square wave (needs pull-up)
Max Water Pressure1.75 MPa
Accuracy±10% (typical, improvable with calibration)
Pipe Size1/2″ (DN15) male threads
Operating Temperature−25 to +80 °C

Interfacing with an MCU

Connect VCC (5V or higher), GND, and signal output to an interrupt-capable MCU pin. A 10 kΩ pull-up resistor is required on the signal line (some breakout boards include it). Use hardware interrupts for accurate pulse counting.

Plumbing tip: Install the sensor in a vertical section with flow direction matching the arrow on the body. Use Teflon tape on the 1/2″ threaded connections to prevent leaks.

Calibration

  • Factory factor: 7.5 pulses/litre (approximate); actual factor varies ±10% between units
  • Per-unit calibration: Flow a known volume (e.g., 1 L from a measuring cup) and count total pulses; your actual factor = pulses / litres
  • Flow-dependent factor: The calibration factor may vary slightly across the flow range; calibrate at your typical operating point

Code Example

/*
 * YF-S201 Water Flow Sensor — Arduino
 * Wiring: Red → 5V, Black → GND, Yellow → Pin 2
 *         10k pull-up on signal pin
 */
#define FLOW_PIN 2
#define CAL_FACTOR 7.5   /* Pulses per litre (tune per unit) */

volatile unsigned long pulseCount = 0;

void flowISR() {
    pulseCount++;
}

void setup() {
    Serial.begin(9600);
    pinMode(FLOW_PIN, INPUT_PULLUP);
    attachInterrupt(digitalPinToInterrupt(FLOW_PIN),
                    flowISR, RISING);
    Serial.println("YF-S201 Flow Sensor Ready");
}

void loop() {
    static unsigned long totalPulses = 0;
    static unsigned long lastTime = 0;

    if (millis() - lastTime >= 1000) {
        lastTime = millis();
        noInterrupts();
        unsigned long count = pulseCount;
        pulseCount = 0;
        interrupts();

        totalPulses += count;
        float flowRate = count / CAL_FACTOR;   /* L/min */
        float totalL  = totalPulses / CAL_FACTOR;

        Serial.print("Flow: ");
        Serial.print(flowRate, 2);
        Serial.print(" L/min  Total: ");
        Serial.print(totalL, 1);
        Serial.println(" L");
    }
}

Real-World Applications

Home Automation Water Metering & Irrigation Control

The YF-S201 is the go-to hobbyist water flow sensor for smart home water monitors, garden irrigation controllers, aquarium auto-dosing systems, coffee machine flow metering, and water leak detection. Commercial versions of the same Hall-turbine principle are used in washing machines, vending machines, and medical IV flow control.

Water MeteringIrrigationSmart HomeLeak Detection

Limitations

  • Low flow dead zone: Below ~1 L/min, the rotor may not spin; not suitable for drip-rate measurement.
  • Water only: Not rated for corrosive liquids, oils, or fluids with suspended solids (clogs the turbine).
  • Accuracy: ±10% out of box; requires per-unit calibration for better than ±5%.
  • Pressure drop: The turbine introduces a small pressure drop (~0.02 MPa at max flow).
  • Wear: The plastic rotor and bearings wear over time, changing the calibration factor.