How to set up a deep sleep timer?

Hi,

I'm close to finish an Arduino Project. Everything works, but I want to power my Arduino NANO with a battery for long as possible, so I want to use the Deep Sleep function and set a timer to wake up the Arduino, run the program once and go back to sleep for another 30min.
I read that the longest period of setting a timer without using a RTC(real time clock) are 30min, which would be perfect.
But I can't find an example, which I can just copy into my program with maybe using a library.

So if there is an easy way, could please someone send me an example?

Thanks Chris

Your post has been moved here

What made you think that it had anything to do with the Website or Forum ?

If the sleep time does not need to be acurate, say within only 5%, then the Watchdog timer can be used, there is no maximum time at all, you just sleep in units of 8 seconds and keep a count of them.

A bare bones Arduino ATmega328P will under this regime have a sleep current of around 8uA.

seefahrersepp:
I read that the longest period of setting a timer without using a RTC(real time clock) are 30min, which would be perfect.

Where did you read that?
When the chip is in 'Power-down' sleep mode, the only thing that will allow the chip to wake itself is the Watchdog Timer interrupt. The maximum Watchdog Timer interval is 8 seconds. You can get about 30 minutes if you wake only long enough to count the interrupts and then go to sleep again until you get to the 1800th wake-up. That would be about 30 minutes.

If you have an RTC with an alarm output you can use an External Interrupt pin in (HIGH or LOW interrupt mode) or Pin Change Interrupt pin.

Here is a great page that thoroughly explains all the options: https://www.gammon.com.au/power

@Hutkikz Thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.