This is the project about sensing the temperature from environment and display it in LCD. We use 16x2 LCD for display.

LM35 :-
We use LM35 temperature sensor for sensing the temperature from environment. It gives 10 milivolt on 1°C temperature when operating on 5 volts.
ADC0804 :-
LM35 gives the analog signal for converting this into digital signal we use a 8 bit ADC IC ADC0804.

16x2 LCD :-
16x2 LCD is used to display the Temperature. see more here......
LCD INTERFACING WITH 8051
8051 :-
Circuit Digram :-
download this image and zoom in then you can see clearly all the connections.
1N4007 diode - 1
330 0HM RESISTANCE - 2
10K OHM RESISTANCE - 2
10K OHM VARIABLE RESISTANCE - 2
150PF CAPACITOR - 1
33PF CAPACITOR - 2
10UF CAPACITOR - 1
1000UF CAPACITOR - 1
11.0592 MHZ CRYSTAL OSCILLATOR - 1
GREEN LED - 1

LM35 :-
We use LM35 temperature sensor for sensing the temperature from environment. It gives 10 milivolt on 1°C temperature when operating on 5 volts.
ADC0804 :- LM35 gives the analog signal for converting this into digital signal we use a 8 bit ADC IC ADC0804.

16x2 LCD :-
16x2 LCD is used to display the Temperature. see more here......
LCD INTERFACING WITH 8051
8051 :-
Circuit Digram :-
![]() |
| pink lines - 12v red lines - 5v black lines - ground blue lines - data |
Components Required :-
330 0HM RESISTANCE - 2
10K OHM RESISTANCE - 2
10K OHM VARIABLE RESISTANCE - 2
150PF CAPACITOR - 1
33PF CAPACITOR - 2
10UF CAPACITOR - 1
1000UF CAPACITOR - 1
11.0592 MHZ CRYSTAL OSCILLATOR - 1
GREEN LED - 1
RED LED - 116X2 LCD - 1
12 volt battery upto 1.5 amp. -1
P89V51RD2 MICROCONTROLLER - 1
PUSH BUTTON - 1
ADC0804 IC - 1
12 volt battery upto 1.5 amp. -1
P89V51RD2 MICROCONTROLLER - 1
PUSH BUTTON - 1
ADC0804 IC - 1
LM35 - 1
7805 IC - 1
16x2 LCD - 1
MALE AND FEMALE CONNECTORS LINES
CONNECTING WIRES.
7805 IC - 1
16x2 LCD - 1
MALE AND FEMALE CONNECTORS LINES
CONNECTING WIRES.
Code :-
----------------------------------------------------------------------------------------------------------------------------------
//Program to display temperature in Celsius and Farenheit scale.
#include<reg51.h>
#define sec 100
sbit rs = P3^0;
sbit rw = P3^1;
sbit e = P3^2;
sbit wr= P3^3;
sbit rd= P3^4;
sbit intr= P3^5;
int x=0, y=0,z[10],a[3]={0,0,0};
void delay(unsigned int msec )
{
int i ,j ;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}
void lcd_cmd(unsigned char item) // Function to send commands to LCD
{
P2 = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
return;
}
void lcd_data(unsigned char item) // Function to send data to LCD
{
P2 = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
return;
}
void lcd_data_string(unsigned char *str) // Function to string to LCD
{
int i=0;
while(str[i]!='\0')
{
lcd_data(str[i]);
i++;
delay(10);
}
return;
}
void shape() // Function to make the shape of degree symbol
{
lcd_cmd(64);
lcd_data(2);
lcd_data(5);
lcd_data(2);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
}
void convert() // Function to convert the values of ADC into numeric value to be sent to LCD
{
int s;
lcd_cmd(0x81);
delay(2);
lcd_data_string("TEMP:");
y=(((9*x)/5)+32);
s=y/100;
y=y%100;
lcd_cmd(0x88);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=y/10;
y=y%10;
lcd_data(s+48);
lcd_data(y+48);
lcd_data(0);
lcd_data('F');
lcd_data(' ');
y=x;
lcd_cmd(0xc1); //Setting cursor to first position of first line
delay(2);
lcd_data_string("TEMP:");
s=y/100;
y=y%100;
lcd_cmd(0xc8);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=y/10;
y=y%10;
lcd_data(s+48);
lcd_data(y+48);
lcd_data(0);
lcd_data('c');
lcd_data(' ');
delay(2);
}
void main()
{
int i,j;
P1=0xff;
lcd_cmd(0x38); //2 Line, 5X7 Matrix display
lcd_cmd(0x0c); //Display On, Cursor blinking
delay(2);
lcd_cmd(0x01); // clear screen
delay(2);
while(1)
{
for(j=0;j<3;j++)
{
for(i=0;i<10;i++)
{
delay(1);
rd=1;
wr=0;
delay(1);
wr=1;
while(intr==1);
rd=0;
lcd_cmd(0x88);
z[i]=P1/10;
delay(1);
intr=1;
}
for(i=0;i<10;i++)
a[j]=z[i]+a[j];
}
a[0]=a[0]/3;
a[1]=a[1]/3;
a[2]=a[2]/3;
x=a[0]+a[1]+a[2];
shape();
convert();
}
}
#include<reg51.h>
#define sec 100
sbit rs = P3^0;
sbit rw = P3^1;
sbit e = P3^2;
sbit wr= P3^3;
sbit rd= P3^4;
sbit intr= P3^5;
int x=0, y=0,z[10],a[3]={0,0,0};
void delay(unsigned int msec )
{
int i ,j ;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}
void lcd_cmd(unsigned char item) // Function to send commands to LCD
{
P2 = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
return;
}
void lcd_data(unsigned char item) // Function to send data to LCD
{
P2 = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
return;
}
void lcd_data_string(unsigned char *str) // Function to string to LCD
{
int i=0;
while(str[i]!='\0')
{
lcd_data(str[i]);
i++;
delay(10);
}
return;
}
void shape() // Function to make the shape of degree symbol
{
lcd_cmd(64);
lcd_data(2);
lcd_data(5);
lcd_data(2);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
}
void convert() // Function to convert the values of ADC into numeric value to be sent to LCD
{
int s;
lcd_cmd(0x81);
delay(2);
lcd_data_string("TEMP:");
y=(((9*x)/5)+32);
s=y/100;
y=y%100;
lcd_cmd(0x88);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=y/10;
y=y%10;
lcd_data(s+48);
lcd_data(y+48);
lcd_data(0);
lcd_data('F');
lcd_data(' ');
y=x;
lcd_cmd(0xc1); //Setting cursor to first position of first line
delay(2);
lcd_data_string("TEMP:");
s=y/100;
y=y%100;
lcd_cmd(0xc8);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=y/10;
y=y%10;
lcd_data(s+48);
lcd_data(y+48);
lcd_data(0);
lcd_data('c');
lcd_data(' ');
delay(2);
}
void main()
{
int i,j;
P1=0xff;
lcd_cmd(0x38); //2 Line, 5X7 Matrix display
lcd_cmd(0x0c); //Display On, Cursor blinking
delay(2);
lcd_cmd(0x01); // clear screen
delay(2);
while(1)
{
for(j=0;j<3;j++)
{
for(i=0;i<10;i++)
{
delay(1);
rd=1;
wr=0;
delay(1);
wr=1;
while(intr==1);
rd=0;
lcd_cmd(0x88);
z[i]=P1/10;
delay(1);
intr=1;
}
for(i=0;i<10;i++)
a[j]=z[i]+a[j];
}
a[0]=a[0]/3;
a[1]=a[1]/3;
a[2]=a[2]/3;
x=a[0]+a[1]+a[2];
shape();
convert();
}
}
----------------------------------------------------------------------------------------------------------------------------------
Calculations in above program are standard.
Pictures :-
Videos :-
IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.








.jpg)



