I have an Atmega328P connected on a breadboard with an MCP1700 Voltage regulator and a voltage divider. The Atmega is connected directory to the battery voltage (5v). I then feed Aref with a stable 3.3v from the MCP1700 and read that battery voltage using a voltage divider. It's activated by the Atmega through an NPN transistor. I currently use low-side switching because I don't have any FETS available. However, this works fine and consumes 7 microamps of energy in deep sleep.
I then tried powering everything from the voltage regulator (except the voltage divider itself, because I still need that to read the actual battery voltage). So AVCC, AREF, VCC are all now powered through the output of the regulator. Something weird happened, suddenly I'm consuming 60 microamps of energy during sleep. I narrowed this down to being current flowing into the analog input pin.
I don't understand, why does this happen when connected directly to the regulator?
The MCU specs clearly state that the absolute maximum voltage than can be applied to any input is Vcc+0.5 V. Q3 is actually counterproductive in this case. To save power, make the voltage divider from 2x100K or even 2x1M, leave out Q3 and add a 100 nF cap from the divider tap to ground.
It is often forgotten that an unpowered processor has Vcc=0 V, which means in that case, the highest voltage you may apply to any input is 0.5V.
Why? I would simply connect the output of the voltage divider directly to the analog pin. If you increase the resistor values, the current drawn by the analog pin will be very small, so I'm not sure that switching it on/off with a transistor would be worthwhile. To reduce noise in the analog reading, just add a 0.1uF cap between the analog pin and ground, if needed, but you may find it works well enough without.
I would also use the internal voltage reference rather than the output of the regulator. When the battery voltage falls below around 3.5V, the regulator output will begin to fall below 3.3V. The atmega will continue to operate for quite a long time after that point, giving a useful extra battery life, but you won't be able to measure the voltage accurately. To use the internal reference, you will need to adjust the voltage divider to get the output voltage below ~1V, and add mentioned you can probably increase the total resistance by 10x to reduce the current though the divider.