AREF pin and analogue pins...relationship?

Hi All

While designing my perfboard Arduino I have found some designs will link the AREF pin (I am using an atmega328) to 5+

I assume the AREF pin contains the reference voltage which the analogue pins are compared against when reading an analogue input?

Cheers

yes!

because the analogue inputs are using the 10-bit internal ADC, your resolution will be 5 Volts divided by 1024, so a little better then 5 millivolts. Make sure your 5 volt reference is accurate.

Thanks for the answer joop

Just to clarify, I only need to connect the AREF pin to the input voltage of whatever I am measuring against (say the source voltage of a distance sensor) it it is not the same as the microcontroller Vcc (5+)?

If the target I wish to measure against has the same source voltage as the microcontroller I just specify in my code

analogReference(DEFAULT);

and then don't make any connection to the AREF pin at all... ie - leave it floating?

Is that correct?

Thanks

As far as I understand, you only need to connect Aref if you need to measure against a voltage reference other than 5 Volts. See the AnalogReference command.

While designing my perfboard Arduino I have found some designs will link the AREF pin (I am using an atmega328) to 5+

This is an unneeded and dangerous connection to make. Unneeded because the default internal reference is already the chip's 5vdc voltage via the Avcc pin. Dangerous in that if you were to ever (on purpose or accidentally) switch to the internal 1.1vdc band gap voltage reference with +5vdc wired to the Aref pin, there would be a large current flow through the aref pin, resulting in chip damage.

Just leave the Aref pin disconnected, or better yet just wire a .1ufd bypass cap from the Aref pin to ground to gain a little extra noise reduction for the A/D converter.

Lefty

Magic

I will do that (the capacitor) Lefty, together with providing a header to the AREF pin should I need a different reference voltage.

Cheers :slight_smile: