Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use YF-S201 Water Flow Meter: Examples, Pinouts, and Specs

Image of YF-S201 Water Flow MeterDesign with YF-S201 Water Flow Meter in Cirkit Designer

Introduction

The YF-S201 Water Flow Meter is a compact and reliable device designed to measure the flow rate of water in a pipe. It operates using a turbine mechanism, where the flow of water spins an internal rotor. This motion generates a series of electrical pulses that can be read and processed by a microcontroller or other electronic systems. The frequency of these pulses is directly proportional to the flow rate, making it an efficient and accurate tool for water flow measurement.

Explore Projects Built with YF-S201 Water Flow Meter

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of YF-S201 Water Flow Meter Interface with SN74AHCT125N Level Shifter: A project utilizing YF-S201 Water Flow Meter in a practical application
YF-S201 Water Flow Meter Interface with SN74AHCT125N Level Shifter

This circuit is designed to interface a YF-S201 Water Flow Meter with an SN74AHCT125N buffer/level shifter, likely for signal conditioning purposes. The power supply provides the necessary voltage to the flow meter, and decoupling capacitors are used to stabilize the buffer's power supply. The circuit is prepared for further expansion or connection to a microcontroller for data processing, although no microcontroller or its code is included in the provided information.

Open Project in Cirkit Designer
Image of ESP32-Based Water Flow Monitoring System with OLED Display: A project utilizing YF-S201 Water Flow Meter in a practical application
ESP32-Based Water Flow Monitoring System with OLED Display

This circuit features an ESP32 microcontroller connected to a YF-S201 Water Flow Meter and a 0.96" OLED display. The ESP32 reads the flow rate data from the water flow meter via a digital input (D15) and communicates with the OLED display over I2C (D21 for SCK and D23 for SDA) to display the flow information. The Breadboard Power Module supplies power to the ESP32, the water flow meter, and the OLED display.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

Below are the key technical details of the YF-S201 Water Flow Meter:

Parameter Value
Operating Voltage 5V to 18V DC
Operating Current ≤ 15 mA (at 5V DC)
Flow Rate Range 1 to 30 liters per minute (L/min)
Output Pulse Frequency 4.5 Hz per L/min
Maximum Water Pressure 1.75 MPa
Operating Temperature -25°C to 80°C
Accuracy ±10%
Output Signal Pulse signal (digital)

Pin Configuration

The YF-S201 has three wires for connection:

Wire Color Function Description
Red VCC (Power) Connect to a 5V to 18V DC power source.
Black GND (Ground) Connect to the ground of the circuit.
Yellow Signal (Pulse Out) Outputs the pulse signal proportional to flow rate.

Usage Instructions

Connecting the YF-S201 to a Circuit

  1. Power Supply: Connect the red wire to a 5V to 18V DC power source. For most microcontroller applications, 5V is sufficient.
  2. Ground: Connect the black wire to the ground (GND) of your circuit.
  3. Signal Output: Connect the yellow wire to a digital input pin on your microcontroller. Use a pull-up resistor (e.g., 10kΩ) if necessary to stabilize the signal.

Important Considerations

Example Code for Arduino UNO

Below is an example of how to use the YF-S201 with an Arduino UNO to measure water flow:

// YF-S201 Water Flow Meter Example Code
// Measures water flow rate and total volume using Arduino UNO

volatile int pulseCount = 0;  // Variable to store pulse count
float flowRate = 0.0;         // Flow rate in liters per minute (L/min)
float totalVolume = 0.0;      // Total volume in liters
unsigned long lastTime = 0;   // Time tracking for calculations

// Pin configuration
const int flowSensorPin = 2;  // YF-S201 signal wire connected to digital pin 2
const float calibrationFactor = 4.5; // Pulses per liter per minute

void setup() {
  pinMode(flowSensorPin, INPUT_PULLUP); // Set pin as input with pull-up resistor
  attachInterrupt(digitalPinToInterrupt(flowSensorPin), pulseCounter, RISING);
  Serial.begin(9600); // Initialize serial communication
}

void loop() {
  unsigned long currentTime = millis();
  unsigned long elapsedTime = currentTime - lastTime;

  if (elapsedTime >= 1000) { // Calculate every second
    noInterrupts(); // Disable interrupts to safely access pulseCount
    float frequency = pulseCount / (elapsedTime / 1000.0); // Pulses per second
    flowRate = frequency / calibrationFactor; // Convert to L/min
    totalVolume += (flowRate / 60.0); // Convert to liters
    pulseCount = 0; // Reset pulse count
    lastTime = currentTime; // Update last time
    interrupts(); // Re-enable interrupts

    // Print results to serial monitor
    Serial.print("Flow Rate: ");
    Serial.print(flowRate);
    Serial.println(" L/min");
    Serial.print("Total Volume: ");
    Serial.print(totalVolume);
    Serial.println(" L");
  }
}

// Interrupt service routine to count pulses
void pulseCounter() {
  pulseCount++;
}

Notes on the Code

Troubleshooting and FAQs

Common Issues

  1. No Output Signal

    • Cause: Incorrect wiring or insufficient power supply.
    • Solution: Double-check the wiring and ensure the power supply is within the specified range (5V to 18V).
  2. Inaccurate Flow Rate

    • Cause: Calibration factor mismatch or debris in the sensor.
    • Solution: Recalibrate the sensor and clean the turbine if necessary.
  3. Unstable Readings

    • Cause: Electrical noise or lack of pull-up resistor.
    • Solution: Add a pull-up resistor to the signal line and ensure proper grounding.
  4. Sensor Not Responding

    • Cause: Flow direction is incorrect.
    • Solution: Verify that the water flow matches the arrow on the sensor body.

FAQs

Q: Can the YF-S201 measure other liquids besides water?
A: The sensor is designed for water and may not provide accurate readings for other liquids. Additionally, certain liquids may damage the internal components.

Q: How do I protect the sensor from high water pressure?
A: Ensure the water pressure does not exceed the maximum rating of 1.75 MPa. Use a pressure regulator if necessary.

Q: Can I use the YF-S201 with a 3.3V microcontroller?
A: Yes, but you will need a level shifter to safely read the 5V signal output from the sensor.

Q: How do I clean the sensor?
A: Disconnect the sensor, remove debris from the turbine, and rinse it with clean water. Avoid using harsh chemicals.