=============================================================================================================

Monday, October 20, 2008

8-Channel ADC Project with ATmega32








Hi friends,
here is a small project of Analog to Digital Converter using ATmega32 which is having on-chip 8-channel ADC.
The circuit also consists of an intelligent 16x2 LCD for displaying the value of the voltage applied at each channel. There is also a push-button to scroll throgh the different channels. The schematic is as shown in the figure:


When powered on, the LCD displays"ADC Testing.." on the first line and the value of the voltage applied at the channel0 on the second line. When the push-button is pressed, the second line displays the value of channel1. Like-wise, all the channels can be checked one-by-one by pressing the push-button. The channel count will roll back to channel0 after going to channel7.

The displays shown in the pictures on top show values at channel0 and channel1. Here a AA battery was connected to channel0 and the channel1 was connected with the +5v supply.
A 9-pin connector is used for ADC, 8 ADC channel pins and 1 ground pin. (the values displayed on LCD will fluctuate for a channel if nothing is connected to that channel)

The software is created in C using ImageCraft ICCAVR compiler.
The Schematic and code for this project can be downloaded here:

Download Schematic and Code
Download HEX file

Thanks!!
-----------
ccd@dharmanitech.com

22 comments:

Avinash Gupta said...

Hi,
Nice projects!
Why don't you use AVR-GCC its free, much popular and fantastic?
It integrates tightly with Avr Studio (by Atmel -FREE!) so no need to worry about makefiles or command line. Every thing can be done in GUI with AVR studio.

CC Dharmani said...

Hi Avinash,
since I had started with ICCAVR so got habit of it!! It's 'Application Generator' was great for me as I was starting on AVRs. I was bit confused about creating the makefiles in AVR-GCC, so i had dropped it that time.

But yes, I'm now trying to use AVR-GCC as it's free and good support is also available on net.

Thanks for the comment!

Sujit said...

Mind blowing...

Just the thing I needed.
Thanks for saving my day.

sujay said...

mr. dharmani, i am having trouble interfacing my atmega32 with the PC(using hyperterminal) so that the value read by the ADC is given on the screen....could you please help me out?....is it also possible that I send the value to my computer and the computer processes the value,instead of displaying it on hyperterminal

CC Dharmani said...

Hi sujay,
what kind of problem are you facing? If nothing is getting displayed, check out the RS232 connector connections. Also, while starting hyper terminal keep the 'flow control' as 'none'. If some garbage is getting displayed, check out that the PC baud-rate is matching with that of the microcontroller.

You can process the data inside PC rather than displaying it on hyper terminal, but for that you need to write a program running in PC which is having access of the serial port. Then you can process the received data using that program.

L0op said...

hi,
your device looks really impressive

but i think it can only measure dc values?

can u help me how i can build an ac voltmeter??

i was thinking, if the frequency is specified then the rms value can easily be calculated with a single sample and corresponding time by timer.

but most porbably the frequency wont be specified!!!
i also need the device to sense the rms value within less than a millisecond!! but a 50hz signal takes 20ms for a full cycle!!!

ankit jain said...

hi, nice work. i'm working on a project which would use an ADC chip of an Atmega8L
microcontroller. A PC would be interfaced via USB for controlling the ADC
card (Atmega + ADC chip) as well as collecting the data. An API and a
library (for Atmega controllers) needs to be developed. (The required
hardware with a USB inerface has already been built). sir i want to know its parameters, which r to be controlled. if u have the necessary code, plz mail me
ankit.ejain@gmail.com
thank u in advance
plz reply soon

aftab said...

hi thanks brother

vishnu said...

Dear CC Dharmani
I have using your ADC & LCD program can not working your circiut
I have connecting details:
AT32 to SPI then To connect LCd then i have write your program on chip circuit is no response all connection correct. but can not working pls help me

Anonymous said...

having a problem with this guys could any one send me its hex file so it could be directly acess by isp programmer ,,,actually i am getting compiling errors in this programe

salik said...

salik_salman2002@yahoo.com plz send me hex file here

santhu said...

hi,
thanks for ur ADC project..its really nice!!!!

Malavika said...

hi,
can u please indicate what changes we are supposed to make in the given program to interface the lcd in atmega 16 with AVRGCC?

santrox said...

@malavika

all you need to change is changing atmega32 to atmega16 in the makefile.
email me @ whydevilcries@gmail.com if you need any help!!!

Anonymous said...

dharmani sir, cpould you please list atleast 3 applications of this project in real world.
i would be highly obliged if you can tell me atleast 3 applications of this project.
yours sincerely,
ankit bhardwaj
ankit.carman@gmail.com
pls do reply your precious comment!!

rohith said...

hi..
i need code for particular application which i described below will u send us c-program for me..

my requirement is...

the required heating rate(25degree centigrade to 200 degree centigrade per minute) is entered and start ramp command to given through keypad(four switches) connected to port b of MC atmega32. as start ramp command given, timer1 which is being operated in fast pwm mode starts generating duty cycle variation the time required to reach the maximum set temperature.

the pwm signal generated from microcontroller is applied to the dc switching circuit constructed using MOSFET. which inturn switches the power supply connected to the drain of MOSFET via heating element. the heating element acts as load across the drain of MOSFET.

and heating element temperature is sensed by thermocouple and it is amplified and given to adc0 pin. finaly the linearly varying temperature is displayed through lcd and transmitted to computer with the help of Microcontroller USART for storing data

abcd said...

hey all
i am working ADC atmega 32 and getting garbage value at the output

Sushant Bhangale said...

what is 8 channel & how its work

Anonymous said...

Can i use the code for atmega16???? plz help out..

Zoniv said...

hello, nice to read your article. I would suggest you to use AVR-GCC as its free and reliable.Though ICCAVR is not bad also. thanks for your nice post.

Syed Zain Nasir said...
This comment has been removed by the author.
Syed Zain Nasir said...

You should also check The Engineering Projects because they have posted a lot of Arduino Projects and PIC Mirocontroller Projects and have also designed many new Proteus Tutorials. I hope you guys are gonna like them.