I have created a nice electronic door lock for my dorm room. It is currently an Arduino Diecimila with a servo [un]locking the door. It has a numerical keypad with 3x4 buttons and 5 LED's (2 serie pairs and one single LED). It also currently runs on a cellphone charger.
I have now redesigned it to run on a standalone Arduino (ATmega328), but would really like to have it run on AA batteries or even a 9V battery.
For the software part, I figured I could put
sleep calls for certain times inside the loop method to keep the ATmega power consumption as low as possible. And let the LED's "flash" with as long as possible time off.
When a button is pressed during the few milliseconds which the board sleeps, will it be "remembered"/"held" until it comes out of sleep and then be picked up as a button press?
What would be the best way to handle this button press on sleep? Can I code it to wake up upon button activity, or must I just let it sleep for e.g. 10m.s. in every loop?
How would I approach the math of calculating how many AA batteries are needed to run this device for 10 months?
Also, I don't know how to measure the average power usage per minute or so, since it alternates quickly etc.