Electronic – How to connect Aref (Avcc and Agnd) and where to place the bypass capacitor

adcatmegaschematics

This is my schematic:

Confused with what I have to do with the PIN 32

Should I connect a capacitor between the PIN 32 and GND Pin or AGND Pin?

From the AVR Hardware Design Application Note:

2.2.
Analog Supply

The AVR devices that have a built-in ADC which have a separate analog supply voltage pin, A V CC . This
separate voltage supply ensures that the analog circuits are less prone to the digital noise originating
from the switching of the digital circuits.

To improve the accuracy of the ADC, the analog supply voltage must be decoupled separately, similar to
the digital supply voltage. AREF must also be decoupled. The typical value for the capacitor is 100nF. If a
separate analog ground (AGND) is present, the analog ground should be separated from the digital
ground so that the analog and digital grounds are only connected at a single point (at the power supply
GND).

Grounds are all same. Right? So does it make a difference if it is decoupled with analog one or the digital one?

NOTE : It doesn't need an critical ADC application but I would want to use ADC later. Application doesn't need precise or accurate ADC since it is more sort of learning project but it would be helpful if solutions or suggestions provided are for making it perfect.

Best Answer

To answer your specific question, you want the decoupling capacitor between AREF and AGND.

The underlying idea is that you separate the analog power/ground from the digital power/ground, so digital transients and interference don't show up in the ADC. As the datasheet says, you connect the analog ground and digital ground together only at the power supply.

Theoretically grounds are all the same, but in practice, the wires/traces have some impedance so different parts of the ground trace won't have exactly the same voltage. By using separate wires for the analog and digital ground (a star ground), the decoupling capacitors will filter out most of the digital transients before they can get to the analog side.

This article (Staying Well Grounded, H. Zumbahle, Analog Dialogue Jun 2012, V46) provides more detail.