Water Flow sensor



  • Hi.
    I'm using this water flow sensor G12 water flow sensor.jpg using the code available from the pulse water meter but the values i'me getting are all rong...
    I'm triyng to adapt the code to this water flow sensor with no luck.

    Could anyone give me an help with the code?
    Thanks in advance.


  • Hero Member

    @mrc-core I believe this type of meter outputs 4.5 pulses per liter, but there are a number of different specs for similar meters. Do you have a link to the one that you actually purchased? The example sketch is for meters that output 1 pulse per liter (or 1000 pulses for 1 cubic meter). Therefore change PULSE_FACTOR to 4500 in the sketch. You may need to adjust that number. I would get a large bucket for which you know how many liters it is and then count the number of pulses required to fill it. Take that number, divide it by the size of the bucket (in liters) and then multiply by 1000. That number becomes your PULSE_FACTOR.

    Cheers
    Al


  • Hardware Contributor

    I using this sensor

    #define PULSE_FACTOR 450

    All sensor has different property. Read instruction or make measurement.

    I made measurement because documentation has different value



  • Thanks for the replay.

    The only specs i have about this sensor is this:
    Specifications
    Mini. Wokring Voltage: DC 4.5V
    Max. Working Current: 15mA (DC 5V)
    Working Voltage: DC 5V~24V
    Flow Rate Range: 0~60L/min
    Load Capacity: ≤10mA (DC 5V)
    Operating Temperature: ≤80℃
    Liquid Temperature: ≤120℃
    Operating Humidity: 35%~90%RH
    Water Pressure: ≤2.0MPa
    Storage Temperature: -25~+ 80℃
    Storage Humidity: 25%~95%RH

    Going to try today at home to change the #define PULSE_FACTOR has sayd and see if i get more real values.
    Once again thanks for helping me.



  • Hi,

    Here you can find a simplified version of the WaterFlow node.
    This version only sends to the GW the current flow volume in liters/hour.
    I don't know your model (G??) as the pulses per liter/hour vary from different flow sensors. Mine is G1" so the math is for this sensor.

    I had a problem with interrupts, and this was the way i found to work.

    Hope this helps!

    #include <SPI.h>
    #include <MySensor.h>  
    
    #define DIGITAL_INPUT_SENSOR 3                  // The digital input you attached your sensor.  (Only 2 and 3 generates interrupt!)
    #define SENSOR_INTERRUPT DIGITAL_INPUT_SENSOR-2        // Usually the interrupt = pin -2 (on uno/nano anyway)
    
    #define CHILD_ID 1                              // Id of the sensor child
    
    int READ_INTERVAL = 3;           // Read interval to count the pulses (in seconds). 
    
    long lastReadStart;
    int flow;
    
    MySensor gw;
    MyMessage flowMsg(CHILD_ID,V_FLOW);
    
    
    int READ_INTERVAL_MILLIS=READ_INTERVAL * 1000;        // Just to simple the math!
    volatile unsigned long pulseCount = 0;   
    
    void setup()  
    {  
      gw.begin(); 
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Water Meter", "1.2");
    
      // Register this device as Waterflow sensor
      gw.present(CHILD_ID, S_WATER);       
    
      pulseCount = 0;
    
      lastReadStart = millis();
    
      attachInterrupt(SENSOR_INTERRUPT, onPulse, RISING);
    }
    
    
    void loop()     
    { 
      unsigned long currentTime = millis();
    	
    
      if (currentTime - lastReadStart > READ_INTERVAL_MILLIS)
      {
        flow = pulseCount*60/READ_INTERVAL;  //Need to change here for the G type
        lastReadStart=currentTime;
         
    
    
          Serial.print("l/hour:");
          Serial.println(flow);
          gw.send(flowMsg.set(flow));
          
          pulseCount = 0;
      }
    }
    
    
    void onPulse()
    {
      pulseCount++; 
    }```


  • Hi thanks for the code.
    My water flow sensor it's the FS300A G3/4
    Flow Range: 1-60L/min
    Working Pressure: <1.20/Mpa

    I'm still having some troble on the readdings from this sensor.
    I'm getting for an example in 00:30min readings almost 1.000 m3...


  • Hero Member

    @mrc-core said:

    FS300A G3/4

    This one: http://www.seeedstudio.com/wiki/G3/4_Water_Flow_sensor ? It indicates 5.5 pulses per liter, so you should have 5500 as your PULSE_FACTOR. I would still measure it though as each unit is likely slightly different.

    Cheers
    Al



  • Hi. Yes its The same sensor.
    ill try toda with The value 5500.
    This Will seem a dumb question but how can i measure it?


  • Hero Member

    @mrc-core said:

    This Will seem a dumb question but how can i measure it?

    @Sparkman already told you how to measure it

    @Sparkman said:

    I would get a large bucket for which you know how many liters it is and then count the number of pulses required to fill it. Take that number, divide it by the size of the bucket (in liters) and then multiply by 1000. That number becomes your PULSE_FACTOR.



  • Thanks to all for the help.
    Problem solved using the value 5500 at PULSE_FACTOR.
    Up until now the values i'm getting seem correct.

    The only problem now is the domoticz over raspberry that from time to time hangs up an lose connectivity to mysensor serial gateway.

    That's another problem to solve.

    Once again thanks for the help.



  • Hi

    These sensors are really quite neat. I got quite accurate measurements from 4,9 to 44 litres/min, I couldn't go any higher, the output fed into the audio input on the PC with a simple and free frequency meter software. Amazing for a few dollars.

    The downturn is the pressure loss across the meter, 0.08 bars at 15 L/min rising to 0,69 bars at 41.8 L/min : Here are what I measured
    dP
    L/min flowmeter
    15 0,08
    18,4 0,04
    24,7 0,21
    26,5 0,24
    30,7 0,29
    34,2 0,4
    37,3 0,51
    40,0 0,63
    41,8 0,72
    42,5 0,69


 

183
Online

8.7k
Users

9.5k
Topics

99.9k
Posts