Best Way to Save Power

Hi, I've got a Duemilanove and a WiShield hooked up to a temp sensor and a photoresistor. I want to put it outside on a 9v battery, but am afraid it will eat through the battery. Realistically I only need new information every 10 minutes or so. How can I get the Arduino to go into low power mode for 10 minutes, then wake up, get the sensor readings and then go back to sleep?

What is the best way to manage power so I don't burn through batteries. Should I put it to sleep and use interrupts?

Thanks.

Maybe this can be a little help:

http://www.arduino.cc/playground/Learning/arduinoSleepCode

Thanks. That is very helpful. Is there any way to make the Arduino sleep for a certain amount of time? Or to wake it up without detecting something external to start an interrupt?

http://interface.khm.de/index.php/lab/experiments/sleep_watchdog_battery/ take a look at that

is there a way to make it wake besides on pin 2 or 3? That is what I am looking for, just need it on other pins.

can't use the watchdog as when the arduino is awake I need constant monitoring of the buttons.

Yes, the PCINT interrupts may wake it up as well. PCINT is available for almost any pin.

http://www.arduino.cc/playground/Main/PcInt

Udo

In the Nightingale example I understand most of it, but can anyone explain the following.

cbi(ADCSRA,ADEN); // switch Analog to Digitalconverter OFF
sbi(ADCSRA,ADEN); // switch Analog to Digitalconverter ON

In the void system_sleep() section , What does this do and why is it needed?

Also, I am a bit confused by the watchdog code.
Where do I set the time I want the watchdog to wait before waking up the Arduino?

void setup_watchdog(int ii) {

  byte bb;
  int ww;
  if (ii > 9 ) ii=9;
  bb=ii & 7;
  if (ii > 7) bb|= (1<<5);
  bb|= (1<<WDCE);
  ww=bb;
  Serial.println(ww);


  MCUSR &= ~(1<<WDRF);
  // start timed sequence
  WDTCSR |= (1<<WDCE) | (1<<WDE);
  // set new watchdog timeout value
  WDTCSR = bb;
  WDTCSR |= _BV(WDIE);


}

1) Analog conversion is switched off to save power

2) You should not have deleted the comments while copying the code. If you do not understand the comments you should read the watchdog timer section in the datasheet. http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf Section 10.8

Udo

One additional note though. The nightingale example is instructive but has room for optimizations:

  1. Unused pins should NOT be switched to input and left floating. They should be pulled to a defined level.

  2. Disabling serial interface and utilizing the internal 8 MHz RC oscillator instead of the crystal oscillator will decrease power consumption further.

  3. If you own an ISP then there is absolutely no reason to use a bootloader unless you need “field upgrade capabilities from serial interface”.

Udo

I didn't delete any comments . I'll have a longer look at the datasheet when I have more time. But on first look that looks just as confusing.

// 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms
// 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec
void setup_watchdog(int ii) {