Computing stuff tied to the physical world

Relax and live longer

Now let’s see how little power the LPC810 can consume when in “deep power-down” mode.

All it takes to fully power down is a few lines of C code:

#include "LPC8xx.h"

int main () {
    SCB->SCR |= 1<<2;       // enable SLEEPDEEP mode
    LPC_PMU->PCON = 3;      // enter deep power-down mode
    __WFI();                // wait for interrupt, powers down
}

The problem here is how to measure the ridiculously tiny current involved. But it’s actually quite simple, thanks to Ohm’s law: if we place a 10 kΩ resistor in series with the µC, then the voltage drop will be proportional to the current, with 1 µA of current leading to a 10 mV voltage drop: enough for a modern multimeter to measure accurately in its lowest range.

The only remaining problem is the initial startup current surge, which is a few milliamps. What we need to do is put the resistor in series, with a voltmeter across it, but short out the resistor while powering up. Once it is in deep sleep, we remove the short and measure.

Result: the LPC810 consumes a mere 0.266 µA (266 nA!) in deep sleep mode.

That’s less than a millionth of a Watt of power (Watt = Volts x Amps).

Unfortunately, this setup is not very useful. The only way to wake up the µC from this state is to pull its WAKEUP pin low (pin 2). It has no way to wake up on its own anymore.

A considerably more useful configuration is to activate the low-power watchdog timer, and use it to periodically wake up from deep power-down. This was used in the minimal and fader demos in jcw/embello to make the LED blink.

There’s another demo on GitHub called relax, which goes to sleep for an entire minute between blinks. It’s really just a small variation of the original minimal demo. With a timeout of a minute, there’s enough time to measure the sleep mode current consumption, with an occasional blink to let us know we haven’t lost the ability to wake up again.

New result: 1.125 µA current consumption with the watchdog running.

Let’s estimate how long the “relax” demo would run on a standard CR2032 coin cell:

  • we’ll keep the LED on for 0.5s once every 60s, i.e. less than 1 % duty cycle
  • assuming a 4 mA current draw, this translates to 40 µA on average
  • the 1.125 µA current consumption can more or less be ignored in this case
  • a fresh CR2032 coin cell normally has a capacity of at least 200 mAh
  • with 40 µA, that’s 5000 hours of runtime, i.e. over half a year
  • it’d be trivial to increase this to a year: simply reduce the ON time to 0.25s

Note that on a coin cell, the LED can’t be placed in series with the µC – we need to modify the code slightly to toggle an I/O pin and connect the LED with a series resistor to it.

Now let’s leave the LED out, and assume this setup has something else useful to do which takes 10 ms once a minute. While running, let’s also assume that the µC + attached circuit draws a whopping 25 mA. Then we can adjust the above estimate as follows:

  • 10 ms every 60 is a 1:6000 duty cycle, so 25 mA averages out to only about 4 µA
  • add to that the 1.125 µA needed while the circuit is asleep, i.e. most of the time
  • if we round off a bit, this circuit will draw 5 µA on average
  • again using the same coin cell, we get a 200 mAH / 5 µA = 40,000 hours of run time
  • that’s four years on a coin cell, for a circuit which wakes up once per minute

Now we’re getting somewhere: think of a wireless sensor node. Using a coin cell!

In conclusion: with everything covered in this Getting Started series, you should now be able to program LPC810 chips and make them do all sorts of things. From generating a 15 MHz square wave (or anything else that needs this sort of processing “power”) to running off a coin cell without having to replace it for several years. How’s that for flexibility, eh?

It’s all just a matter of software plus electronics – and anyone can get into the game.

[Back to article index]