YF-S201 Water Flow

An inline Hall-effect water flow sensor that turns liquid flow into a pulse train, roughly 450 pulses per liter.

YF-S201 Water Flow: Liquid flow rate

What is the YF-S201 Water Flow?

The YF-S201 is a compact inline water flow sensor built around a plastic valve body with 1/2 inch threaded ports, a pinwheel rotor, and a Hall-effect sensor. As water passes through, it spins the rotor, whose embedded magnet sweeps past the Hall sensor and generates a square-wave pulse output. It plugs into a pipe run and reports flow without any moving electrical contacts touching the water.

The output appears on the yellow DATA wire as a digital pulse whose frequency tracks flow rate. The sensor produces on the order of 450 pulses per liter, and the frequency follows F(Hz) = 7.5 x Q, where Q is flow in liters per minute. Firmware counts these pulses over a fixed window to derive instantaneous flow rate, and accumulates the count to compute total dispensed volume. It runs from a 5V supply (the red wire is rated up to 12V) and draws only about 15 mA at 5V.

The sensor measures flow from roughly 1 to 30 liters per minute with an accuracy near plus or minus 10 percent, so it is well suited to hobby water metering, dosing, and monitoring rather than billing-grade measurement. Because unit-to-unit tolerance is significant, calibrating the pulses-per-liter factor against a known volume gives noticeably better results.

YF-S201 Water Flow pinout

PinFunctionType
VCC Red: 3.5-12VdcPowerPower in
GND Black: GNDPowerPower in
DATA Yellow: Hall pulse outputDigital Hall-effect pulse output; about 450 pulses per literDigital output

Specifications

Operating voltage
5 V (max 12 V)
Interface
GPIO timing (Trigger / Echo)
Dimensions
62 × 35 × 36 mm

Verified from the Tinkered component library · Handson Technology / generic YF-S201.

Circuit requirements

  • Power the red VCC wire from 5V and tie the black GND wire to the common ground shared with the microcontroller; the supply line tolerates up to 12V per the pin rating, though 5V is typical for logic-level use.
  • The yellow DATA line is an open-collector Hall output and needs a pull-up resistor (about 10k) to the logic rail to produce clean pulse edges; many boards' internal pull-ups also work.
  • Output pulses swing to the supply rail. Powered at 5V the pulses are 5V, which is fine for a 5V Arduino but must be level-shifted down for 3.3V boards such as the ESP32, ESP8266, or Raspberry Pi.
  • Route DATA to an interrupt-capable input and count pulses with a hardware interrupt (attachInterrupt) rather than polling, so no pulses are missed at higher flow rates.
  • No warm-up or timing sequence is required, but the sensor only pulses while water is actually flowing; below about 1 L/min the rotor may not spin reliably. Observe the flow-direction arrow on the body when installing.

Board compatibility

The YF-S201 Water Flow connects to any of the microcontrollers supported in Tinkered. Mind the 5 V logic level on 3.3 V boards.

Simulate the YF-S201 Water Flow in your browser

The YF-S201 Water Flow is fully simulated in Tinkered. Wire it into a circuit, write your firmware, and read real values back with no physical hardware. Test your logic before you touch a breadboard.

Open it in the simulator

Common YF-S201 Water Flow mistakes

Feeding a 5V pulse into a 3.3V board

Powered at 5V, the DATA line outputs 5V pulses. Wiring that straight into an ESP32, ESP8266, or Raspberry Pi GPIO can damage the input. Use a level shifter or a resistor divider on the signal line.

Counting pulses by polling instead of interrupts

Reading the pin in a loop misses pulses as flow increases, undercounting volume. Attach a hardware interrupt to the DATA pin and increment a volatile counter, then compute rate from the count over a fixed interval.

Trusting the nominal 450 pulses/liter without calibrating

The 450 pulses-per-liter and F = 7.5 x Q figures are nominal, and accuracy is only about plus or minus 10 percent per unit. For meaningful volume readings, pass a measured volume through the sensor and adjust the conversion factor to match.

Ignoring the minimum flow rate and air bubbles

Below roughly 1 L/min the impeller stalls or spins erratically, and trapped air bubbles cause false or dropped pulses. Keep the pipe full, mount the sensor so it stays primed, and stay within the 1 to 30 L/min range.

Omitting the signal pull-up

The Hall output is open-collector, so without a pull-up to the logic rail the input floats and pulses look noisy or absent. Enable the internal pull-up or add an external 10k resistor to VCC.

YF-S201 Water Flow datasheet

Official YF-S201 Water Flow datasheetHandson Technology / generic YF-S201

Popular YF-S201 Water Flow projects

Smart water usage monitor

Count pulses on an Arduino or ESP32 and show live flow rate plus cumulative liters on an LCD or OLED, logging daily consumption.

Automatic dosing and irrigation controller

Pair the sensor with a solenoid valve so the controller shuts the valve once a target volume has passed, perfect for measured plant watering.

Volume-based beverage dispenser

Dispense a precise amount of liquid by opening a pump or valve until the pulse count reaches a preset volume, then stopping automatically.

Wi-Fi leak detection and flow logger

Stream flow data from an ESP8266 or ESP32 to a dashboard to spot unusual usage patterns and flag possible leaks in real time.

Build with the YF-S201 Water Flow.

Drop the YF-S201 Water Flow into a circuit, write firmware, and simulate it in your browser, then deploy to real hardware. All in one editable Tinkered project.