Introduction


                A flow sensor is a device which measures the rate at which a fluid is passing through a pipe, they have many diverse applications, and are used whenever one needs to keep track of amounts of fluid entering or leaving a chamber.


Theory


            There are many different types of flow meters but a schematic of a simple and common type, a paddle flow meter, is shown below. Fluid flows through the pipe at the bottom, the faster the   

                                                                 

                                                                           Figure 1: Paddle flow meter.

fluid flows, the faster the turbine wheel rotates. Each time the turbine wheel rotates, a magnet passes the Hall sensor and registers a pulse, from the pulse rate the turbine speed, and thus the volumetric flow rate can be determined.


Technical Specifications


The flow meter featured in this tutorial is shown below. It has .5” male input and output                            


                                                                       Figure 2: .5" plastic flow meter #828

threads, the sensor will return 450 pulses per liter of fluid, or equivalently, the flow rate in l/min = frequency of pulses in Hz / 7.5.


Connections


            The connections for the #828 flowmeter are shown below in figure 3. The yellow wire, the sensor output should be connected to analog in, the red and black wires should be connected to 5v and ground respectively.

                                                                                                                                            

                                                             Figure 3: Arduino to #828 flowmeter connection.


Code


    This code will return flow rate data at a rate of 2 Hz, this can be adjusted by changing the delay(5); command in the code below, however if it is made too small the accuracy will decrease.


void setup()
{
  // put your setup code here, to run once:
 Serial.begin(9600);     // to view data
}


float pulses = 0;          // counter for number of pulses
int i = 0;                 // counter for sensor readings
int data[100] = {};        // array to hold sensor output
float to = millis();       // starting time of data collection interval
float t;                   // ending time of data collection interval
float dt;                  // length of data collection interval

float freq;     // frequency of pulses
float V;        // flow rate in l/min


void loop()
{

  // put your main code here, to run repeatedly:
  data[i] = analogRead(A0);         // read sensor
  delay(5);                                    // wait 5 ms for stability

  // check for pulse after 2nd sensor reading
  if(i >= 1)
  {
    if( (data[i] >= 1000 && data[i-1] <= 100) || (data[i-1] >= 1000 && data[i] <= 100))
    {
      pulses++;
    }
  }

  // if 100 readings have been taken
  if(i == 99)
  {
    t = millis();                   // time at end of data collection interval
    dt = (t-to)/1000;         // length of data collection interval in seconds
    freq = pulses/dt;        // frequency of pulses in interval
    V = freq/7.5;               // volumetric flow rate in liters per min
   Serial.println(V,5);     // display data

    // reset for next interval
    i = 0;
    to = t;
    pulses = 0;
  }
  else
  {
    i++;
  }
}

We ship to the GCC and MENA regions.

Reliable and fast shipping to your door, quality assured.

More about shipping

Find us on
Instagram

Just type @idea_link

Visit our profile