Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Microcontroller Project

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

A REPORT OF

PROJECT ON

TEMPERATURE SENSING
USING LM35

OF MICROCONTROLLER LAB (EEE394)

AIM:

1
To indicate the temperature range using LM35 temperature sensor and to simulate the following

THEORY:

LM35 is a precision IC temperature sensor with its output proportional to the temperature (in
oC). The sensor circuitry is sealed and therefore it is not subjected to oxidation and other

processes. With LM35, temperature can be measured more accurately than with a thermistor. It
also possess low self-heating and does not cause more than 0.1 oC temperature rise in still
air. The operating temperature range is from -55°C to 150°C. The output voltage varies by
10mV in response to every oC rise/fall in ambient temperature, i.e., its scale factor is 0.01V/
oC.

Pin Diagram:

Pin Description:

Pin No Function Name


1 Supply voltage; 5V (+35V to -2V) Vcc
2 Output voltage (+6V to -1V) Output
3 Ground (0V) Ground

PROCEDURE:

1. First open Proteus professional software.


2. Open new project in File.

2
3. From the component library add ATMEGA 32, LM35 and LCD to the component list to be
used.
4. Place the ATMEGA 32 on the workspace and connect the LM35 to the PA1/ADC1 pin .
5. Connect the first pin of LM35 to Vcc and pin3 to ground.
6. Connect the output pin of ATMEGA 32 PA1 to D0 of lcd
7. Connect the output pin of ATMEGA 32 PA2 to D1 of lcd
8. Connect the output pin of ATMEGA 32 PA3 to D2 of lcd
9. Now code the program in ATMEGA software and load the coded program to Proteus
professional.
10. Run the Simulation.
11. The temperature of room will be diaplayed on lcd screen

CODE:

#include <avr/io.h>

#include <util/delay.h>

#define RS PB0

#define RW PB1

#define E PB2

void LCDCOM(int a)//LCD INITIATION

PORTC=a;

PORTB&=~(1<<RS);

PORTB&=~(1<<RW);

PORTB|=(1<<E);

_delay_ms(1);

PORTB&=~(1<<E);

void LCDDAT(int b)// DATA INPUT

PORTC=b;

PORTB|=(1<<RS);

3
PORTB&=~(1<<RW);

PORTB|=(1<<E);

_delay_ms(1);

PORTB&=~(1<<E);

void ADC_init() //ADC

ADMUX=(1<<REFS0);

ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADATE);

unsigned int ADC_read(int a)

a= a & 0b00000111;

ADMUX |= a;

ADCSRA|=(1<<ADSC);

while(!(ADCSRA & (1<<ADIF)));

return (ADC);

void STRING(int s)

int a,b,c,d;

a=s%10;

LCDCOM(0x84);

LCDDAT(a+48);

b=(s/10)%10;

LCDCOM(0x83);

LCDDAT(b+48);

4
c=(s/100)%10;

LCDCOM(0x82);

LCDDAT(c+48);

d=(s/1000)%10;

LCDCOM(0x81);

LCDDAT(d+48);

main()

DDRA=0x00;

DDRB=0xFF;

DDRC=0xFF;

DDRD=0xFF;

int b,c,q;

LCDCOM(0x38);//LCD INITALZATION

LCDCOM(0x0e);//LCD INITALZATION

ADC_init();

while(1)

ADC_read(0b00000001);

c=ADCL;

b=ADCH;

q=(c&(0x0f))+((c>>4)*16)+((b&(0x0f))*256-1);//BINARY TO DECIMAL

STRING(q);//THE VALUE OF q GOES TO LCD

5
}}

SCREEN SHOTS:

RESULT: Thus we have displayed the temperature of room with atmega-32 & lm35 using proteus
professional .

You might also like