How do you program a sleep mode for your Arduino? Especially for battery powered designs, what are good techniques for sleeping the CPU but waking up only when needed?
3 Answers
avr/sleep.h might have what you need - documentation is at http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html
There are some warnings about putting the CPU to sleep though :)
Hope this helps.

- 196
- 1
keep in mind that depending on your sleep mode there are a couple of interrupt sources running on your arduino. timer0 generates an overflow interrupt that will wake your arduino approximately every millisecond and the uart will generate an interrupt everytime there's an incoming character. ... and, of course, there are the external interrupts on pins 2 and 3 that you may or may not have enabled using the attachInterrupt function.
when an interrupt occurs your sketch will be awakened from sleep and after the interrupt is serviced it will continue running from the point where it went to sleep. the solution to this is to set up you sketch to put itself back to sleep everytime through loop unless it's really time to wake up.

- 39
- 1