12
\$\begingroup\$

Most microcontrollers (e.g. AVRs,MSP430s, PICs, etc) support a number of different sleep modes. The "deepest" sleep mode is the one that purports the lowest power draw (e.g. "Power Down", "Shut Down"), but all the clock systems are typically halted in these modes and it seems to me that the only way to "wake up" from them is via external stimulus (e.g. pin change interrupts, chip reset). Am I missing something? Are there awesomely low power methods of generating a periodic wakeup signal for an MCU?

Assuming my goal is to minimize power consumption (i.e. sleep deeply for as long as possible, stay awake as briefly as possible), while periodically waking up to execute a function, what's the common way to achieve this type of behavior? To further simplify matters, lets assume that my function is stateless (I don't have to remember anything from the past to perform it).

I've had some success using the WDT on the MSP430 to get this effect. I just made my main routine be my function, with the last line enabling the watchdog timer to expire after a certain period and going into LPM4.5 or whatever the "deep sleep" mode is called. The net result is the function is performed, the MCU sleeps, the WDT expires, and the chip resets, ad nauseum. Seems to work, just wondering if there is a "better" or "more elegant" or "more power efficient" way of getting this type of behavior?

I haven't tried this approach with an AVR yet, but I think the WDT is more "power hungry" in the AVRs than on the MSP430 so it may be less attractive for low power work. Perhaps there is not a "universal" approach to low power, and you have to use the tools afforded by a given product line? I know the new picoPower line has lots of whiz-bang features like the Event System and Sleep Walking that in some cases hardly require the CPU to be awake at all if you can make your application fit into that structure...

OK enough of my wandering, lets here what ya'll have to say :)

Edit Concrete examples illustrating techniques would also be cool!

\$\endgroup\$
14
\$\begingroup\$

Most micros support a low-power 32.768 kHz watch crystal oscillator with some kind of prescaler and timer interrupt. Set the prescaler so the timer is counting slowly and the interrupt happens at the period you desire.

Some micros also have a built-in low-power RC timer if exact timing isn't critical.

The datasheet for any low-power micro will list the power with 32.768 oscillator (and nothing else) running. It's pretty close to zero. You can do the math to see if this is acceptable, and compare it to the current drawn by the watchdog.

OK, for example on the msp430f2013, let's look at power in the datasheet.

0.5 μA is almost zero, although it is five times the true OFF mode.

For more detail, we can look inside the datasheet.
Going from LPM4 (everything off) to LPM3 (running the oscillator) is the difference between 0.5 μA and 1 μA.

Suppose the battery is CR2032 with 225 mAh capacity. Then standby in LPM4 is about 50 years and in LPM3 is about 25 years. 25 years is long enough for many applications, because the ON-current (during the measurement itself) dominates the consumption.

alt text

\$\endgroup\$
  • \$\begingroup\$ feel free to pick a concrete example... :) \$\endgroup\$ – vicatcu Nov 30 '10 at 22:09
  • \$\begingroup\$ done, for msp430f2013 and cr2032 cell. \$\endgroup\$ – markrages Nov 30 '10 at 22:37
  • \$\begingroup\$ We use Cr2032 at my work with the ACLK at 32768, waking every 2 seconds. We use a Transceiver every 90 seconds. We take a temp measurement every 10 seconds. We can last in excess of 4 years with a new CR2032. \$\endgroup\$ – Kortuk Nov 30 '10 at 23:26
3
\$\begingroup\$

Some parts have pretty low-power oscillators (a few uA) for wakeup, and some PICs also have hardware to allow a very slowly rising voltage on a pin to wake - this can be from an external capacitor set up before sleeping to charge over the required wake period.

\$\endgroup\$
3
\$\begingroup\$

PICs with RTCs can have the RTC set to an alarm state, so it will wake up the MCU at a given time, with an external 32.768kHz crystal. They draw ~450nA IIRC in RTC+sleep mode, but only 20nA with RTC off.

\$\endgroup\$
3
\$\begingroup\$

AVR watchdog timers aren't as bad as you seem to think. According to the ATTiny13A datasheet, current draw in power-down mode @3V is 2μA without the WDT enabled, and 4μA with. Sure, it's 2x more, but the current itself is small enough for around 6.2 years of operation, which is around the same amount of time it takes the battery to degrade by itself anyway (source: the best-before date).

Additionally, practically anything else you hook up around the μC would draw lots more. In fact, the trickiest part of designing such a low-power circuit is shutting off all current in the rest of the schematic during the sleep period.

The wakeup delay is also nicely configurable, from ~12ms to 8s, if memory serves. The actual frequency doesn't make any noticeable difference if short interrupt routines are used: I got away with turning on the ADC, sampling a 1K pot, calculating some stuff from the results and going back to sleep with no noticeable change in overall consumption (smoothed with a large capacitor to compensate for the sluggishness of my multimeter).

Do note that the WDT is not an accurate timekeeping tool, so you might want to hook up an external RTC. Those can consume mere nanoamps, so it should be a good pairing. In fact, if the RTC in question can generate regular pulses, you could use that as your wakeup source instead of the WDT at the cost of using up a pin.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.