Products Guidance

Hall Effect Water Flow Sensor - Complete Guide

2026-04-27 09:18:09 iSentrolTechnology信准科技 1
Hall Effect Water Flow Sensor | Complete Guide

Hall Effect Water Flow Sensor | Complete Guide

Turbine-type Hall Flow Sensor · Principles · Selection · Installation · Wiring · Code · Calibration

1. Working Principle

Core structure: Plastic valve body + Turbine impeller with magnet + Hall sensor

  1. Water flows in from the inlet, driving the turbine impeller to rotate

  2. The magnet on the impeller rotates with the wheel, causing periodic magnetic field changes

  3. The Hall sensor detects magnetic field changes and outputs square wave pulses (HIGH/LOW)

  4. Pulse frequency is proportional to flow rate; total pulse count is proportional to water volume

  5. Microcontroller (e.g., Arduino) reads pulses to calculate flow rate and volume

Key Specifications

USN-HS21TA

G1/2 interface | 5V | 600 pulses/L | Flow: 1-30L/min

2. Selection Guide

  • Interface Size: G1/2 (4分)

  • Flow Range: 1-30L/min

  • Voltage: DC 5V, compatible with Arduino/microcontrollers

  • Media: Clean cold/warm water, avoid debris

  • Accuracy: Typical ±3%, suitable for consumer and DIY projects

3. Installation Steps

1. Correct Direction

The sensor housing has a water flow arrow. It must match the actual flow direction or no signal will be output.

2. Pipe Installation

  • Connect in series at the water inlet, horizontal installation is best

  • Leave 5~10cm straight pipe before and after to reduce turbulence

  • Use Teflon tape for sealing, do not over-tighten

3. Environment

  • Keep away from strong magnetic fields

  • Operating temp: 0~60°C, avoid prolonged high temperature

4. Hardware Wiring

3-wire sensor (Red/Black/Yellow), simple wiring, no extra components needed

Sensor PinWire ColorArduino PinDescription
VCCRed5VPower positive
GNDBlackGNDPower ground
SIGYellowD2Pulse output (External interrupt)

Note: Signal pin must connect to interrupt pin to avoid missing pulses

5. Code Implementation

Function: Output instantaneous flow (L/min) and cumulative volume (L) every second

// Define pins and parameters
#define sensorPin 2          // Signal pin connected to D2
#define pulsePerLiter 600    // USN-HS21TA: 600 pulses/L
volatile unsigned long pulseCount = 0;
unsigned long oldTime = 0;
float flowRate = 0;
float totalVolume = 0;

void setup() {
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING);
}

void loop() {
  if (millis() - oldTime > 1000) {
    detachInterrupt(digitalPinToInterrupt(sensorPin));

    flowRate = ((float)pulseCount / pulsePerLiter) * 60.0;
    totalVolume += (float)pulseCount / pulsePerLiter;

    Serial.print("Flow: ");
    Serial.print(flowRate, 2);
    Serial.print(" L/min | Volume: ");
    Serial.print(totalVolume, 2);
    Serial.println(" L");

    pulseCount = 0;
    oldTime = millis();
    attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING);
  }
}

void pulseCounter() {
  pulseCount++;
}

6. Calibration & Troubleshooting

Calibration Method

  1. Prepare a container with known volume (e.g., 1L graduated cylinder)

  2. Run water and record serial output, compare with actual volume

  3. Fine-tune pulsePerLiter until error < 3%

Troubleshooting

No pulse signal (flow = 0):

  • Check wiring: Red=5V, Black=GND, Yellow=Signal

  • Verify water flow direction arrow

  • Clean impeller debris

  • Verify 5V power supply

Flow fluctuating/inaccurate:

  • Add straight pipe sections, install horizontally

  • Avoid strong magnetic interference

  • Verify pulse coefficient

7. Applications

Appliance Control

Water heater/coffee machine flow detection

Smart Water Saving

Smart irrigation, auto valve shutoff

DIY Projects

Water circulation monitoring, measured dispensing

Summary

Hall Effect Water Flow Sensor Key Points: Correct direction, proper wiring, matching pulse coefficient

Follow this guide and beginners can quickly get started with accurate flow and volume measurement.

Hall Effect Water Flow Sensor | Complete Tutorial

Home
Product
News
Contact