-
Notifications
You must be signed in to change notification settings - Fork 42
Properties
The FlowMeter library expresses flow in the unit l/min. Most units of measure can be derived by simple conversion (just try not to measure in Sverdrups).
As an example, conversion between l/min and US gal/min can be done with a factor of 3.78541178, conversion from min to s with a factor of 60.
There's a structure FlowSensorProperties in the library that you can use to customize for your flow sensor (see the rest of this page for details):
typedef struct {
double capacity; // capacity
double kFactor; // k-factor
double mFactor[10]; // m-factors
} FlowSensorProperties;
A default set of properties is supplied in order to get you started. You should apply your sensor's datasheet values in order to get meaningful flow rate and volume figures.
Assuming your sensor's capacity, K-Factor and Arduino pin are given as cap
, kf
and pin
.
Then your custom flow meter could be initialized like this:
// define the sensor characteristics here
const double cap = 50.0f; // l/min
const double kf = 5.5f // Hz per l/min
const int pin = 2; // INT0 pin on most Arduinos
// let's provide our own sensor properties (without applying further calibration)
FlowSensorProperties MySensor = {cap, kf, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
// now initialize the flow meter with the pin and sensor settings
FlowMeter Meter = FlowMeter(pin, MySensor);
Please see the Simulation or Calibration examples for an actual application of these settings.
A flow sensor has a capacity, i.e. a maximum flow rate that it is able to handle without failing or producing erroneous output.
Sometimes the usable range of a sensor is smaller than its capacity would suggest. See the turndown ratio section for details.
The FlowMeter stores the sensor capacity in the capacity
field of its FlowSensorProperties
structure.
This is definitely the most important quantity of the flow sensor you use.
In theory a flow sensor (as considered in this library) converts a frequency into a flow rate.
The conversion factor between frequency f
and flow rate Q
is called the K-Factor KF
:
Some manufacturers don't state the K-Factor as a frequency per flow rate (e.g. KF pulses/s per liter/min
), but as a number of pulses per volume (e.g. KF' pulses/liter
).
The conversion factor between these two units is 1/60 (min/s)
:
If you're dealing with a different unit of measure, don't forget to take care of proper conversion.
The FlowMeter stores the K-Factor in the kFactor
field of its FlowSensorProperties
structure.
Practical flow sensors are non-ideal in that their output signal contains nonlinearities.
This error can be compensated (see: calibration) by taking measurements at different flow rates, frequencies and/or volumes, and then deriving a set of (near unity) factors.
The meter factor is applied during FlowMeter's internal calculations as follows (you don't need to do this yourself):
The FlowMeter stores the M-Factors in the mFactor
field of its FlowSensorProperties
structure.
If you don't provide individual mFactor
values with your custom FlowSensorProperties
, simply fill in the unity factor 1.
What if your sensor comes with a set of K-Factors instead of a single number? That's simple: don't worry about the single K-Factor, just treat your set of K-Factors like M-Factors.
Let's say the manufacturer of your sensor states different K-Factors for different flow rates:
$$$$That's fine, you can directly use these figures with the FlowMeter library.
The turndown ratio can be referred to as the "rangeability" of a sensor. It describes the ratio between maximum and minimum flow rates at which the sensor can still deliver a usable signal.
The turndown ratio of a typical flow meter can be assumed as approximately 10:1.
You should consider this when choosing a flow sensor for your purpose. As a general rule, refrain from using a sensor at its absolute maximum or minimum flow rate if you expect reliable results. You can calibrate your sensor for your application's range.