Skip to content
A

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

  1. Confirm the exact part number and breakout-board revision.
  2. Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
  3. Check controller pin assignments and bus address or interface mode against the example code.
  4. Power up with external loads disconnected, then test signals before full integration.
  5. 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 pinArduino Uno pinNote
Red (VCC)5V
Black (GND)GND
Yellow (Signal)D2Hall-effect pulse output — must use an interrupt-capable pin (2 or 3 on the Uno).

Swipe sideways to see every column →

C++
  • 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