Source: https://mokxi.com/parts/yfs201
Updated: 2026-11-16

Part

# Water flow sensor, YF-S201

A pinwheel and a Hall sensor in a pipe: SIG pulses 7.5 times a second per liter a minute. Also the YF-S401, YF-B10 and YF-DN50.

See every part

- 3 pins
- 2 settings
- In 2 projects
- In 1 lesson

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Water flow sensor, YF-S201 in brief

What it is, and every setting the properties panel gives it.

The YF-S201 is a Hall effect water flow sensor: a pinwheel in a pipe pulses SIG as the water turns it, 7.5 pulses a second for every liter a minute, which is 450 pulses a liter. The pins are VCC, 5 V to 18 V, GND and SIG. The model property also offers the YF-S401, the brass YF-B10 and the YF-DN50, each with its own formula, and the flow property is the flow it starts with in liters a minute. SIG is high over 4.5 V and low under 0.5 V on 5 V, 50 percent duty, an open collector with a 10 k pull-up to VCC inside. The slider in the window sets the flow and the wheel turns with it. Real accuracy of 3 to 10 percent is not modeled.

Family

Sensors

Pins

3

model

YF-S201 (or YF-S401, YF-B10, YF-DN50)

flow

0

Pins

## 3 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

VCC

Supply, the red wire: 5 V to 18 V on a YF-S201, 5 V to 12 V on a YF-S401, 3.5 V to 24 V on a YF-B10 or YF-DN50.

GND

Ground, the black wire.

SIG

The pulses, the yellow wire.

How to use it

## How to read a YF-S201 water flow sensor with an Arduino

VCC goes to the Uno’s 5 V, GND to ground and SIG to pin 2, which is an interrupt pin. The sensor makes 7.5 pulses a second for each liter a minute, so a sketch counts the pulses on an interrupt and divides. Do not count them in loop() with digitalRead(): at 30 L/min the sensor makes 225 pulses a second.

This sketch counts falling edges, and once a second turns the new pulses into the flow, pulses a second times 2/15 in L/min, and the total, 450 pulses to the liter. A 16x2 LCD on its I2C backpack, SDA on A4 and SCL on A5, shows both. Drag the flow slider and the wheel and the numbers follow.

Part pin

Board pin

VCC

5V

GND

GND

SIG

Pin 2

The pull-up inside goes to VCC, so SIG swings to whatever you power the sensor from. From 12 V it puts 12 V pulses on a board pin, so run it from 5 V.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

Count pulses on an interrupt

Common errors

## Common Water flow sensor, YF-S201 errors and fixes

What goes wrong

The fix

The count is far too low.

Counting in loop() with digitalRead() misses pulses. Use attachInterrupt() on pin 2 or 3.

The flow is wrong for a different sensor.

Each model has its own factor: F = 7.5 x Q on the YF-S201, 98 x Q on the YF-S401, 8 x Q minus 4 on the YF-B10 and 0.2 x Q on the YF-DN50.

SIG reaches 12 V.

The pull-up inside goes to VCC. Powered from 12 V, SIG pulses to 12 V, so run it from 5 V.

Questions

## Questions and answers

### How many pulses a liter does the YF-S201 make?

450, since the frequency in hertz is 7.5 times the flow in liters a minute.

### What flow range does the YF-S201 measure?

1 to 30 liters a minute.

### Which Arduino pin should the flow sensor use?

An interrupt pin, 2 or 3 on an Uno, so each pulse is counted with attachInterrupt().

How it is modeled

## What is true about the Water flow sensor, YF-S201, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

From the spec sheets and listings, which are all the paperwork there is:

Model
Pipe
Formula (F in Hz, Q in L/min)
Pulses a liter
Range

YF-S201
G1/2
F = 7.5 x Q
450
1 to 30 L/min

YF-S401
1/8 inch
F = 98 x Q
5880
0.3 to 6 L/min

YF-B10
G1, brass
F = 8 x Q - 4
about 476
2 to 50 L/min

YF-DN50
G2
F = 0.2 x Q
12
10 to 200 L/min

The YF-S401's figures are DFRobot's (SEN0216). The YF-B10's are the SEA listing's
and most sellers'; an older one-page sheet gives 6 x Q - 8, so calibrate a real
one. Under 0.5 L/min its formula gives no pulses, and neither does the model.

The output. High over 4.5 V and low under 0.5 V on 5 V, 50% duty: an open
collector with a pull-up inside, here 10 kohm to VCC (an assumption). A sketch's own
INPUT_PULLUP changes nothing.

### Not modeled

A real sensor's accuracy, 3 to 10% (the model's pulses are exact, so calibrate a
real one with a measuring jug); the low flow at which a real wheel stops turning; the
water pressure; and a wheel that spins on for a moment after the tap closes.

From Water flow sensor, YF-S201, in full.

Projects

## See the Water flow sensor, YF-S201 in a project

2 built-in projects use it. Each opens in the editor, already wired.

Lessons

## Where it turns up in a lesson

One lesson places it in its own circuit.

### Learn articles

1 lesson

- Arduino Water Flow Sensor (YF-S201): Code and Wiring

Boards

## The boards it is shown on

This board has a built-in project with the Water flow sensor, YF-S201 in it.

- Arduino Uno R3

Keep going

## Keep going

- Arduino Interrupts: attachInterrupt on Pin 2 and 3
- Interrupts vs Polling on Arduino, Side by Side
- Character LCD with I2C backpack
- Water level sensor
- Mini water pump

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Water flow sensor, YF-S201

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
