Flowmeter: everything you need to know

flow meter

Measure fluid flow or consumption it is important in some cases, and for this you need a flow meter. For example, if you follow Formula 1, you will know that the FIA ​​forces teams to use a flow meter in the engine to detect the consumption that each team makes in their cars and thus avoid possible traps by injecting greater flow to get more power at times. or how oil is used to burn the engine ...

But outside of F1, you may be interested in having one of these devices to know what consumption of water or any other liquid a system has, or also determine the flow rate of a tube that draws from a tank to determine when it is consumed, automated garden irrigation systems, etc. The applications of these elements are many, you can set the limit yourself.

Flowmeter or flowmeter

How should you know the flow is the amount of a liquid or fluid that circulates through a pipe or stub per unit of time. It is measured in units of volume divided by unit of time, such as liter per minute, liter per hour, cubic meter per hour, cubic meters per second, etc. (l / min, l / h, m³ / h, ...).

What is a flow meter?

El flowmeter or fluid meter It is the device that is capable of measuring that amount of flow that goes through a pipe. There are several models and manufacturers that can be easily integrated with the Arduino. This flow rate will depend on several factors, such as the section of the pipe and the supply pressure.

By controlling those two parameters and with a flow meter that measures the flow, you can have a sophisticated control system for the fluids. Very useful for home automation or other electronic and even industrial projects. For home projects, makers have well known models like the YF-S201, FS300A, FS400A, etc.

Flowmeter types

In the market you will find various types of flowmeters or flow meters depending on the use you give it and the budget you want to invest. In addition, some of them are specific for a fluid, such as water, fuel, oil, others have greater or lesser precision, with prices ranging from a few euros to thousands of euros in some very advanced at an industrial level:

  • Mechanical flowmeter: it is a very typical meter that everyone has in the house to measure the water they consume in their meters. The flow turns a turbine that moves a shaft that is connected to a mechanical counter that accumulates the readings. Being mechanical, in this case it cannot be integrated with Arduino.
  • Ultrasonic flowmeter- Widely used in industry, but extremely expensive for home use. You can measure flow rate by the time it takes for ultrasound to pass through the fluid to be measured.
  • Electromagnetic flowmeter: They are also often used in the industry for pipes up to 40 inches and high pressures. They cost very expensive and use an electromagnetic system for measurement.
  • Electronic Turbine Flowmeter: low cost and very accurate. These are the ones that you can easily integrate with your Arduino and are used for home use as well. They use a turbine with blades that turns as the fluid flow passes through it and a Hall effect sensor will calculate the flow according to the RPMs that it reaches in the turn. The problem is that being intrusive, they have a high pressure drop and suffer deterioration in their parts, so they will not last long ...

Taking into account that we are interested in electronics, we are going to continue studying these ...

Flowmeters for Arduino and where to buy

The electronic type flow meters used in ArduinoLike the YF-S201, YF-S401, FS300A, and FS400A, they have a plastic casing and a rotor with blades inside, as I mentioned before. A magnet fixed to the rotor and its rotation, by Hall effect, will determine the flow or consumption that it is measuring at all times. The sensor output will be a square wave with a frequency proportional to the flow through it.

The so-called K conversion factor between frequency (Hz) and flow (l / min) depends on the parameters that the manufacturer has given to the sensor, therefore, it is not the same for all. In the datasheets or model information you buy will have these values ​​so that you can use them in the Arduino code. Neither will the precision be the same, although in general, these for Arduino tend to vary between 10% above or below with respect to the current flow.

