[tutorial] How to use the Water Flow Sensor


In this tutorial you will learn how to use one water flow sensor with an Arduino board.

The water flow sensor consists of a plastic valve body, a water rotor and a hall-effect sensor. When the water flows through the rotor, rotor rolls and the speed of it changes with a different rate of flow. The hall-effect sensor outputs the corresponding pulse signal.

This type of sensor can be found on different diameters, water pressure (MPa) and flow rate (L/m) ranges. Make sure to select one that will cover your needs. The sensor that I have it has 20mm diameter, <1.75Mpa water pressure and ~30 L/m flow rate range.

In this tutorial we will use the serial monitor for printing the water flow rate in liters per hour and the total of liters flowed since starting.

So let’s get started!

What you will need

For this tutorial you will need:

  • Arduino uno
  • Water flow sensor
  • 3 breadboard cables

The circuit

The connections are pretty easy, see the above image with the breadboard circuit schematic.

The code

Here’s the code, embedded using Codebender!

Try downloading the Codebender plugin and clicking on the “Run on Arduino” button to program your Arduino board with this sketch. And that’s it, you’ve programmed your Arduino with this sketch!

You can keep playing with that by clicking the “Edit” button and start making your own modifications to the code. For example you can change in the line 58 the “1000” ms delay time.

Serial Monitor – Testing

Press the connect button below to start the serial communication.

Connect your sensor with your water tap, or just blow on it.

Note: The back side of the sensor show with one arrow the correct flow side.

Well done!

You have successfully completed one more Arduino “How to” tutorial and you learned how to use the water flow sensor.

I hope you liked this, let me know in the comments.


  1. Vipul Patel

    15 Dec 2016 12:05:44

    It is very informative blog. The explanation about usage of water flow sensor with an Arduino Board is quite justified. It appreciative work thanks for this blog.

  2. Vipul Patel

    22 Dec 2016 08:23:33

    Thanks for the sharing information. It is really very helpful blog. To get more information about different models of water flow sensor check this website http://www.broiltech.com

  3. Shantharaju

    28 May 2017 05:53:47

    how to switch off Status Led(pin13) if output liquid quantity reaches1000ml?

  4. Hiten Makwana

    08 Jan 2018 23:32:57

    Can i get the program code of the liquid dispensing unit which gives desired amount of liquid out of the dispensing unit.
    Example:-fuel dispensing unit

  5. Ayman

    28 Jul 2018 17:07:00

    Hi, thank you for posting the code! I am really new to the arduino and I have tried to use your example but I have a problem with reading any values, plus the serial shows 3mL at start even without anything flowing – also the LED status is on all the time since it can sense a reading.

    I have tried to use other code just to test whether the sensor is working properly and that I am using the correct input pin and it is correct.

    But I am not sure why it does read a measurement from the beginning while there is no flow of water through the sensor , neither can I read any data when blowing into the sensor

    • Ayman

      28 Jul 2018 17:08:58

      my code is exactly the same as yours, I have just changed the Pin numbers:

      byte statusLed = 13;
      byte sensorInterrupt = 0; // 0 = digital pin 4 = D2 (on nodeMCU)
      byte sensorPin = 4;

Comments are closed.

Stay tuned:

* we promise that we won´t spam you, never.