Cheap and cheerful way to save power?

I'm looking for easy ways to save power for a battery powered robot.

So I've been looking at the Arduino/Atmega processing model, and I've been a little surprised at the loop() programming model, which effectively keeps the processor running at full speed all the time. Even the implementation of delay() turns out to be just a tight loop. There are libraries that do much better than that, but they're quite complicated.

Instead I'm thinking that for most sketches the processor doesn't really need to run the loop() at full speed. The only reason to reenter the loop is because either something has happened or because significant time has passed.

Now there's a timer interrupt every millisecond; and serial and most events generate interrupts. So I'm wondering if a construct like this might save power (with thanks to http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html ):

void loop() {
    // Do normal stuff: check for serial input, IO, time changed and act on each
    // ...


    sleep_enable();  
    sleep_cpu();     
    sleep_disable(); 
}

As I understand it, the last three lines won't affect anything perceptibly, and will save a bit of power.

Am I wrong, or is the saving too small to notice?

  • Charles

Yes, power down sleep mode can save some power, use an interrupt to wake up & do something, go back to sleep. Most effective on standalone processors. With full board, the regulator, USB/Serial, autovoltage comparator, power LED, are all running and there is no way to power those down. Nick Gammon did a nice article here http://www.gammon.com.au/forum/?id=11497

and I've been a little surprised at the loop() programming model, which effectively keeps the processor running at full speed all the time.

The Arduino is not a notebook where the user can set a power profile from a menu, but Atmel has built into the uC the necessary features for power savings. The stock Arduino is a hobby device with no particular features for power savings. However, naked chip programmed with the Arduino system can easily incorporate power savings features. The forum has several articles, Nick has a good writeup, and I use several of the techniques in my tiny85 project t: http://www.hackster.io/rayburne/hot-yet

The best power saving technique, however, is to lower the clock below 16MHz if the design will permit. In fact, running at 1 MHz is often adequate.

Ray

mrburnette: The best power saving technique, however, is to lower the clock below 16MHz if the design will permit. In fact, running at 1 MHz is often adequate.

If you are doing something really simple that needs to be ultra low power, you can even run it at 16kHz using the watchdog oscillator and 1/8 prescaler!

As has been said, there is so much other 'stuff' (e.g. usb-serial, power led, regulator, etc.) on an Arduino that there is almost no point sleeping the ATMega chip to save power, it would be like trying to use a pebble to slow a Niagara falls. For a standalone chip in a carefully designed circuit, the savings are however quite substantial. I've built a dice circuit with a few 1M resistors and an ultra low power op-amp. When running the whole thing draws 1mA (including the LEDS). When the CPU is put into power down mode (to be woken by the op-amp), the whole circuit draws 2uA from a battery - less than the self discharge rate of the coin cell I am using.

The sleep idea can be quite useful for other things than just power saving though. You can use it as part of your program. Imagine that you want to blink an LED, you could toggle the pin and the have a delay(), or you could have a timer running which wakes the CPU at certain intervals and toggles the LED in the interrupt.

best way to save power in a robot is to switch off the parts not needed. This prevents "power leakage" That's the way NASA does it with their robots, and I bet they did think about it twice ;) It might add some extra electronics.

What kind of battery are you using?

Adding a solar cell that loads the battery might also help