Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create an alarm that wakes up at a certain time and does a series of instructions. To set the times that it wakes up, I am going to use the headphone of an Android device to send serial data to the MCU about what time(s) to wake up. I will simply plug it in, make the transfer and unplug the jack. Then the time is set on the MCU. The transfer will also sync the time to set the timer appropriately.

I can set a timer interrupt with a prescaler to give me 4s on each interrupt. Then use 2 bytes as secondary counter of some sort. That would give me 72 hours that I could wait and I only need 24 since I can reset when the day ends.

So my question comes when the device is reset. I can save the current time in the EEPROM and then read it on load but how much overhead does that have on current use? I want the battery to last as long as possible.

My question may need to be elaborated on but I was wondering if there was a better way or if I am going about this the correct way.

share|improve this question
Is there a particular reason the device will be reset? When waking from sleep the RAM will be preserved so unless there's another reason it will reset (power removed etc) you should be able to keep your counter in RAM and not use the EEPROM. – PeterJ Feb 22 '14 at 9:50
up vote 6 down vote accepted

Use an RTC that supports an alarm line, eg. DS1375. The chip can drive an interrupt line at a given time/date. You do have to select the appropriate AVR sleep mode that 'listens' to the selected interrupt. No need to use the AVR timers.

share|improve this answer
This is correct, but hard to say whether it has better or worse battery life than the original proposal. – Ben Voigt Feb 22 '14 at 1:39

I'm using an internal watch dog timer in attiny44 in similar case. It can be configured to issue an interrupt (not reset) every 8 seconds. What's good is that WDT interrupt can wake up the chip from the deepest "power down" sleep mode.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.