Tutorial: Reading Water Flow rate with Water Flow Sensor

HEY

I have bought a G1/2 Water Flow sensor . But it gives an output for only upto 3 lpm .

What changes do i have to make to this sensor so that it can measure upto 6 or 7 lpm.

Do i use a more sensitive hall effect sensors so that it is able to capture the faster rotations of the rotor. Could you please suggest a hall effect sensor .

REPLY ASAP PLEASE.

Thanks for posting.



I’m newbie of seeeduino/arduino.



In this case what the relation between 10k resistor and measuring max LPM?

And is it correct that 10k resistor connect between 5V and 2nd pin of Seeeduino?

I’m trying to connect the G1/2 flow sensor to an Atmel attiny85 chip. I’m having trouble having the chip read the sensor. Are there any tricks i.e. pins I should use or a special way to callout the sensor?



thanks.

Is the amplitude voltage level of pulse signal dependent on the input voltage level? For example if the input voltage is 24 V then will the amplitude level of the pulse be 24 V ?

I believe I have found a mistake in the code!!



It says



Calc = (NbTopsFan * 60 / 7.5); to give the litres per minute.



This line is incorrect as NbTopsFan gives the amount of pulses in the one minute time.

60 is the amount of seconds in a minute

and 7.5 is the litre converter



so at the moment, using units only, the result is min/L



so just change it around to get an appropriate result

Calc = (NbTopsFan * 7.5 / 60) // this will result in pulses(litres)/minute

hey presto all you people wondering why your code didn’t work :slight_smile:

I have couple of these YF-S201 flow sensors and I can’t find how it has to be mounted.

Some sites say vertical and other horizontal. :?

What is the correct orientation?

Or are both correct?



basile

Hi,



Just a quick question about the figure 7.5 that is used in the calculation. Is this for when the sensor is in a horizontal or vertical position? And if the figure differs on different orientations what would be the respective figure for the pulse frequency be?



Cheers :smiley:

Guysss…



Have anyone did this sensor coded in python? I am actually stuck with this. Couldnt be able to get any value.



Please help me. I m new to raspberry pi.

Hi,



I know this thread is mostly about interfacing with water flow sensor from Ardruino, but looks like a few folks trying to do the same using raspberry pi. After checking a bunch of tutorials and posts on raspberry pi + water flow sensor this is what I have come up with so far.



This is a very basic program in python which just counts ticks from the sensor. I haven’t put any water through it yet to see how accurate this is.



How I have sensor connected to GPIO pins



black to GND

red 5v0

yellow through 560 ohm resistor to #23



here is a code, I have to paste it here as I am too new of a user to link to github.

[code]
#!/usr/bin/env python

import RPi.GPIO as GPIO
import time, sys

FLOW_SENSOR = 23

GPIO.setmode(GPIO.BCM)
GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)

global count
count = 0

def countPulse(channel):
global count
count = count+1
print count

GPIO.add_event_detect(FLOW_SENSOR, GPIO.RISING, callback=countPulse)

while True:
try:
time.sleep(1)
except KeyboardInterrupt:
print ‘\ncaught keyboard interrupt!, bye’
GPIO.cleanup()
sys.exit()

[/code]

