Summary of Analogue to Digital Conversion on an ATmega168
This tutorial explains how to perform Analogue to Digital Conversion (ADC) on the ATmega168 microcontroller. It details the necessary circuit setup, emphasizing the need for a stable AVCC supply via an inductor-capacitor low pass filter and configuring the AREF pin to match AVCC. The guide demonstrates using PC0-PC5 pins as analogue inputs, specifically utilizing a trimpot connected to PC0 for input.
Parts used in the ATmega168 ADC Project:
- ATmega168 microcontroller
- Breadboard
- Inductor
- Capacitor
- Trimpot
Many AVR microcontrollers are capable of doing Analogue to Digital Conversion. The ATmega168 has 6 ports (8 ports on the SMD packages) that can be used for analogue input. This tutorial shows you how.
The circuit
The Breadboard layout is based on the Atmega8 breadboard circuit which is described in Atmega8 breadboard circuit Part 1 and Atmega8 breadboard circuit Part 2.
AVCC
The Atmega168 has 2 digital supply voltage pins, VCC and AVCC. AVCC supplies power to PC0-PC5. When these pins are used as analogue inputs, the AVCC power needs to be very stable. This is achieved by using a low pass filter comprising of an inductor and capacitor.
AREF
The AREF pin is used to set the voltage that corresponds to a 100% value (1024) in the AD converter. In this example we tie it to AVCC.
Analogue Input
The Atmega168 has has 6 pins (8 for the SMD packages) that can be used for analogue input. These are PC0 to PC5. These are normally used for digital I/O but can be used for analogue input as well. In our example we are using a trimpot as the analog input device and connecting it to PC0.
Read More: Analogue to Digital Conversion on an ATmega168
- How many analogue input ports does the ATmega168 have?
The ATmega168 has 6 ports for analogue input, or 8 ports on SMD packages. - What is the purpose of the AVCC pin?
AVCC supplies power to PC0 through PC5 and requires a very stable voltage when used for analogue inputs. - How is a stable AVCC power supply achieved?
A stable AVCC power supply is achieved by using a low pass filter comprising an inductor and capacitor. - What role does the AREF pin play in this project?
The AREF pin sets the voltage that corresponds to a 100% value of 1024 in the AD converter. - Which specific pins can be used for analogue input?
Pins PC0 to PC5 can be used for analogue input, though they are normally used for digital I/O. - What device is used as the analog input in the example?
A trimpot is used as the analog input device and is connected to PC0. - Can PC0-PC5 be used for both digital and analogue functions?
Yes, these pins are normally used for digital I/O but can also be used for analogue input.


