Glad you asked that because I have been looking for an excuse to work this out.
This code shows how you can sleep for 20 seconds in "power down" mode:
// Example of sleeping and saving power
//
// Author: Nick Gammon
// Date: 25 May 2011
#include <avr/sleep.h>
#include <avr/wdt.h>
#define LED 13
// watchdog interrupt
ISR(WDT_vect) {
wdt_disable(); // disable watchdog
}
void myWatchdogEnable(const byte interval) { // turn on watchdog timer; interrupt mode every 2.0s
MCUSR = 0; // reset various flags
WDTCSR |= 0b00011000; // see docs, set WDCE, WDE
WDTCSR = 0b01000000 | interval; // set WDIE, and appropriate delay
wdt_reset();
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable(); // enables the sleep bit in the mcucr register
sleep_mode(); // now goes to Sleep and waits for the interrupt
}
void setup()
{
pinMode (LED, OUTPUT);
} // end of setup
void loop()
{
digitalWrite (LED, HIGH); // awake
delay (2000); // ie. do stuff here
digitalWrite (LED, LOW); // asleep
// sleep for a total of 20 seconds
myWatchdogEnable (0b100001); // 8 seconds
myWatchdogEnable (0b100001); // 8 seconds
myWatchdogEnable (0b100000); // 4 seconds
} // end of loop
// sleep bit patterns:
// 1 second: 0b000110
// 2 seconds: 0b000111
// 4 seconds: 0b100000
// 8 seconds: 0b100001
That puts the CPU into power-down mode with the watchdog timer set to wake it up. It isn't particularly accurate but for a gallery I bet no-one will have their stopwatch out. You can tweak it by replacing (say) the 4 second delay by a 2 second delay.
Eight seconds is the most the watchdog timer can handle so I made up 20 by using 2 x 8 + 4.
My measurements are:
For a Uno:
- Awake (including the LED shining): 46 mA
- Asleep: 24.5 mA
For a "bare bones" board (described here: http://arduino.cc/forum/index.php/topic,60256.0.html ) :
- Awake (including the LED shining): 20 mA
- Asleep: 0.14 mA
Straight away you can see that the bare-bones board has much less consumption, particularly asleep. This is because you are not driving the voltage regulator, the USB chip, etc.
You don't have to wire-wrap your own board, there are "bare bones" boards for sale from various places. I think the major thing is to avoid the USB conversion chip and go with programming via an FTDI cable (itself around $20). That obviously saves a lot of power.
My other query is the use of the 12V battery. You may need 12V to drive the display, but it is too much for the Arduino - the voltage regulator is just burning off the excess as heat. I would be inclined to tap into the batteries at about the 6V mark for the processor, thus saving that wastage. Or have a second, smaller, battery bank for the processor (eg. 3 x 1.5 batteries and skip the voltage regulator).
Plus the light-sensing idea is good for saving power when the lights are off. I did an experimental circuit using an op-amp and a light-sensing resistor here:
That shows how you can generate an interrupt, so you could detect the lights are low after one of your 20-second periods of wakefulness, and then set a lengthy sleep time with the op-amp interrupt set to wake you up next morning.
Or, more simply, detect the light level is low, and when you wake up after 20 seconds, just do nothing and go back to sleep. That would be easier.