Fluid / Flow
Interfacing YF-S201 Fluid / Flow with Arduino Uno
What is the YF-S201?
YF-S201 practical reference
The YF-S201 is a Hall-effect water flow sensor built around a small plastic turbine: as water flows through the housing, the internal rotor spins and a Hall sensor generates a pulse train whose frequency is proportional to the flow rate. It's the standard low-cost sensor for DIY water meters, irrigation controllers, and smart plumbing projects, letting a microcontroller calculate liters-per-minute simply by counting pulses per second.
Key specifications
- Sensor type: Hall-effect turbine flow sensor
- Operating voltage: 5 V–24V DC (5V is standard for microcontroller projects)
- Operating current: ~15 mA
- Flow rate range: 1–30 liters per minute
- Output: Digital pulse train, frequency proportional to flow rate
- Pulse-to-flow formula: Frequency (Hz) ≈ 7.5 × flow rate (L/min), per manufacturer datasheet
- Max working pressure: ~1.75 MPa
- Pipe fitting: 1/2 inch (G1/2) threaded connections, inline installation
- Interface: Single digital pin, read via pulse counting or an interrupt
Pinout and connection notes
Attach the signal wire to an interrupt-capable pin and count pulses over a fixed time window (e.g. 1 second) to compute flow rate using the ~7.5 pulses-per-liter-per-minute constant from the datasheet; because the sensor is a mechanical turbine, always install it with the flow direction arrow molded into the housing matching the actual water flow direction.
- Red (VCC): Power, 5–24V DC
- Black (GND): Ground
- Yellow (Signal): Pulse output — connect to a digital input pin, ideally interrupt-capable
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up YF-S201 with Arduino Uno
Library
None — built-in attachInterrupt() by —
No library needed; uses core Arduino interrupt functions.
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| Red (VCC) | 5V | |
| Black (GND) | GND | |
| Yellow (Signal) | D2 | Hall-effect pulse output — must use an interrupt-capable pin (2 or 3 on the Uno). |
Swipe sideways to see every column →
- The 7.5 pulses-per-litre-per-minute constant is the commonly cited YF-S201 datasheet figure, but individual units vary — for billing-grade or dosing-critical accuracy, calibrate against a known measured volume rather than trusting the constant as-is.
- Must use pin 2 or 3 on an Uno (the only interrupt-capable pins) — polling this signal in the main loop instead of using an interrupt will miss pulses at any meaningful flow rate.
- Rated for water only, up to about 120psi and 80°C — check the datasheet before using with other liquids or high-pressure lines.
Related Components
Related Guides & Projects
Arduino Uno R4 Minima Pinout: Every GPIO, ADC, DAC, and Op-Amp Pin Explained
A complete Arduino Uno R4 Minima pinout reference — digital I/O, ADC, DAC, op-amp, CAN, dual UART, and exactly what it leaves out compared to the WiFi variant.
Mastering PWM on Arduino: Dimming LEDs and Controlling Motors
Understand what PWM actually is on Arduino, dim an LED smoothly, and safely control a DC motor's speed with a driver chip -- plus the mistakes (like wiring a motor straight to a pin) that damage boards.
4-Digit 7-Segment Counter with TM1637 & Arduino
Drive a TM1637-based 4-digit 7-segment display with Arduino Uno to show a real-time up/down counter, elapsed timer, and scrolling text. Covers library setup, brightness control, and custom segment mapping.
Arduino Uno R4 Minima vs WiFi: Which One Should You Choose?
Same processor, same memory, different price. Here's what the WiFi variant's extra hardware actually gets you, and when the Minima is the smarter buy.