Reading Water Flow Rate from a flow meter.

This is part of a project I have been working on and I thought I would share it here . The flow meter I am using is the Water Flow Sensor found in the Seeed Studio Depo. It uses a simple rotating wheel that pulses a hall effect sensor. By reading these pulses and implementing a little math, we can read the liquids flow rate accurate to within 3%. The threads are simple G1/2 so finding barbed ends will not be that hard. I found some at lows for $1.89 each.

You will need
Seeeduino / Arduino
Water Flow Sensor
10K resistor

Wiring up the Water Flow Sensor is pretty simple. There are 3 wires: Black, Red, and Yellow.
Black to the Seeeduino's ground pin
Red to Seeeduino's 5v pin
The yellow wire will need to be connected to a 10k pull up resistor.and then to pin 2 on the Seeeduino.

Here is a fritzing diagram I made to show you how to wire it all up.

Once you have it wired up you will need to upload the following code to your Seeeduino. Once it is uploaded and you have some fluid flowing through the Water Flow Sensor, you can open the serial monitor and it will display the flow rate, refreshing every second.

// reading liquid flow rate using Seeeduino and Water Flow Sensor from Seeedstudio.com
// Code adapted by Charles Gantt from PC Fan RPM code written by Crenn @thebestcasescenario.com
// http:/themakersworkbench.com http://thebestcasescenario.com http://seeedstudio.com

volatile int NbTopsFan; //measuring the rising edges of the signal
int Calc;                               
int hallsensor = 2;    //The pin location of the sensor

void rpm ()     //This is the function that the interupt calls 
{ 
  NbTopsFan++;  //This function measures the rising and falling edge of the 

hall effect sensors signal
} 
// The setup() method runs once, when the sketch starts
void setup() //
{ 
  pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input
  Serial.begin(9600); //This is the setup function where the serial port is 

initialised,
  attachInterrupt(0, rpm, RISING); //and the interrupt is attached
} 
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop ()    
{
  NbTopsFan = 0;      //Set NbTops to 0 ready for calculations
  sei();            //Enables interrupts
  delay (1000);      //Wait 1 second
  cli();            //Disable interrupts
  Calc = (NbTopsFan * 60 / 7.5); //(Pulse frequency x 60) / 7.5Q, = flow rate 

in L/hour 
  Serial.print (Calc, DEC); //Prints the number calculated above
  Serial.print (" L/hour\r\n"); //Prints "L/hour" and returns a  new line
}

I hope this helps someone out! Thank's to Seeed Studio for hooking me up with a sensor so I could develop this tutorial.

Interesting and nice write up.

What are you going to use it for?

I am using it to measure the flow rate of the liquid cooling system in my PC. If the flow level were to drop below a certain level an alarm will sound and an LED will flash on the front of the case.

This is just part of a much larger project. I made this tutorial because there were some threads about using this sensor over on the seeedstudio.com forums. So I thought I would post it here too. I also put a link in the playground to this tutorial on my site.

Thanks for the props!

TheMakersWorkbench: Are you saying that you found water flow meter at 1.89$ ? If yes, can we order them online, I'm in Canada?

Thanks!

kb

The 1.89 was the price of misc fittings i believe.

He mentioned the flow sensor came from seeed studio depot. They sell it for $9.50 us

http://www.seeedstudio.com/depot/g12-water-flow-sensor-p-635.html?cPath=84_87

According to the description its just a rotor with a hall sensor reading its speed.

Yes the $1.89 was what the solid brass G1/2 barbed fittings cost. The flow meter is from Seeedstudio.com and cost $9.50 USD.

It's a typical magnetic flow meter which outputs an electrical pulse with every revolution. The signal is a simple square wave so its quite easy to log and convert into liters per minute using the following formula.

Pulse frequency (Hz) in Horizontal Test= 7.5Q, Q is flow rate in L/min. (Results in +/- 3% range)

The flow meter is silent wen in operation and from what I can tell, does not introduce any noticeable restriction in flow. I am pumping a cooling fluid mixture through it that is similar to common automotive antifreeze so its slightly thicker than water.

Using a CPX Pro (jingway 1200) pump from Dangerden.com I am getting an output of about 400lph on average which is consistent with testing from other independent testing labs.

I have tested this setup on another pump (Thermaltake 500lph) and the results from it are also consistent with other results I have seen.

I really hope some of you use this in your projects. If you do please email me (charles gantt at themakersworkbench dot com) a link to your project.

Very interested in the circuit, however, I am wanting to use it to measure fuel flow rate in a vehicle. I have been unable to find a suitable, economical 12v flow meter, GAH. Any tips anyone?

@Makersworkbench, have you tested to verify the 3% accuracy, and if so, over what flow range? That's very good for such an inexpensive meter. And could you post Seeed studio link for those forum discussions. We've looked around a bunch for inexpensive meters like this, and the one you have, and also a couple available from Jaycar, seem to be about it. Next step up is over US$200.

If you're also driving a pump, you may be able to use voltage to the pump to measure flow and leave out the meter; as long as your hydraulic loop doesn't change. See our work here: Riparian Rap

thanks,

Steve

@gravelbar, it's cool to see your progress with the controller since the first version using the Jaycar flow sensor. Looks like you've gone much further than just measuring flow now!

@TheMakersWorkbench, nice write-up. Also, for reference:

practicalarduino.com

Jon
Check out our Ethernet Shield with PoE support: Ethernet Shield With PoE | Freetronics

@gravelbar The 3% came from the data sheet on the flow meter. I can link to the seeedstudio forum post I mentioned but they are just 1 post topics asking for info on using this meter. No actual discussion.

That is a pretty cool project you have going on there! Can't believe I missed it.

@ Jonathan Oxer I actually got the idea for my whole project from that one project in practical arduino. I searched for months for a cheap flow sensor that was small enough to fit in a PC case.

I am working on my board layout now and should have some complete Water Cooling System control boards ready by November.

Workbench; if you just want a "flow or no flow" condition, there are other options, too, like leaving a bubble in the top of your loop and using an optical sensor to see it it's there or not. There are also simple flow switches that do this. But probably you want the cool option, and actual flow rate :slight_smile:

I was trying to use this with pachube.

But also I am trying to simulate a normal digital water meter. Do you know how I can get from flow rate to actual metering (adding the cubic meters to the already registered ones) ?

Or to put it otherwise, how many pulses makes a liter (or a cubic metre)?

As you can see, I am not that good with maths! :slight_smile:
I know that 1Liter = 0.001 cubic meters, but that's all.