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

How to Use Water Flow Rate Sensor YF-S401: Examples, Pinouts, and Specs

Image of Water Flow Rate Sensor YF-S401
Cirkit Designer LogoDesign with Water Flow Rate Sensor YF-S401 in Cirkit Designer

Introduction

The Water Flow Rate Sensor YF-S401 is a compact and reliable device designed to measure the flow rate of water in a pipe. It operates by generating electrical pulses that correspond to the volume of water passing through the sensor. These pulses can be read and processed by a microcontroller or other electronic systems to calculate the flow rate and total volume of water.

Explore Projects Built with Water Flow Rate Sensor YF-S401

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino UNO Water Flow Rate Monitor with YF-S401 Sensor
Image of flow rate sensor: A project utilizing Water Flow Rate Sensor YF-S401 in a practical application
This circuit uses an Arduino UNO to read the water flow rate from a YF-S401 water flow rate sensor. The sensor is powered by the Arduino's 5V and GND pins, and its output signal is read by the Arduino's analog pin A0. The Arduino processes this signal to calculate and display the flow rate in liters per minute on the Serial Monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 Wi-Fi Connected Water Flow Meter with Battery Power
Image of phil: A project utilizing Water Flow Rate Sensor YF-S401 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
Arduino-Based Water Quality Monitoring System with SIM900A and Multiple Sensors
Image of feito: A project utilizing Water Flow Rate Sensor YF-S401 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
Arduino and ESP8266-Based Water Monitoring System with Flow Rate Sensor
Image of Arduino Uno (RP): A project utilizing Water Flow Rate Sensor YF-S401 in a practical application
This circuit monitors water presence and flow rate using a water sensor and a YF-S401 water flow rate sensor, respectively. The Arduino UNO reads the water sensor's analog signal and the flow rate sensor's pulse output, while the ESP8266 is powered but not actively used in this configuration. The Arduino processes and outputs the sensor data via serial communication for monitoring purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Water Flow Rate Sensor YF-S401

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 flow rate sensor: A project utilizing Water Flow Rate Sensor YF-S401 in a practical application
Arduino UNO Water Flow Rate Monitor with YF-S401 Sensor
This circuit uses an Arduino UNO to read the water flow rate from a YF-S401 water flow rate sensor. The sensor is powered by the Arduino's 5V and GND pins, and its output signal is read by the Arduino's analog pin A0. The Arduino processes this signal to calculate and display the flow rate in liters per minute on the Serial Monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of phil: A project utilizing Water Flow Rate Sensor YF-S401 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 feito: A project utilizing Water Flow Rate Sensor YF-S401 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 Arduino Uno (RP): A project utilizing Water Flow Rate Sensor YF-S401 in a practical application
Arduino and ESP8266-Based Water Monitoring System with Flow Rate Sensor
This circuit monitors water presence and flow rate using a water sensor and a YF-S401 water flow rate sensor, respectively. The Arduino UNO reads the water sensor's analog signal and the flow rate sensor's pulse output, while the ESP8266 is powered but not actively used in this configuration. The Arduino processes and outputs the sensor data via serial communication for monitoring purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Water dispensing systems
  • Industrial fluid monitoring
  • Smart irrigation systems
  • Home automation for water usage tracking
  • Leak detection systems

Technical Specifications

The following table outlines the key technical details of the YF-S401 sensor:

Parameter Specification
Operating Voltage 5V to 18V DC
Operating Current ≤ 15 mA (at 5V DC)
Flow Rate Range 1 to 30 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
Accuracy ±5%
Output Signal Pulse signal (digital)

Pin Configuration and Descriptions

The YF-S401 sensor has three wires for connection:

Wire Color Pin Name Description
Red VCC Power supply (5V to 18V DC)
Black GND Ground connection
Yellow Signal Pulse output signal proportional to flow rate

Usage Instructions

How to Use the Component 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. Connect the Signal Wire: Attach the yellow wire to a digital input pin on a microcontroller (e.g., Arduino UNO).
  3. Read the Pulses: Use the microcontroller to count the pulses from the signal wire. Each pulse corresponds to a specific volume of water, based on the formula: [ Flow Rate (L/min) = \frac{\text{Pulse Frequency (Hz)}}{7.5} ]
  4. Calculate Total Volume: Integrate the flow rate over time to determine the total volume of water.

Important Considerations and Best Practices

  • Ensure the sensor is installed in the correct orientation, with the arrow on the body pointing in the direction of water flow.
  • Avoid exposing the sensor to water temperatures or pressures beyond its rated limits.
  • Use a pull-up resistor (e.g., 10kΩ) on the signal line if the microcontroller requires it for stable readings.
  • Debounce the signal in software to filter out noise and ensure accurate pulse counting.

Example Code for Arduino UNO

// YF-S401 Water Flow Rate Sensor Example Code
// This code reads pulses from the sensor and calculates the flow rate in L/min.

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

void setup() {
  pinMode(2, INPUT_PULLUP); // Set pin 2 as input with pull-up resistor
  attachInterrupt(digitalPinToInterrupt(2), pulseCounter, RISING); 
  // Attach interrupt to count pulses on pin 2
  Serial.begin(9600); // Initialize serial communication
}

void loop() {
  unsigned long currentTime = millis(); // Get current time in milliseconds
  if (currentTime - lastTime >= 1000) { // Calculate flow rate every second
    noInterrupts(); // Disable interrupts to safely access pulseCount
    int pulses = pulseCount; // Copy pulse count to a local variable
    pulseCount = 0; // Reset pulse count
    interrupts(); // Re-enable interrupts

    flowRate = (pulses / 7.5); // Calculate flow rate in L/min
    Serial.print("Flow Rate: ");
    Serial.print(flowRate);
    Serial.println(" L/min");

    lastTime = currentTime; // Update the last time flow was calculated
  }
}

// Interrupt service routine to count pulses
void pulseCounter() {
  pulseCount++; // Increment pulse count on each rising edge
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Ensure the sensor is properly powered (check voltage and connections).
    • Verify that the signal wire is connected to the correct microcontroller pin.
    • Check for blockages or air bubbles in the water flow.
  2. Inaccurate Readings:

    • Confirm the sensor is installed in the correct orientation.
    • Ensure the water flow is within the sensor's rated range (1 to 30 L/min).
    • Use software debouncing to filter out noise in the signal.
  3. Intermittent Signal Drops:

    • Check for loose or damaged wiring.
    • Use a pull-up resistor on the signal line if necessary.

FAQs

Q: Can the YF-S401 measure other liquids besides water?
A: The sensor is designed for water and may not provide accurate readings with other liquids. Additionally, using it with corrosive or viscous liquids may damage the sensor.

Q: How do I calculate the total volume of water?
A: Multiply the flow rate (L/min) by the time duration (in minutes) to get the total volume. Alternatively, integrate the pulse count over time.

Q: Can I use the YF-S401 with a 3.3V microcontroller?
A: Yes, but you may need a level shifter or voltage divider to safely interface the signal output with the microcontroller.