Overview

The YF-S201 is a popular 1/2-inch (DN15) inline liquid flow rate sensor widely used in smart irrigation systems, water dispensers, solar heating loops, and home automation water meters.

Housed in a durable black nylon body with standard 1/2" male parallel threads (G1/2"G1/2\text{"}), the sensor contains a pinwheel turbine rotor embedded with a permanent magnet, separated from a digital Hall effect sensor. As water flows through the chamber, it spins the turbine, causing the magnet to pass by the Hall sensor and generate a digital 50% duty-cycle square-wave pulse train on the yellow signal wire. The output pulse frequency is directly proportional to water flow velocity (1 to 30 L/min1\text{ to }30\text{ L/min}).

Quick reference

Operating voltage (VCC)4.5 V to 18.0 V DC (5.0 V nominal)
Max water pressure1.75 MPa\le 1.75\text{ MPa} (17.5 bar/253 PSI17.5\text{ bar} / 253\text{ PSI})
Flow rate range1.0 L/min to 30.0 L/min (±3%\pm 3\% accuracy)
Pulse characteristic (FF)F=7.5×Q(where Q=L/min,F=Hz)F = 7.5 \times Q \quad (\text{where } Q = \text{L/min}, F = \text{Hz})
Pulses per Liter450 pulses/Liter\approx 450\text{ pulses/Liter}
Thread connectionStandard 1/2" male parallel threads (G1/2"G1/2\text{"})
Output type5V TTL Open-Collector Square Wave (requires pull-up resistor)
Operating current15 mA15\text{ mA} at 5V supply

Pinout

3-wire color-coded 0.1" (2.54 mm) connector:

LeadCable ColorNameTypeDescription
1RedVCCPowerSupply voltage input (+4.5 V to +18.0 V DC)
2BlackGNDPowerGround reference (0 V)
3YellowSIGNAL / OUTDigital OutputPulse frequency output pin (Active-Low pulses)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVCCV_{CC}4.55.018.0VDC
Active Supply CurrentICCI_{CC}1520mAVCC=5.0 VV_{CC} = 5.0\text{ V}
Flow Rate RangeQQ1.030.0L/minClean water
Max Liquid PressurePmaxP_{max}1.75MPaBurst pressure test
Pulse Frequency FormulaFF7.5×Q7.5 \times QHzQQ in Liters per minute
Output High VoltageVOHV_{OH}4.54.8VCCV_{CC}VWith 10 kΩ10\text{ k}\Omega pull-up to VCCV_{CC}
Output Low VoltageVOLV_{OL}0.00.20.4VIsink=10 mAI_{sink} = 10\text{ mA}
Liquid Temp RangeTwaterT_{water}02580°CNon-freezing liquid

Flow Calculation & Math

The relationship between pulse frequency (FF in Hz) and flow rate (QQ in L/min) is given by the empirical manufacturer calibration curve:

F (Hz)=7.5×Q (L/min)    Q (L/min)=F7.5F\text{ (Hz)} = 7.5 \times Q\text{ (L/min)} \implies Q\text{ (L/min)} = \frac{F}{7.5}

To compute flow rate and total volume (in Liters) over time:

  1. Flow Rate (QQ): Measure pulse count NN over a 1-second interval (F=N pulses/secF = N\text{ pulses/sec}):

Flow Rate (L/min)=Pulses per Second7.5\text{Flow Rate (L/min)} = \frac{\text{Pulses per Second}}{7.5}

  1. Total Volume (VV): Each individual pulse corresponds to approximately 1450 Liters2.22 mL\frac{1}{450}\text{ Liters} \approx 2.22\text{ mL}:

Total Volume (Liters)=Cumulative Pulse Count450\text{Total Volume (Liters)} = \frac{\text{Cumulative Pulse Count}}{450}

Wiring

YF-S201 LeadArduino UnoESP32Notes
Red (VCC)5V5VPower from 5V rail
Black (GND)GNDGNDSystem ground
Yellow (SIGNAL)Digital D2 (INT0)GPIO 4Requires 10 kΩ10\text{ k}\Omega pull-up to 3.3V/5V
Warning

Flow Direction & Horizontal Mounting:

  • Note the arrow molded on the nylon housing indicating the required water flow direction. Installing the sensor backwards causes inaccurate pulse counts.
  • Mount the sensor with the turbine axis horizontal to prevent air bubbles from trapping inside the chamber.

Example

cpp
const int flowPin = 2; // Interrupt 0 on Arduino Uno
volatile unsigned int pulseCount = 0;
float flowRateLmin = 0.0;
float totalLiters = 0.0;

void countPulse() {
  pulseCount++;
}

void setup() {
  Serial.begin(9600);
  pinMode(flowPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(flowPin), countPulse, RISING);
}

void loop() {
  pulseCount = 0;
  delay(1000); // Measure pulses for 1 second

  // Q (L/min) = Hz / 7.5
  flowRateLmin = (pulseCount / 7.5);
  // Volume added in 1 sec = Flow Rate / 60
  totalLiters += (flowRateLmin / 60.0);

  Serial.print("Flow Rate: "); Serial.print(flowRateLmin); Serial.print(" L/min");
  Serial.print(" | Total Volume: "); Serial.print(totalLiters); Serial.println(" L");
}

Common mistakes

  • Testing with compressed air instead of liquid: Spinning the dry turbine with compressed air over-speeds the nylon bearings and destroys the internal shaft.
  • Forgetting pull-up resistor: The Hall sensor output is open-collector. Enable internal micro-controller pull-ups (INPUT_PULLUP) or add an external 10 kΩ10\text{ k}\Omega resistor.

Notes

  • YF-S201 vs YF-S401: YF-S201 is 1/2" DN15 (130 L/min1\text{--}30\text{ L/min}); YF-S401 is 6mm micro-tubing (0.36 L/min0.3\text{--}6\text{ L/min}).

Assets & downloads