Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

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

Image of YF-S201
Cirkit Designer LogoDesign with YF-S201 in Cirkit Designer

Introduction

The YF-S201 is a water flow sensor designed to measure the flow rate of water in a pipe. It operates using a Hall effect sensor that detects the movement of a rotor inside the sensor. As water flows through the sensor, the rotor spins, and the Hall effect sensor generates a pulse signal proportional to the flow rate. This makes the YF-S201 an ideal choice for applications requiring accurate water flow monitoring, such as:

  • Water dispensers
  • Irrigation systems
  • Industrial water flow monitoring
  • Smart home water management systems
  • Liquid flow measurement in research and development

Explore Projects Built with YF-S201

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
YF-S201 Water Flow Meter Interface with SN74AHCT125N Level Shifter
Image of Copy of flow: A project utilizing YF-S201 in a practical application
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.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino-Based Water Quality Monitoring System with SIM900A and Multiple Sensors
Image of feito: A project utilizing YF-S201 in a practical application
This circuit is a water quality monitoring system that uses an Arduino UNO to collect data from a YF-S201 water flow meter, a turbidity sensor, and a temperature sensor. The collected data is then transmitted via a SIM900A GSM module to a remote server or user through SMS. The system measures water flow rate, temperature, and turbidity, and sends periodic updates.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 Wi-Fi Connected Water Flow Meter with Battery Power
Image of phil: A project utilizing YF-S201 in a practical application
This circuit features an ESP32 microcontroller connected to a Water Flow Rate Sensor YF-S401 and powered by a 2000mAh battery. The ESP32 reads the water flow data from the sensor, calculates the water volume consumed, and provides this information via a web server over WiFi.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Water Flow Monitoring System with OLED Display
Image of Smart Flow Metre: A project utilizing YF-S201 in a practical application
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.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with YF-S201

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 Copy of flow: A project utilizing YF-S201 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.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of feito: A project utilizing YF-S201 in a practical application
Arduino-Based Water Quality Monitoring System with SIM900A and Multiple Sensors
This circuit is a water quality monitoring system that uses an Arduino UNO to collect data from a YF-S201 water flow meter, a turbidity sensor, and a temperature sensor. The collected data is then transmitted via a SIM900A GSM module to a remote server or user through SMS. The system measures water flow rate, temperature, and turbidity, and sends periodic updates.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of phil: A project utilizing YF-S201 in a practical application
ESP32 Wi-Fi Connected Water Flow Meter with Battery Power
This circuit features an ESP32 microcontroller connected to a Water Flow Rate Sensor YF-S401 and powered by a 2000mAh battery. The ESP32 reads the water flow data from the sensor, calculates the water volume consumed, and provides this information via a web server over WiFi.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Smart Flow Metre: A project utilizing YF-S201 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.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

The YF-S201 water flow sensor has the following key technical details:

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 F = 7.5 * Q (Q = flow rate in L/min)
Maximum Water Pressure 1.75 MPa
Operating Temperature -25°C to 80°C
Sensor Body Material Nylon
Output Signal Pulse signal (digital)

Pin Configuration and Descriptions

The YF-S201 has three wires for connection:

Wire Color Function Description
Red VCC Connect to the positive supply voltage (5V to 18V)
Black GND Connect to ground
Yellow Signal (Pulse Out) Outputs the pulse signal proportional to flow rate

Usage Instructions

How to Use the YF-S201 in a Circuit

  1. Power the Sensor: Connect the red wire to a 5V to 18V DC power source and the black wire to ground.
  2. Read the Signal: Connect the yellow wire to a microcontroller's digital input pin to read the pulse signal.
  3. Calculate Flow Rate: Use the formula Flow Rate (L/min) = Pulse Frequency / 7.5 to calculate the flow rate based on the pulse frequency.

Important Considerations and Best Practices

  • Ensure the water flow direction matches the arrow printed on the sensor body.
  • Avoid exposing the sensor to water pressures exceeding 1.75 MPa to prevent damage.
  • Use a pull-up resistor (typically 10kΩ) on the signal line if the microcontroller requires it for stable readings.
  • Filter the water before it enters the sensor to prevent debris from clogging the rotor.
  • Mount the sensor horizontally for optimal performance and accuracy.

Example Code for Arduino UNO

The following code demonstrates how to interface the YF-S201 with an Arduino UNO to measure and display the water flow rate:

// YF-S201 Water Flow Sensor Example Code
// Connect the sensor's red wire to 5V, black wire to GND, and yellow wire to pin 2.

volatile int pulseCount = 0; // Variable to store the pulse count
float flowRate = 0.0;        // Variable to store the flow rate in L/min
unsigned long lastTime = 0;  // Variable to store the last time measurement was taken

void setup() {
  pinMode(2, INPUT_PULLUP); // Set pin 2 as input with pull-up resistor
  attachInterrupt(digitalPinToInterrupt(2), countPulse, RISING); 
  // Attach interrupt to pin 2, triggered on rising edge
  Serial.begin(9600); // Initialize serial communication at 9600 baud
}

void loop() {
  unsigned long currentTime = millis(); // Get the current time in milliseconds
  if (currentTime - lastTime >= 1000) { 
    // Calculate flow rate every second
    flowRate = (pulseCount / 7.5); // Convert pulse count to flow rate in L/min
    Serial.print("Flow Rate: ");
    Serial.print(flowRate);
    Serial.println(" L/min");
    pulseCount = 0; // Reset pulse count for the next measurement
    lastTime = currentTime; // Update the last time measurement was taken
  }
}

void countPulse() {
  pulseCount++; // Increment pulse count on each pulse
}

Notes on the Code

  • The countPulse function is triggered by an interrupt on pin 2 whenever a pulse is detected.
  • The flow rate is calculated every second and displayed via the serial monitor.
  • Ensure the Arduino UNO is powered appropriately and connected to the sensor as described.

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Pulse Signal Detected

    • Verify the wiring connections, especially the yellow signal wire.
    • Ensure the water is flowing through the sensor and the rotor is spinning.
    • Check if the microcontroller's input pin is configured correctly.
  2. Inaccurate Flow Rate Readings

    • Ensure the sensor is mounted horizontally and the water flow direction matches the arrow.
    • Check for debris or blockages in the sensor that may hinder rotor movement.
    • Verify the formula used to calculate the flow rate is correct.
  3. Sensor Not Responding

    • Confirm the power supply voltage is within the specified range (5V to 18V).
    • Inspect the sensor for physical damage or leaks.

FAQs

Q: Can the YF-S201 measure liquids other than water?
A: The YF-S201 is designed for water. Using it with other liquids may affect accuracy or damage the sensor.

Q: How do I protect the sensor from debris?
A: Install a water filter upstream of the sensor to prevent debris from entering and clogging the rotor.

Q: What is the maximum cable length for the signal wire?
A: For best performance, keep the signal wire as short as possible (less than 1 meter). Use shielded cables for longer distances to reduce noise.

Q: Can I use the YF-S201 with a 3.3V microcontroller?
A: Yes, but you may need a level shifter or voltage divider to ensure the signal voltage is compatible with the microcontroller's input.

By following this documentation, you can effectively integrate the YF-S201 water flow sensor into your projects for accurate and reliable water flow measurement.