analogReference on a standalone atmega328

Hi

I need acurate ADC measures on a standalone atmega328 and i was thinking using a external voltage reference IC like MCP1501 on AREF pin. My system will be powered by batteries and will be most of the time sleeping (wake every 4 hours, grab some measures and back to sleep again). To avoid wasting power, i was thinking enable the reference IC just before doing ADC measures, switch to analogReference(DEFAULT) just after and disable reference IC, something like this:

loop() {
   digitalWrite(VoltageIC, HIGH);
   analogReference(EXTERNAL); 
   analogRead(0);
   doMyReads();
   digitalWrite(VoltageIC, LOW);
   analogReference(DEFAULT);
   sleep_4hours();
}

This can be done or is bad idea?

Thanks

Do you know Arduino has internal bandgap reference 1.1V nominal you can use? Did you try it and found it is not precise enough?

I think it is a mistake to even connect the AREF to the shield. If someone accidently runs an analogRead() after an analogReference(DEFAULT). It is my understanding that the AREF pin (with external reference) would be connected to the default AVCC pin and most likely be damaged. Arduino has delayed activating the reference until the read command is issued (see the core file I linked) but I don’t see how that helps. I think the internal bandgap is the way to go.

https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_analog.c#L32

Smajdalf: Do you know Arduino has internal bandgap reference 1.1V nominal you can use? Did you try it and found it is not precise enough?

Yes, i'm aware of that, but atmel says it can vary between 1.0V and 1.2V, so it is not very precise. And with 1.1V reference, i need extra resistor divider to take measures since values could be higher than 1.1V.

ron_sutherland:
I think it is a mistake to even connect the AREF to the shield. If someone accidently runs an analogRead() after an analogReference(DEFAULT). (…)

Yes, i’m aware of that, but it is a standalone atmega328 and of course i control my code.
Internal 1.1V bandgap is not very precise according to atmel (1.0V to 1.2V).

The bandgap is stable and repeatable, it is a bandgap reference after all, but they did not trim it to a precise value. If you measure its actual value it should be within the range on the datasheet. Once a bandgap is known by measuring on the bench (e.g. 1.189V) then that is what it will be in the oven or the freezer (less the drift expected for a bandgap reference, which is not much).

Do what you want (I have my own smoke to deal with), but keep in mind that loading other people's sketches become risky with what you are suggesting.