Analog to Digital Converter of ATmega16 with LED Display
Microcontrollers are capable of detecting binary signals: is the button pressed or not? These are digital signals. When a microcontroller is powered from five volt, it understands zero volts (0V) as a binary 0 and five volts (5V) as a binary 1. But the real world is not so simple and likes to use shades of gray. What if the signal is 2.72V? Is that a zero or a one? We often need to measure signals that vary; these are called analog signals. And these analog signals have to be processed by the microcontroller. But the microcontroller cannot process the analog signals of nature, so these analog signals needs be converted to digital signals first. This conversion can be achieved using an analog to digital converter.
In this project, we will learn How to convert an analog signal to digital signal using the Analog to Digital Converter of AVR ATmega16 microcontroller. The AVR ATmega16 has an inbuilt 8 channel, 10 bit analog to digital converter. Here, we will first convert a 5V signal and then a 0V signal with a reference voltage of 5V of ADC. After each conversion, the analog to digital converter of ATmega16 will give a 10-bit value for each signal (5V and 0V).These outputs of the analog to digital converter are displayed in a 1×8 LED array. When a 5V signal is converted, the output of analog to digital converter is 0x3ff (1023) and when 0V signal is converted, the output is 0x00 (0). But the LED array can display only 8-bit at a time. So, the 1×8 LED array will first display the lower 8-bit and then the upper 2-bit of the 10-bit digital output with a delay of 500ms.
|AVR Trainer Board-100 with ATmega16||1pc|
|AVR USB Programmer||1pc|
|12V, 1A DC SMPS Adaptor||1pc|
|1 to 1 Connector-Female to Female||1pc|
|10 to 10 FRC Female to Female Connector||2pc|
The step-by-step connection guide for Analog to Digital Converter of ATmega16 with LED Display is as follows
Steps - 1 ( 0f 8 )
Insert the DC Pin of 12V, 1A DC Adapter to the DC Socket of AVR Trainer Board-100.
Steps - 2 ( 0f 8 )
Connect PortB header with LED header in AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.
Steps - 3 ( 0f 8 )
Connect PA0 pin of PortA header to any pin of 5V header with a 1 to 1 Connector.
Steps - 4 ( 0f 8 )
Connect the ISP header of AVR Trainer Board-100 with AVR USB Programmer header of AVR USB Programmer with a 10 to 10 FRC Female Connector.
Steps - 5 ( 0f 8 )
Connect the AVR USB Programmer to the PC/Laptop's USB Port directly or with the help of USB AM-FM Cable.
Steps - 6 ( 0f 8 )
Switch on the power with the help of Power Switch of AVR Trainer Board-100.
Steps - 7 ( 0f 8 )
Download the Analog to Digital Converter of ATmega16 with LED Display Hex file to AVR Trainer Board-100 with the help of SinaProg Hex downloader and AVR USB Programmer.
Steps - 8 ( 0f 8 )
See the output.Now, connect PA0 pin of PortA header to any pin of Ground (GND) header with a 1 to 1 Connector.