AREF: switching between 5v & 3.3v

Goal:

Use analogReference(EXTERNAL) to switch my ADC measurements to a 3.3 reference voltage and then use analogReference(DEFAULT) to switch the reference voltage back to 5 volts.

Problem:

The analogReference() (analogReference() - Arduino Reference) documentation states that if I attach a supply voltage to AREF then I cannot use the DEFAULT voltage unless I put a 5k ohm resistor between the supply and AREF.

If I put a 5k ohm resistor between my 3.3 volt supply and AREF I will be using a reference voltage of 2.85 volts. I want to use a reference voltage of 3.3 volts.

I understand the voltage divider calculations, but I don't understand enough of the rest of the circuit issues involved here.

Proposal:

Put a 48.5k ohm resistor between the 5 volt supply and AREF creating a reference voltage of 3.3 volts.

Is the 5k ohm resistor mentioned in the analogReference() documentation a specific value, or a minimum resistence?

Would I still be able to switch between the default 5 volt reference and my external 3.3 volt reference?

(I understand they don't make a 48.5k ohm resistor and I will need to use a 47k and 1.5k resistor in series)

(I understand that after switching from 3.3 to 5 volt that the first few measurements will not be accurate, I would prefer not to discuss that in this thread)

5 * 32 / (32 + 48.5) = 1.988V

I think you mean to say you need a 16.5Kohm resistor:
5 * 32 / (32 + 16.5) = 3.3V

Don't forget if you are using USB as your 5V reference, you probably won't have exactly 5V.

Oops, read the wrong value from my notes.

You are right, I will need a 15k + 1.5k = 16.5k resistor.

My original question remains. If I do this will I be able to switch between reference voltages?

I think 5K was picked to limit the current but still provide enough of the original voltage.

Using the 16.5K configuration, you should be able to switch between them (provided your 5V reference is good.)

As for the inaccuracies, just make sure you take one sample after switching then delay, or throw away 5-10 samples in a row. (The switch doesn't occur until the next analogRead() and then it doesn't settle for a few microseconds.)

The was a discussion a few days ago:

http://arduino.cc/forum/index.php/topic,54848.0.html

When you select EXTERNAL the AREF pin is connected directly to the internal reference, if you have a hard voltage on AREF then select INTERNAL you have a blue smoke situation.

I'm pretty sure the point of the resistor they mention is just to keep the smoke in, nothing to do with voltage dividers.

With the resistor in place EXTERNAL should work as long as the current drawn by AREF is not enough to cause much voltage drop over the resistor (as you would assume but you could measure it) and INTERNAL would not be affected at all.

Note that I haven't tried this, just my take on what I know from reading the data sheets.


Rob

you have a blue smoke situation.

This is completely FALSE...it's more of a whitish-brown color :stuck_out_tongue_closed_eyes:

If you are going to use larger resistors on the Aref pin be prepared for even longer settling times (RC time constant) when switching references.