Fewapplications today are immune from the needto reduce energy consumption. For designersof portable and battery-powered equipment,this is a constraint that impacts thetop-line performance and usability of theirproducts. In the domestic arena, programssuch as EnergyStar have made consumers muchmore aware of the issue, not just whendevices are in use, but also when they arein standby mode. Energy is increasinglybeing recognized as a precious and limitedcommodity.
One of the main contributors to the totalenergy consumption of any system is theperformance of the microcontroller (MCU) atits heart. As a consequence, designers havesought to minimize MCU power consumption,focusing on three key areas…
The first is the active energy consumption –the amount of useful processing work the MCUcan do for a given energy input – which isobviously important. A ready measure of thiscontribution is offered by the MCU’s currentconsumption per MHz, with a benchmark figurefor a 32-bit Cortex M3 processor being the150µA/MHz achieved by the EFM32 Tiny GeckoMCUs from Energy Micro.
The processor also needs a range of sleepand deep sleep modes that require as littlecurrent as possible. Again taking theexample of the Gecko series processors, anattainable figure for stop mode is around20nA.
In practice, however, the third aspect ofpower consumption is probably the mostimportant. A sleep mode is of little use ifthere is no way for the processor to monitorexternal events while asleep, in order toknow when to wake up. In practice,therefore, most MCUs spend most of theirtime in an intermediate “waiting for input”mode.
Examples of such states are numerous. Asmartphone only needs to wake up when thereis an incoming call or message, or when theuser performs the appropriate action via theHMI (human machine interface) sensors. The“normal” state for a smart water meter is tobe waiting for water to start flowing.
The usual solution in all of these cases isfor the MCU to wake up periodically to‘check’ its sensory inputs and perform somecomputations to find out whether any actionis required. This presents a number ofchallenges. Sensor measurements commonlyrequire the system to generate specialexcitation and sampling patterns – forexample, a capacitive sensor needs to beexcited with a sine wave input.
At best,there is a trade-off between powerconsumption and the responsiveness of thesystem: a cellphone that ‘polls’ itstouchscreen interface too rarely – perhapsevery few seconds – may appear sluggish andhence difficult to use.
And the process ofwaking up can itself prove costly: makingthe transition from sleep mode to activityachieves no useful work. The designer mayfind that it is more efficient to leave theMCU in a higher level of wakefulness than toexpend energy managing these transitions.
A better, more energy-efficient approach isto choose an MCU that has a more autonomoussystem of peripherals and sensor inputs: inthis way the CPU does not have to be wokenfor every measurement.
The Energy MicroEFM32 Gecko series MCUs provide just such asystem, combining a Low Energy SensorInterface (LESENSE) with a Peripheral ReflexSystem (PRS) that permits I/O components tointeract without CPU intervention. EFM32series MCUs can therefore implementfunctions such as wake on capacitive touch,sensing of metallic objects or monitoring ofresistive sensors while in a sleep mode thatconsumes less than 1.2µA.
The PRS (Figure 1) allows signals from on-chip‘producer’ peripherals to be routed to other‘consumer’ peripherals, which may then performactions based on those inputs. ‘Producer’signals include analog comparator and GPIOlevel outputs, ‘conversion complete’ signalsfrom ADCs and DACs, overflow/underflow signalsfrom counter/timers, and ‘TX/RX complete’status messages from the UART or USART. Reflex‘consumers’ include DAC/ADC triggers, timerinputs and UART/USART enable inputs.
The PRS has eight channels, each with an edgedetector which can be used to generate logicpulses from level signals. Two registers perchannel (PRS_SWPULSE and PRS_SWLEVEL) alloweach output to be driven to asoftware-determined level, or a logic ‘1’.
The devices’ LESENSE interface builds on thisautonomous peripheral principle, allowing theMCU to monitor up to 16 external passive(resistive, capacitive or inductive) sensorsin sub-µA sleep mode. It combines analogcomparators and a DAC, under the control of asequencer module running from a 32kHz clocksource. The comparator outputs can be counted,compared or passed on directly as interrupts.For accurate measurements, the DAC can be usedas comparator reference.
The sequencer controls which pins areconnected to the comparator, how long thecomparator is active and when the outputshould be passed on to be counted or compared.Excitation with a DAC voltage or GPIO-pins canalso be executed before or while thecomparator is active. After a measurement, thecounter or comparator output is buffered andstored for later processing.
After a scan is finished, the results can bepassed on to a low power decoder withconfigurable ‘next’ states and triggerconditions. This makes it possible to capturea number of sensor-readings and combinationsand only wake up the CPU by matching a patternover time (Figure 2). For instance, wake upcan be triggered when both a temperature andhumidity sensor have reached their thresholds,or when a pressure sensor has triggered 10times in a row.
Sensor results can also be passed through thePRS to build more complex systems. This makesit possible to logically combine several GPIOpins to trigger a wake up, or use the decoderto decode serially transmitted data.
For example, the motion of a rotating vane ina water-meter can be measured with LESENSE,and the rotations counted with the quadraturecounter connected with LESENSE through the PRS. After, for example, 10 rotations, theCPU can be woken up to update the display andusage statistics. With a traditional MCU, theCPU would be needed for all the sequencing andcontrol of the comparator, whereas handlingthis via LESENSE and the PRS allows the chipto stay in deep sleep mode.
Capacitive sensing example
Capacitive sensing is very commonly used inHMI applications such as control panels andremote controls. The principle is to includethe capacitive sensor in an RC oscillatorcircuit. When a finger touches the sensor, thecapacitance changes and this in turn changesthe fundamental frequency of the oscillatorcircuit.
Such an arrangement can be implemented byconnecting the LESENSE sense pin directly tothe external peripheral. An oscillating signalfrom the output of the comparator is passed tothe peripheral, with each rising edge beingused to increment a counter. After a set time,LESENSE captures the counter value to a resultbuffer and clears the counter. The bufferedresult is then compared to a threshold level:since a finger touch results in a lowerfrequency of oscillation and a smaller countvalue, LESENSE will wake up the CPU only ifthe counter value is lower than the threshold.
The current consumed by the capacitive sensingfunction implemented in this way is influencedby several factors, including the thickness ofthe capacitive overlay and the samplingfrequency.
Empirical results have shown that for a 5mmacrylic overlay with sampling frequency at5Hz, the added consumption for each touch padis approximately 500nA. This results inapproximately 3µA total consumption for afour-button touch application sampling at 5Hz.The static consumption without sampling isless than 1µA. For improved user experiencethe sampling speed could be increased to 10Hzafter the first touch event, resulting in 5µAtotal consumption.
As we have already observed, rotationalcounting is another application in which thecombination of LESENSE and the PRS cansignificantly reduce energy consumption. Thishas rather different applications, often incontrol and feedback systems.
A typical system (Figure 4) is implementedusing inductive sensing with two coils, placedclose to a rotating wheel, half of which iscovered with metal. LESENSE samples each coilfast enough to catch the passing metal-part ofthe wheel. The output from each sampling isfed to the quadrature counter through the PRSsystem. If the counter reaches a definednumber of rotations in the same direction(three in Figure 4), it issues an interruptthat can be used to wake up the CPU.
Techniques that give an MCU a ‘sense’ of theoutside world while leaving the CPU in sleepmode are vital tools in the fight to reduceenergy consumption. The Energy Micro LESENSEinterface enables EFM32 microcontrollers tomonitor many different kinds of analog sensorswhile doing just this. Running from the lowfrequency clock source, LESENSE can monitor upto 16 sensors in sub-µA sleep modes. Typicalaverage current consumption is around 1.2µA.
Applications include any kind of capacitive,inductive or resistive sensing, rotationcounting, GPIO-state decoding or similar.LESENSE also has a fully configurable decoderwhich can evaluate sensor states and wake upthe CPU when a special combination of sensoroutputs occurs or when patterns over time aredetected. Energy friendly sensorimplementations are therefore endless, and thepossibilities are limited only by theimagination of the designer.
AndersGuldahl is an Application Engineer (AE) atEnergy Micro (www.energymicro.com),supporting customers, developingenergy-friendly code examples, and writingapplication notes. Anders also worked inEnergy Micro's Simplicity team, designingdevelopment kits for the EFM32 Geckomicrocontrollers, LESENSE peripherals, andcapacitive touch. He holds a Master's Degree in controlsystems engineering from The NorwegianUniversity of Science and Technology (NTNU) inTrondheim, Norway.
This article was published previously on EETimes.