The recommended models are:

  • YF-S201: it has a connection for a 1/4 ″ tube, to measure flow between 0.3 to 6 liters per minute. The maximum pressure that it tolerates is 0.8 MPa, with maximum fluid temperatures of up to 80ºC. Its voltage works between 5-18v.
  • YF-S401: in this case, the connection to the tube is 1/2 ″, although you can always use converters. The flow it measures is from 1 to 30 l / min, with pressures of up to 1.75 MPa and fluid temperatures of up to 80ºC. Its voltage, however, is still 5-18v.
  • FS300A: same voltage and same maximum temperature as the previous ones. In this case with 3/4 ″ pipes, with a maximum flow of 1 to 60 l / min and pressures of 1.2 MPa.
  • FS400A: it also maintains voltage and maximum temperature with respect to its alternatives, also the maximum flow and pressure are the same as for the FS300A. The only thing that varies is that the tube is 1 inch.

You must choose the one that interests you the most for your project ...

Integration with Arduino: a practical example

Arduino connected to flowmeter

La connection of your flow meter is very simple. They usually have 3 cables, one for data collection on the flow, and the other two for power. The data can be connected to the Arduino input that suits you best and then program the sketch code. And the power supply ones, one to the 5V and another to GND, and that would be enough for it to start working.

But for it to have some kind of function, first you have to create the code in Arduino IDE. The ways to use this flow sensor are many, and also the ways to program it, although here you have a practical and simple example so you can start to see how it works:

const int sensorPin = 2;
const int measureInterval = 2500;
volatile int pulseConter;
 
// Si vas a usar el YF-S201, como en este caso, es 7.5.
//Pero si vas a usar otro como el FS300A debes sustituir el valor por 5.5, o 3.5 en el FS400A, etc.
const float factorK = 7.5;
 
void ISRCountPulse()
{
   pulseConter++;
}
 
float GetFrequency()
{
   pulseConter = 0;
 
   interrupts();
   delay(measureInterval);
   noInterrupts();
 
   return (float)pulseConter * 1000 / measureInterval;
}
 
void setup()
{
   Serial.begin(9600);
   attachInterrupt(digitalPinToInterrupt(sensorPin), ISRCountPulse, RISING);
}
 
void loop()
{
   // Con esto se obtiene la frecuencia en Hz
   float frequency = GetFrequency();
 
   // Y con esto se calcula el caudal en litros por minuto
   float flow_Lmin = frequency / factorK;
 
   Serial.print("Frecuencia obtenida: ");
   Serial.print(frequency, 0);
   Serial.print(" (Hz)\tCaudal: ");
   Serial.print(flow_Lmin, 3);
   Serial.println(" (l/min)");
}

And if you want get consumption, then you can use this other code, or combine both to have both ... For consumption, the flow achieved must be integrated with respect to time:

const int sensorPin = 2;
const int measureInterval = 2500;
volatile int pulseConter;
 
//Para el YF-S201 es 7.5, pero recuerda que lo debes modificar al factor k de tu modelo
const float factorK = 7.5;
 
float volume = 0;
long t0 = 0;
 
 
void ISRCountPulse()
{
   pulseConter++;
}
 
float GetFrequency()
{
   pulseConter = 0;
 
   interrupts();
   delay(measureInterval);
   noInterrupts();
 
   return (float)pulseConter * 1000 / measureInterval;
}
 
void SumVolume(float dV)
{
   volume += dV / 60 * (millis() - t0) / 1000.0;
   t0 = millis();
}
 
void setup()
{
   Serial.begin(9600);
   attachInterrupt(digitalPinToInterrupt(sensorPin), ISRCountPulse, RISING);
   t0 = millis();
}
 
void loop()
{
   // Obtención del afrecuencia
   float frequency = GetFrequency();
 
   //Calcular el caudal en litros por minuto
   float flow_Lmin = frequency / factorK;
   SumVolume(flow_Lmin);
 
   Serial.print(" El caudal es de: ");
   Serial.print(flow_Lmin, 3);
   Serial.print(" (l/min)\tConsumo:");
   Serial.print(volume, 1);
   Serial.println(" (L)");
}

You already know that depending on what you need you must modify this code, in addition, it is very important to put the K factor of the model you bought or it will not take actual measurements. Do not forget!


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.