Water Flow Rate Measurement with Flow Sensor

Water Flow Rate Measurement with Flow Sensor

Objective

This experiment uses a flow sensor to measure the rate of water flow through a pipe.

Required Components

Working Principle

The water flow sensor uses a magnetic rotor to generate pulses that can be measured to calculate the flow rate.

Circuit Diagram

Flow Sensor Circuit Diagram

Arduino Code


/*
 * Water Flow Rate Measurement with Flow Sensor
 * This code reads the flow sensor data and calculates the flow rate.
 */

const int flowPin = 2;  // Flow sensor connected to digital pin 2
volatile int flowCount = 0;

void flow() {
    flowCount++;  // Increment the flow count when a pulse is detected
}

void setup() {
    pinMode(flowPin, INPUT);
    attachInterrupt(digitalPinToInterrupt(flowPin), flow, RISING);
    Serial.begin(9600);  // Initialize serial communication
}

void loop() {
    flowCount = 0;
    interrupts();
    delay(1000);  // Wait for 1 second
    noInterrupts();
    float flowRate = flowCount / 7.5;  // Flow rate in liters per minute
    Serial.print("Flow Rate: ");
    Serial.print(flowRate);
    Serial.println(" L/min");
}
            

Results

The serial monitor will display the water flow rate in liters per minute.

Applications

Conclusion

The flow sensor provides an accurate and easy-to-implement method for measuring water flow rates, making it useful for a variety of applications like irrigation and industrial monitoring.