Testing my understanding: analogReference()

I’ve never had cause to use anything but 5V on a pot for an analogRead() but may have a requirement for that.

So, just before I bugger anything up, am I right in thinking that 3V or 4V or whatever (<5V) I put into AREF replaces 5V in my calculation of mV per step. So whereas 5V gives ~5mV per step, if I went for 3V I’d get ~3mV per step. The 0-1023 steps doesn’t change.

I’m reasonably sure that’s correct but would rather be sure.

(And I’ve taken note to call analogReference() before analogRead().)

manor_royal:
I'm reasonably sure that's correct but would rather be sure.

(And I've taken note to call analogReference() before analogRead().)

Yep that's how it works. :slight_smile:

The only thing to watch out for is that once you connect an external source to Aref, you can no longer select either of the internal references (AVcc or the internal 1.1V reference). This is because it doesn't really analog multiplex between those and Aref, it rather just "shorts" them together through a passive switch.

Personally I'd recommend using something with a source impedance of several k-ohms for Aref, along with a small bypass capacitor (0.01u to 0.1u) to ground.

stuart0:
Personally I'd recommend using something with a source impedance of several k-ohms for Aref, along with a small bypass capacitor (0.01u to 0.1u) to ground.

Don't do that, you'll get wrong results. AREF must be driven from a low impedance source, it has
significant input current (unlike the analog input pins).

MarkT:
AREF must be driven from a low impedance source

Ok well I have no idea what that means in a practical sense. (I know what impedance is, but have no idea how to gauge if a source is high or low impedance: presumably you mean impedance in its correct sense of including reactance not just resistance?)

So my simple question is then: if I put 3V from 2x AA cells across a pot, can I safely put that same 3V into AREF so as to analogRead() 1023 for 3V and 0 for 0V?