How to achieve longer battery life?

Hello,

Here is a simplified description of the problem that I am trying to solve:

I need to monitor a door from my PC. The door should always remain shut. If the door was ever opened, even a little, then an alert message needs to be displayed. If the PC was not on at that time, the alert message should be displayed once the PC is turned on.

Here is how I think I can achieve this with my Arduino board:

I will use the on-chip EEPROM to store the current status of the door. As long as the door is closed, I will be getting some voltage on one input pin on the board. My program will monitor this pin. If the voltage ever goes to 0, the program will update EEPROM state.

The program also monitors input requests from the USB port. If a request comes in (from my PC-based application), the program returns the current value stored in EEPROM.

I have a number of questions on my approach. I would appreciate if you could shared with me any feedback that you may have.

Q1. Can you think of a better approach?

Q2. The door is about 20 ft away from the PC. I am thinking I will put a AA battery at the door, ground the -ve terminal and just connect the +ve terminal to the arduino pin over a long wire. This way, I can get away with just one wire instead of using two wires. Will this work?

Q3. I need to make sure that the battery to the arduino board lasts for at least 4 months. Is this possible?

Thank you in advance for your help.

Regards, Peter

You will want the Arduino to sleep all the time. When the door switch is opened or closed the pin change interrupt wakes the Arduino and it sends the alert to the PC, then goes back to sleep. You can have the serial communication from the computer wake the Arduino but the sleep mode that allows this (SLEEP_MODE_IDLE) but this will not reduce the power consumption as much as a deeper sleep mode that disables USART. Instead you could consider just storing the state of the door on the PC according to the alerts.

I found this information to be useful in getting the lowest possible power consumption of the AVR based Arduino: https://www.gammon.com.au/power

PeterTaps: Q2. The door is about 20 ft away from the PC. I am thinking I will put a AA battery at the door, ground the -ve terminal and just connect the +ve terminal to the arduino pin over a long wire. This way, I can get away with just one wire instead of using two wires. Will this work?

No, you can't communicate over one wire only. The difference in price and wire size between one or multiple conductors in a cable doesn't seem like it would be significant in this situation. If you're going to run a wire you could go ahead and power it over the wire too so you don't need to worry about the power issue so much but it is pretty cool to get an Arduino down to drawing nanoAmps!