Hardware Offload Increases Energy Efficiency of Flow Sensors

作者:歐洲編輯群

資料提供者:DigiKey 歐洲編輯群

The detection of liquid or gas flow rate is an important requirement in Internet of Things (IoT) applications such as smart meters and sensors needed for monitoring airflow or liquid handling performance. The sensors often need to be deployed far away from a power source and so must rely on battery power during their lifetime. Therefore low energy consumption is essential.

In flow monitoring applications, a common choice of measurement technique is inductive sensing. This combines a rotating metal paddle wheel with a coil sensor that uses changes in voltage and current to detect the blades as they pass close by. When an AC current is applied to a coil, the AC magnetic field it generates causes eddy currents to form in the conductive target.

An LC circuit based on an inductor and a capacitor provides a low-cost way of producing the necessary AC oscillation. In such an LC circuit, the capacitor stores energy in the form of electricity, and the coil stores energy in the form of a magnetic field. When excited, the capacitor is first charged up to the DC supply voltage. When the capacitor is fully charged and the supply current is switched, the capacitor starts to discharge through the coil. The voltage across the capacitor starts falling as the current through the coil begins to rise. This rising current creates a magnetic field around the coil. When the capacitor is fully discharged, the energy previously stored in the capacitor is now stored in the inductive coil.

With no external voltage in the circuit to maintain a current within the coil, current flows back to the capacitor, which is then recharged. This whole cycle is repeated resulting in a periodic energy transfer between the two circuit elements. The polarity of the voltage changes through the energy passing between the inductor and capacitor, with the result being an AC voltage and current waveform.

Every time energy is transferred between the two circuit elements, losses occur which will decay the oscillations. This is due to the resistive circuit components, which will dissipate energy over time. The amplitude of the oscillation decreases at each half cycle of oscillation until the circuit loses all power. This damping process accelerates if a metallic object moves close to the coil because of the creation of eddy currents inside the object.

To determine the presence or absence of the conductive object, a microcontroller (MCU) algorithm measures the amplitude of the oscillating wave. Normally, the MCU will measure the voltage within the circuit at regular intervals and compare it to a reference voltage. If the input voltage falls below this reference faster than when no external damping is present, the MCU can trigger a proximity event. Analysis of the frequency of proximity events indicates the rate of flow of gas or liquid as it pushes the rotating blades around their axis.

The problem for low-energy systems such as IoT flow sensors is that a simple implementation requires that the MCU be awake to generate the excitation signal at regular intervals, and to sample the A/D converter (ADC) inputs. If the rate of flow is known to be slow, then the MCU can sleep for long periods and only wake up intermittently to take readings. However, such a strategy cannot adapt to changes in flow rate and risks missing important proximity events, leading to underestimated flow rates. If the MCU uses a more active duty-cycle, it may wake up often to find there is little change in state, resulting in wasted processing cycles and wasted energy, reducing the lifetime of the battery.

The answer to this dilemma is to move much of the sensor handling and processing to hardware peripherals. These peripherals typically operate with much lower energy consumption than an MCU, which needs a comparatively high clock rate and has to continually load instructions and data from memory to perform its tasks. Hardware circuits are much leaner and can operate at much lower clock rates while the MCU is in a low-power sleep mode.

On an MCU such as one from the NXP Kinetis L family, timers and comparators can be combined to perform much of the necessary sensor handling. If flow is reversible, the scheme can easily be extended to measurement schemes such as quadrature where two coil-based sensors are placed at 90 degrees to each other. The sensors detect the passing of the conductive blade at different times, with the relative timing used to determine speed and direction.

Diagram of NXP Kinetis L (click for full-size)

Figure 1: The circuit used to connect a timer output on the NXP Kinetis L to a coil-based flow sensor using an AND gate to shorten the excitation pulse.

In such a scheme, two timers TPM0, TPM1 can be clocked directly from a 32 kHz crystal so that they can stay running while the CPU is in a deep-sleep mode. The timers continue to count clocks, and if in the PWM mode, the timers’ outputs may be propagated on the pins that are used to generate control signals to the sensors. These signals can control the excitation of the sensors, turning on a transistor that supplies current for short period of time at the rate of the sampling frequency.

In practice, the charging time is much lower than the cycle time of a 32 kHz clock, allowing the transistor to be set up to generate a shorter pulse through the use of an RC circuit coupled with an AND gate. The resistance and capacitance values provide a delayed response to the AND gate from the rising edge of the excitation signal from the MCU timer to allow it to act as a pulse generator.

After the end of the excitation pulse, the MCU’s comparator reads out the voltage on the sensor, and generates a logic 1 that indicates an undamped pulse if the voltage is higher than the set threshold. The comparator’s multiplexer selects the signal from the sensor to be measured if quadrature measurement is being used. The comparator is controlled through the manipulation of the direct memory access (DMA) of the Kinetis MCU by the timer signals. After a predefined number of scanning cycles, the MCU is woken up to process the results that the DMA controller has passed from the comparator to on-chip RAM.

Diagram of NXP Kinetis L MCU

Figure 2: The configuration of timers and comparator on a Kinetis L MCU for quadrature flow sensing.

A configurable control block provides greater flexibility to the system designer. One example is the LESENSE peripheral controller implemented by the Gecko family of MCUs made by Silicon Labs. To autonomously analyze sensor results, the LESENSE decoder provides the ability to define a finite state machine with up to 16 states, and programmable actions upon state transitions. This allows the decoder to implement a wide range of decoding schemes, such as quadrature. A RAM block is used for storage of configuration and measurement results. This allows LESENSE to have a relatively large result buffer enabling the MCU to remain in a low energy mode for long periods of time while collecting sensor data.

Diagram of Silicon Labs Gecko MCU

Figure 3: An example of a quadrature flow-measurement setup using a Silicon Labs Gecko MCU.

With LESENSE, a comparator on the MCU can act as a pulse generator and a counter. After a DAC output under state machine control generates an excitation pulse, a comparator switches between high and low states as the LC circuit oscillates. In the damped case, that indicates the proximity of a conductive object where the number of pulses after the excitation signal will be lower than those of the undamped condition. The state machine records the pulse count and stores it to memory.

The LESENSE block is capable of processing the inputs from quadrature sensors to indicate a change in direction, and can be programmed to activate the MCU only when one or more positive readings have been taken. This eliminates demanding action from software after a pre-determined of readings, all of which may be negative.

Graph of Silicon Labs LESENSE-based detection system

Figure 4: The impact of oscillation damping on the pulse train generated by a Silicon Labs LESENSE-based detection system.

Empirical results obtained by Silicon Labs have shown that a 390 µH coil can detect metal objects up to 6 mm, and with a sampling frequency of 20 Hz, it only uses 200 nA of current in a Gecko’s deep-sleep mode, resulting in a total consumption of 1.2 μA from the oscillator and other support circuitry.

Offloading flow-sensor measurement to hardware makes it possible to keep the CPU core sleeping for longer and not incur the higher current consumption of software processing as often, which in turn maintains a system on a single battery charge for longer periods of time.

 
DigiKey logo

聲明:各作者及/或論壇參與者於本網站所發表之意見、理念和觀點,概不反映 DigiKey 的意見、理念和觀點,亦非 DigiKey 的正式原則。

關於作者

歐洲編輯群

關於出版者

DigiKey 歐洲編輯群