I am new to raspberry pi/ GPIO and not 100% sure on a few things
[list]

  • Do I need a resistor?
    Should I have a bouncetime? Doesn't look like I need to, i've tried to rotate pin wheel 360 degrees and it consistently gave me 3 pulses.
  • [/list]

    Thanks!

    Anton

    I recently purchased this sensor and I was hoping to use in conjunction with a 1/4 tube used as a straw. Naturally, when you drink from a straw there are pauses each time you swallow. I’ve read here that this sensor doesn’t do well with frequent start/stops. Is this an impractical use of the sensor? The liquid I’m measuring would be water.





    Also, on a side note, when putting this together I noticed that it’s not quite air tight (maybe you naturally let air in when you drink from a straw?). This results in lots of tiny bubbles and I end up burping for a few minutes after drinking (lol!!). I think this might be solved with a valve similar to the camelbak valves or maybe I need to seal up all the seams on the sensor with some silicone.



    Thanks!!

    Hi,

    I am using water flow sensor for measurement,i am connecting my sensor in such a way that one end is connected to the tap where water comes in and other end is connected to rotating tap through pipe where water comes out, i am measuring the pulses(count)output by the sensor. in my scenario i am measuring the pulses(count) for half liter. at different flow rates my pulse count is different for half liter,but i should get same pulse count for half liter at different flow rates.





    Regards

    Arun

    Hi all!



    Does anybody have the datasheet for the G1" Water Flow Sensor?



    I am looking for the value of the constant that gives the relation between flowrate and pulses per minute the sensor is sending (7.5 for G1/2", 5.5 for G3/4")



    I have found the datasheet for G1/2" sensor, flow rate vs frequency rate for G1/4" G3/4" but nothing on G1" sensor





    Thanks,



    Sebastian

    Sorry for replying in such an old post but I really need this information!



    Can I make this work WITHOUT using interruptions? I mean, using regular inputs (analog probably) or PWM inputs?



    Thank you and sorry again.

    Very interesting…

    Think I might use it in my own applications. Only question: is it waterproof, or will i need to make it water proof?

    Thanks!

    What distance can you send the signal from the flowmeter? How do you determine this? If the yellow signal wire to the seeeduino is 50 yards, would it still read properly on pin 2?

    Hello,

    I have a flow meter and have everything wired up to an arduino uno. the signal is coming in at digital port 4. my problem is that when i power the arduino and upload the code, without having the pump on i get values like 520, 512 etc. I am testing the system with a small fish tank pump and when i turn it on, i now get values like 240, 304, 248 etc.



    Three questions,

    1)why am i getting 520 when there is no water flowing through the meter? I would expect this to be zero not a value like 520

    2)Why do values vary so much on every sample? i can see 224, 280, 356, 404, 232,288 etc when the pump is just pumping the same amount more or less.

    3)In the sample code the equation is



    Calc = (NbTopsFan * 60 / 4.5); // (Pulse frequency x 60) / 4.5Q, = flow rate in L/hour



    but in the comments above, it seems that the 4.5 suppose to be 7.5. Which one is correct?



    Thanks

    I’m trying to interface the sensor with Arm7.

    Can you tell me what pin2 corresponds to so that i can interface it with ARM7.


    How appropriate would this sensor be for measuring small amounts of liquid, like cups of beverage from a beverage dispenser? I would ideally like to achieve centiliter accuracy, if I pour a 50 centiliter cup of liquid (half a liter), is this sensor going to be resolute enough? …Do I risk being off by 1.5 cl or so per beverage? Or better yet, can it be calibrated?


    This is very interesting! Thanks for posting. I have a question around a practical example I’m thinking about putting together around this. I see the the “accurate within 3%” note and I get a bit nervous…

    Hey folks,

    I was working on this and noticed that it wasn’t set up right. I edited the code and left a detailed explanation of my code. See below:
    // The Code is for the High Precision PVC Water Flow Sensor YF-S401
    // It has a hall effect sensor, meaning that when the water passes through it rotates the
    // rotor. The rotation of the rotor gives a corresponding pulse signal

    volatile float NbTopsFan; //measuring the rising edges of the signal for the hall sensor
    float flowls; // flow rate in L/s
    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
    Serial.println(“CLEARDATA”); // clears starting at row 2
    // define 2 columns named “Time (sec)” and “Flow (L/s)”
    Serial.println(“LABEL, Time (sec), Flow (L/s)”);
    // Please note that the last two Serial.println() commands are for the PLX-DAQ
    // extension for Excel
    }
    // 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, this value could be varried according to needs
    cli(); //Disable interrupts
    flows = (NbTopsFan/5880); // The specifications read that F (Frequency)= 98Q(Flow Rate)
    // meaning that if we want flow rate Q = F/98 that gives L/min divide by 60 to get L/s
    // therefore 98
    60=5880 in the denominator Q = F/5880. F is NbTopsFan. Q has error of 2%
    // the calibration values vary based on sensor used
    Serial.print((String) "DATA, TIMER, ");
    Serial.print(flowls, 6); // Print with 6 decimal places
    Serial.println();

    }

    Hope this helps :slight_smile:
    -Vikentiy