Sleeping beauty

Hello people, arduino sleep modes have been widely debated here, so I hope I will not be too repetative. Here it goes:

Since I need to lower the power consumtion of my 328P arduino @16Mhz 5V I looked into the available sleep modes. The idle mode + watchdog seemed like the right choice because many sources (many times this forum) poited out that all the timers and periferial units work in this mode. The savigs might be moderate..but I was willing to sacrifice minimum power for robustness and simplicity as I relly heavily on measuring time with millis and the Time.h library. I painfuly experienced that idle mode + millis() is not a good combination as millis() (and probably the time.h fuctions) use timer0 which issues an overflow interrupt much before the watchdog starts to bark. Disable the interupt - millis() don't work!

Can you please give me some general programming guidelines in these situations. A real time clock is out of the question since I don't want to complicate the hardware at this stage.

One is to use the watchdog timer which is said to be innacurate. The innacuracy I guess, could be mitigated with callibrating the clock once in a while... I can live with 1%

Is it possible to construct a time keeping procedure like millis() with timer1 or timer2? Or are those two timers the same as timer0 concerning interrupts and waking up from sleep..

regards Peter

Well, when you decide you need more accuracy:

You can get a 16-pin RTC with internal crstal, SPI interface, just need the battery and a decoupling cap.

If add a pullup resistor, can use the 1 Hz Square wave output connected to an interrupt pin. Go into powerdown sleep mode, wake up once a second, decide if need to be awake or go back to sleep.

There is a Rocket Scream Sleep Library which seems to take care of the millis() timer being 'frozen' during the sleep and jumps it forward by the requisite amount before waking up. I haven't used it myself (yet) but it seems to offer maximum power saving, simplicity and robustness.

Thank you both! I'll start with checking out the library since it doesn't require any hw changes.

cheers Peter