If I just adjust the blink program to output to a buzzer rather than the LED and then tell the Arduino to wait for 23hrs59mins50s afterwards (for the next alarm), then will the battery drain massively, or can this last a long time?
Note: I'm using a 9V battery
Note2: I'm starting it now, will let you know how long the battery lasts.
Hi,
That's not the ideal way to do it since the Arduino will be powered up the entire time, but doing nothing. Also the choice of a 9V battery isn't ideal since while the processor is doing nothing, the voltage regulator will also be running to drop your 9V to 5V with the current it consumes also going to waste.
If you chose a 5V supply you could feed that into the 5V of the Arduino directly, avoiding the voltage regulator circuitry, and then use the deep sleep modes of the microcontroller to put it into a low power state. The onboard watchdog timer can be used to wake from that sleep - while the maximum time for that is 8 seconds, it can simply increment a counter and go back to sleep unless your desired number of 8 seconds is up, then have it do your actions/zero the counter/rinse&repeat.
That will extend your battery life considerably. There are lots of threads on this forum and elsewhere which will help - often watchdog timer is abbreviated to WDT. Here's just one as an example but there are heaps more. There are also libraries that use this feature to extend the sleep mode - one is actually mentioned in that thread though I've no direct experience with it.
All the best with your project,
Geoff
yeah the battery drained in like a day and a half. bad times. I will have to find out about this deep sleep mode and watchdog timer.
Start here to learn about power saving modes and here for timers and counters.
Keep in mind that the Arduino is a lousy time keeper, so to make an alarm clock, you will need an RTC (real time clock) module.
zelectron:
yeah the battery drained in like a day and a half. bad times. I will have to find out about this deep sleep mode and watchdog timer.
Sleep is an option, or you could just plug it in. Get a usb power supply, and power it through the usb port.
Easy-peasy.