I am hoping someone can give me some advice on a path forward.
I need to put my system into sleep for long persions of time, or an idle mode. When I receive a signal from an accelerometer, I want the system to wake up and start taking in data.
I was initially going to use the WDT, wakening up every 500ms or so, but there are a few issues with this
- The system will not be taking data in for long periods of time -- it will probably only take in data for say, 6-10 of the 26 hours in a day, so waking every 500ms is still wasting a lot of power.
- Even waking every 500ms, I will miss the start of some events, and will not have complete data
So, I have been talking to a few people, and reading the datasheet for the ATmega328P, and I am wondering would the analog comparator be useful? My thinking is that I can set up an analog reference, below which the system wills stay idle, but above it (i.e when the voltage on AIN0 > AIN1) the output takes the system out of idle, and the system goes on as normal.
Does this make sense? Or am I just being silly?
If I am not being silly, this brings me to my second issue ...I don't have a fracking clue how to do it. I have been reading the datasheet, but if someone has some sort of example, that would be great!
I did find this, which gives some insight - http://arduino.cc/forum/index.php/topic,59804.0.html
...but I am wondering if anyone has any others?
Thanks in advance.