Few applications today are immune from the need to reduce energy consumption. For designers of portable and battery-powered equipment, this is a constraint that impacts the top-line performance and usability of their products. In the domestic arena, programs such as EnergyStar have made consumers much more aware of the issue, not just when devices are in use, but also when they are in standby mode. Energy is increasingly being recognized as a precious and limited commodity.
One of the main contributors to the total energy consumption of any system is the performance of the microcontroller (MCU) at its heart. As a consequence, designers have sought to minimize MCU power consumption, focusing on three key areas...
The first is the active energy consumption – the amount of useful processing work the MCU can do for a given energy input – which is obviously important. A ready measure of this contribution is offered by the MCU’s current consumption per MHz, with a benchmark figure for a 32-bit Cortex M3 processor being the 150µA/MHz achieved by the EFM32 Tiny Gecko MCUs from Energy Micro
The processor also needs a range of sleep and deep sleep modes that require as little current as possible. Again taking the example of the Gecko series processors, an attainable figure for stop mode is around 20nA.
In practice, however, the third aspect of power consumption is probably the most important. A sleep mode is of little use if there is no way for the processor to monitor external events while asleep, in order to know when to wake up. In practice, therefore, most MCUs spend most of their time in an intermediate “waiting for input” mode.
Examples of such states are numerous. A smartphone only needs to wake up when there is an incoming call or message, or when the user performs the appropriate action via the HMI (human machine interface) sensors. The “normal” state for a smart water meter is to be waiting for water to start flowing.
The usual solution in all of these cases is for the MCU to wake up periodically to ‘check’ its sensory inputs and perform some computations to find out whether any action is required. This presents a number of challenges. Sensor measurements commonly require the system to generate special excitation and sampling patterns – for example, a capacitive sensor needs to be excited with a sine wave input. At best, there is a trade-off between power consumption and the responsiveness of the system: a cellphone that ‘polls’ its touchscreen interface too rarely – perhaps every few seconds – may appear sluggish and hence difficult to use. And the process of waking up can itself prove costly: making the transition from sleep mode to activity achieves no useful work. The designer may find that it is more efficient to leave the MCU in a higher level of wakefulness than to expend energy managing these transitions.
A better, more energy-efficient approach is to choose an MCU that has a more autonomous system of peripherals and sensor inputs: in this way the CPU does not have to be woken for every measurement. The Energy Micro EFM32 Gecko series MCUs provide just such a system, combining a Low Energy Sensor Interface (LESENSE) with a Peripheral Reflex System (PRS) that permits I/O components to interact without CPU intervention. EFM32 series MCUs can therefore implement functions such as wake on capacitive touch, sensing of metallic objects or monitoring of resistive sensors while in a sleep mode that consumes less than 1.2µA.
Figure 1. The EFM32 Peripheral Reflex System, configured to initiate an ADC single conversion in response to a TIMER0 overflow, and provide an analog comparator output as input for the compare/capture channel on TIMER1.
The PRS (Figure 1) allows signals from on-chip ‘producer’ peripherals to be routed to other ‘consumer’ peripherals, which may then perform actions based on those inputs. ‘Producer’ signals include analog comparator and GPIO level outputs, ‘conversion complete’ signals from ADCs and DACs, overflow/underflow signals from counter/timers, and ‘TX/RX complete’ status messages from the UART or USART. Reflex ‘consumers’ include DAC/ADC triggers, timer inputs and UART/USART enable inputs.
The PRS has eight channels, each with an edge detector which can be used to generate logic pulses from level signals. Two registers per channel (PRS_SWPULSE and PRS_SWLEVEL) allow each output to be driven to a software-determined level, or a logic ‘1’.
The devices’ LESENSE interface builds on this autonomous peripheral principle, allowing the MCU to monitor up to 16 external passive (resistive, capacitive or inductive) sensors in sub-µA sleep mode. It combines analog comparators and a DAC, under the control of a sequencer module running from a 32kHz clock source. The comparator outputs can be counted, compared or passed on directly as interrupts. For accurate measurements, the DAC can be used as comparator reference.
The sequencer controls which pins are connected to the comparator, how long the comparator is active and when the output should be passed on to be counted or compared. Excitation with a DAC voltage or GPIO-pins can also be executed before or while the comparator is active. After a measurement, the counter or comparator output is buffered and stored for later processing.
After a scan is finished, the results can be passed on to a low power decoder with configurable ‘next’ states and trigger conditions. This makes it possible to capture a number of sensor-readings and combinations and only wake up the CPU by matching a pattern over time (Figure 2). For instance, wake up can be triggered when both a temperature and humidity sensor have reached their thresholds, or when a pressure sensor has triggered 10 times in a row.
Figure 2: Conditional wake-up on analog events.
Sensor results can also be passed through the PRS to build more complex systems. This makes it possible to logically combine several GPIO pins to trigger a wake up, or use the decoder to decode serially transmitted data.
For example, the motion of a rotating vane in a water-meter can be measured with LESENSE, and the rotations counted with the quadrature counter connected with LESENSE through the PRS. After, for example, 10 rotations, the CPU can be woken up to update the display and usage statistics. With a traditional MCU, the CPU would be needed for all the sequencing and control of the comparator, whereas handling this via LESENSE and the PRS allows the chip to stay in deep sleep mode. Capacitive sensing example
Capacitive sensing is very commonly used in HMI applications such as control panels and remote controls. The principle is to include the capacitive sensor in an RC oscillator circuit. When a finger touches the sensor, the capacitance changes and this in turn changes the fundamental frequency of the oscillator circuit.
Such an arrangement can be implemented by connecting the LESENSE sense pin directly to the external peripheral. An oscillating signal from the output of the comparator is passed to the peripheral, with each rising edge being used to increment a counter. After a set time, LESENSE captures the counter value to a result buffer and clears the counter. The buffered result is then compared to a threshold level: since a finger touch results in a lower frequency of oscillation and a smaller count value, LESENSE will wake up the CPU only if the counter value is lower than the threshold.
Figure 3: Capacitive sensor.
The current consumed by the capacitive sensing function implemented in this way is influenced by several factors, including the thickness of the capacitive overlay and the sampling frequency.
Empirical results have shown that for a 5mm acrylic overlay with sampling frequency at 5Hz, the added consumption for each touch pad is approximately 500nA. This results in approximately 3µA total consumption for a four-button touch application sampling at 5Hz. The static consumption without sampling is less than 1µA. For improved user experience the sampling speed could be increased to 10Hz after the first touch event, resulting in 5µA total consumption.Counting rotations
As we have already observed, rotational counting is another application in which the combination of LESENSE and the PRS can significantly reduce energy consumption. This has rather different applications, often in control and feedback systems.
A typical system (Figure 4) is implemented using inductive sensing with two coils, placed close to a rotating wheel, half of which is covered with metal. LESENSE samples each coil fast enough to catch the passing metal-part of the wheel. The output from each sampling is fed to the quadrature counter through the PRS system. If the counter reaches a defined number of rotations in the same direction (three in Figure 4), it issues an interrupt that can be used to wake up the CPU.
Figure 4: Counting rotations.Summary
Techniques that give an MCU a ‘sense’ of the outside world while leaving the CPU in sleep mode are vital tools in the fight to reduce energy consumption. The Energy Micro LESENSE interface enables EFM32 microcontrollers to monitor many different kinds of analog sensors while doing just this. Running from the low frequency clock source, LESENSE can monitor up to 16 sensors in sub-µA sleep modes. Typical average current consumption is around 1.2µA.
Applications include any kind of capacitive, inductive or resistive sensing, rotation counting, GPIO-state decoding or similar. LESENSE also has a fully configurable decoder which can evaluate sensor states and wake up the CPU when a special combination of sensor outputs occurs or when patterns over time are detected. Energy friendly sensor implementations are therefore endless, and the possibilities are limited only by the imagination of the designer.About the author
Anders Guldahl as an Application Wngineer (AE) at Energy Micro (www.energymicro.com
), supporting customers, developing energy-friendly code examples, and writing application notes. Anders also worked in Energy Micro's Simplicity team, designing development kits for the EFM32 Gecko microcontrollers, LESENSE peripherals, and capacitive touch.
Anders holds a Master's Degree in control systems engineering from The Norwegian University of Science and Technology (NTNU) in Trondheim, Norway.
If you found this article to be interest, visit Microcontroller / MCU Designline
where – in addition to my Max's Cool Beans
blogs on all sorts of "stuff" – you will find the latest and greatest design, technology, product, and news articles with regard to all aspects of designing and using microcontrollers.
Also, you can obtain a highlights update delivered directly to your inbox by signing up for my weekly newsletter – just Click Here
to request this newsletter using the Manage Newsletters tab (if you aren't already a member you'll be asked to register, but it's free and painless so don't let that stop you [grin]).
Last but certainly not least, make sure you check out all of the discussions and other information resources at All Programmable Planet
. For example, in addition to blogs by yours truly, microcontroller expert Duane Benson is learning how to use FPGAs to augment (sometimes replace) the MCUs in his robot (and other) projects.