Interfacing lm35 with atmega16
LM35 is a precise analog temperature sensor that can measure temperature between -55° to +150° Celsius. This sensor can works with4 to 30 volts. Output of this sensor change 10mV per each Celsius degree. To read output value of lm35 with Atmega16 you should use ADC ( Analog Digital Converter ). ADC can convert analog continuous signal to digital discrete values. in atmega16 and atmega32 you can use ADC on PORTA. in fact only ONE ADC located in AVR IC, and port A pins connected to this ADC using a multiplexer. AVR ADC has 10 bit resolution it means ADC can split GND to Aref range to 2^10 parts ( 1024 Parts, GND is 0 and Aref is 1024 ). you could define Aref in 3 ways, use internal 2.567V refrence voltage as Aref, use AVCC as AREF, use external Aref using Aref Pin. Aref can be selected by REFS1 and REFS0 Registers. ( Below table extracted from datasheet )
According to above description if we choose external AREF and connect it to 5 volts, 0 to 5 V range will be split to 1024 parts, in the other word each ADC unit represent 4.88 mV and it can clearly shows LM35 changes. 2 unit per Celsius degree ( 10mV per degree ).
This project done with Codevision AVR and C language. In this project LM35 connected to 5V power supply and output pin connected to A0 pin. Atmega16 read ADC value first, then convert value to Celsius Degree with 1 decimal and then temperature shows on 7segment digit by digit. we use multiplexer 7segment in this project and digits send to relative 7segment with high speed one by one from Most significant digit to Low significant digit.
In this project we use internal 2.567 V reference voltage as Aref and every 4 adc units represent 1 Celsius degree, then we can convert adc value to Celsius with divide by 4.
File Size: 84.1 KB
Download Link : Download Project