Friday, July 18, 2008

Digital Thermometer using ATMega16 and 16*2 LCD


Abstract

Thermometer is used to measure temperature. This project is used to measure temperature and display digitally so, this project is known as digital thermometer . LM35, The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature, is used. ATMEGA16 is used in this project for calculation of temperature and 16 X 2 LCD is used for displaying temperature.

Why LM35 ?

The LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of ±1⁄4°C at room temperature and ±3⁄4°C over a full −55 to +150°C temperature range. Low cost is assured by trimming and calibration at the wafer level. The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies. As it draws only 60 μA from its supply, it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate over a −55° to +150°C temperature range, while the LM35C is rated for a −40° to +110°C range.


Features
Calibrated directly in ° Celsius (Centigrade)
Linear + 10.0 mV/°C scale factor
0.5°C accuracy guaranteeable (at +25°C)
Rated for full −55° to +150°C range
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 μA current drain
Low self-heating, 0.08°C in still air
Nonlinearity only ±1⁄4°C typical
Low impedance output, 0.1 W for 1 mA load

ATMEGA16

It is a low power CMOS 8-bit microcontroller based on AVR enhanced RISC architecture. By executing powerful instructions in single clock cycle, it achieves throughputs approaching 1 MIPS per MHz allowing system designer to optimize power consumption versus processing speed. It has four 8-bit bidirectional I/Os. It has 16K bytes of in-system programmable flash program memory with read while write capabilities, 512 Bytes EEPROM, 1K byte SRAM & 32 general purpose registors.

Working

As shown from figure components are soldered on PCB. When power supply is given to circuit, IC LM35 generates voltage according to the atmospheric temperature. This voltage is in analog form so it is given to the ADC0 port of microcontroller. It is ADC port so it converts analog voltage into digital form. We have written one algorithm in which this digital voltage is given as input and we get output as temperature in °Celsius. Also we have written one code that shows this temperature on LCD and horizontal bar whose length varies according to the temperature on LCD.

Programmer: - BascomAVR

Program:-

$regfile = "M16def.dat" ' use the Mega16

$crystal = 10000000

Deflcdchar 0 , 32 , 32 , 31 , 31 , 31 , 31 , 32 , 32 ' replace ? with number (0-7)'
Deflcdchar 3 , 16 , 16 , 31 , 31 , 31 , 31 , 16 , 16 ' replace ? with number (0-7)
Deflcdchar 4 , 1 , 1 , 31 , 31 , 31 , 31 , 1 , 1 ' replace ? with number (0-7)

Config Lcd = 16 * 2

Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2

Config Adc = Single , Prescaler = Auto , Reference = Avcc 'config ADC
Start Adc

Dim W As Word , Perc As Word , Volt As Word , Volt_d As Byte , Channel As Byte , I As Byte , Cols As Byte

Cls
Cursor On

Locate 1 , 1
Lcd "TEMP"

Do
W = Getadc(0)
Volt = W * 3
Volt_d = Volt Mod 10
Volt = Volt / 10
Locate 1 , 9
Lcd Volt ; "," ; Volt_d
Locate 1 , 13
Lcd "'C"


Cols = Volt / 2

Locate 2 , 1
For I = 1 To Cols
Select Case I
Case 1 : Lcd Chr(3)
Case 4 : Lcd Chr(4)
Case 8 : Lcd Chr(4)
Case 12 : Lcd Chr(4)
Case 16 : Lcd Chr(4)
Case Else : Lcd Chr(0)
End Select
Next I

Waitms 100

Loop
End

2 comments:

suresh said...

plz I want Microcontroller based data acquisition sytem for measurment of temp,pressure,rpm and liquid level.
sensors are-pt100, float for pressure and to know snsors for other two with 'C'code

salona said...

Hi,i want to know the c coding for this Digital Thermometer using ATmega16 and 16*2 LCD.Can u plz mail me the c code