Skip to content
Sebastian Kraus edited this page Oct 17, 2018 · 13 revisions

analytics

Unit of measure

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.

$$3.78541178 l/min ≈ 1 gal/min ≈ 0.0167 gal/s.$$

Flow sensor properties

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.

Capacity

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.

K-Factor

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:

$$KF = f / Q Q = f / 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):

$$KF' (pulses/l) = KF' (pulses/min) / (l/min) = KF'/60 (pulses/s) / (l/min) = KF (pulses/s) / (l/min)$$

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.

M-Factor

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.

$$MF = Q_actual / Q_nominal = f_actual / f_nominal = V_actual / V_nominal$$

The meter factor is applied during FlowMeter's internal calculations as follows (you don't need to do this yourself):

$$Q_corrected = f / (KF / MF) = (f / KF) * MF$$

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.

Multiple K-Factors

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.

Turndown ratio

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.

$$turndown ratio = Q_max / Q_min$$

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.

Clone this wiki locally