Go Down

Topic: Arduino varibale sleep timer (Read 1 time) previous topic - next topic


I am just getting started and I need some help in figuring out a direction on a project. I need the Arduino to go to sleep for a period of time and then wake to perform a routine and then go back to sleep. I have this part working well but I want to make the sleep intervals variable which I am not sure how to accomplish. I have a serial connection so periodiclly when it wakes I will send messages to update the wake up cycles. For example I might send a message to wake up at 10:00, 15:00, 17:00 and then a couple days later it might get a message to wake up at 9:30,14:20,19:00,21:00,21:30. I need the timing of the wake up schedule to be fairly accurate but I am not sure how to accept the time of day and convert it to a variable for my sleep cycle. I have seen some projects that involve a timer such as a DS1307 which I will use if I need to but I would really like to find a solution without using that. I know that I will lose any clock or timing I have if I ever lose power but that is fine for my application. Any suggestions on where to start looking or similar examples of other projects is appreciated.   


Without an external input, the Arduino has no idea what time it is, or what day of the week, or what year. All that it knows is how long it has been running.

Expecting it to do something at specific times, without an external source of time, is unreasonable.

That source of time does not have to be an RTC, but that is certainly the simplest source of time.


To keep track of the time I was thinking about using Arduino time library which I have been reading about here http://www.arduino.cc/playground/Code/Time. I am using a GPS so I am hoping I can periodically sync the Arduino clock from that. 


I need the timing of the wake up schedule to be fairly accurate but I am not sure how to accept the time of day and convert it to a variable for my sleep cycle.

What have you tried? The problem is in three parts - getting the serial data, saving the serial data, and parsing the saved data. Which part(s) are you having trouble with?


My questions are more general at this point and I am trying to figure out what might work before I put a lot of time into it. My goal is to avoid putting weeks of effort just to realize it cant possibly work and I need additional hardware such as a DS1307 timer. My basic question is does this idea sound like it will work? I am using a small battery so power save sleep mode is an important feature for me. Do you think I can get the alarm feature to create an interrupt to wake the Arduino from power save mode? If not can I somehow convert serial input time variables into delays which can be used as interrupts to wake the system?


Some RTCs have alarm modes that can trigger an interrupt.

The Arduino can be programmed to sleep, and wake up periodically. During it's waking time, if can see if it is time to do something and if there is serial data to read. Reading serial data is easy. Storing it in an array is easy. Parsing the array is easy.


Hi everyone,

I'm using a Fio board with a xbee-module. I've just read that you've achieved to sleep the board, could you tell me how to do it?

I found some programs as http://www.arduino.cc/playground/Learning/ArduinoSleepCode, and libraries as Narcoleptic ( (http://code.google.com/p/narcoleptic/)) and enerlib (http://arduino.cc/playground/Main/LibraryList). Sadly I understand that if you want to wake up the board you need an external action, like to press a button or to type something on the monitor ... What I want is programme the board to sleep and wake up itself.

I hope you could help me.

sorry for my english


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131