YF-S201 Water Flow Sensor
Measures liquid flow rate for smart water meters and irrigation systems.
Wiring & code for
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.
Board Integration
Related