Thursday 25 September 2014

Celsius scale digital thermometer using 8051 microcontroller (AT89C51)

Celsius Scale Digital Thermometer Using 8051 Microcontroller (AT89C51)


Celsius scale thermometer displays the ambient temperature through a LCD display. It consists of two sections. One is that which senses the temperature. This is a temperature sensor LM 35. The other section converts the temperature value into a suitable number in Celsius scale which is done by the ADC0804.

Description

Celsius scale thermometer shows the surrounding temperature through a LCD show. It comprises of two segments. One is what faculties the temperature. This is a Celsius Digital Scale utilizing 8051 

temperature sensor LM 35. The other segment changes over the temperature esteem into a suitable number in Celsius scale which is finished by the ADC0804. A computerized thermometer can be effortlessly made by interfacing a temperature sensor to the microcontroller AT89C51. The temperature sensor utilized as a part of the venture isLM35. The LM 35 IC produces a 10mV variety to its yield voltage for each degree Celsius change in temperature. The Output of the temperature sensor is simple in nature so we require a simple to computerized convertor for changing over the simple info to its proportionate parallel output.ADC 0804 is a simple to advanced convertor IC utilized as a part of the venture. 0804 is a solitary channel convertor which changes over the simple info up to a scope of 5V to an identical 8-bit paired yield. 

An advanced thermometer can be effectively made by interfacing a temperature sensor to the microcontroller AT89C51. The temperature sensor utilized as a part of the task is LM35. The LM 35 IC produces a 10mV variety to its yield voltage for each degree Celsius change in temperature. The Output of the temperature sensor is simple in nature so we require a simple to advanced convertor for changing over the simple info to its equal parallel yield. The ADC 0804 is the simple to computerized convertor IC utilized as a part of the undertaking. 0804 is a solitary channel convertor which changes over the simple info up to a scope of 5V to a proportional 8-bit paired yield.





The stride size is characterized by the voltage connected at the Vref/2 pin of the ADC IC. Case in point, if the voltage at Vref/2 pin is situated to 1.28V then ADC has a stage size of 10 mV. So if the data voltage is 1V the proportional parallel yield of ADC will be 100 or 0110 0100 in paired. The 8 bit parallel yield of the ADC is increased by one for each 10 mV ascent of information voltage. Diverse step size can be chosen by changing the voltage data to the Vref/2 pin. The stride size of the ADC is balanced utilizing a preset to coordinate the real temperature. Once the ADC is aligned it will give the right yield further. The double yield of ADC is nourished parallel to a port of the microcontroller .The microcontroller peruses the info through ADC and showcases the comparing decimal esteem on LCD


indicating the temperature.



 CIRCUIT DIAGRAM :


CODE :

//Program to make a digital thermometer with display in centigrade scale

#include<reg51.h>
#define port P3
#define adc_input P1
#define dataport P0
#define sec 100
sbit rs = port^0;
sbit rw = port^1;
sbit e = port^2;

sbit wr= port^3;
sbit rd= port^4;
sbit intr= port^5;

int test_intermediate3=0, test_final=0,test_intermediate1[10],test_intermediate2[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 command to LCD
{
dataport = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
return;
}

void lcd_data(unsigned char item) //Function to send data to LCD
{
dataport = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
//delay(100);
return;
}

void lcd_data_string(unsigned char *str)  // Function to send string to LCD
{
int i=0;
while(str[i]!='\0')
{
  lcd_data(str[i]);
  i++;
  delay(10);
}
return;
}

void shape()     // Function to create the shape of degree
{
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;
test_final=test_intermediate3;
lcd_cmd(0xc1); 
delay(2);
lcd_data_string("TEMP:");
s=test_final/100;
test_final=test_final%100;
lcd_cmd(0xc8);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=test_final/10;
test_final=test_final%10;
lcd_data(s+48);
lcd_data(test_final+48);
lcd_data(0);
lcd_data('c');
lcd_data(' ');
delay(2);
}

void main()
{
int i,j;
adc_input=0xff;
lcd_cmd(0x38); 
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);
    test_intermediate1[i]=adc_input/10;
    delay(1);
    intr=1;
   }
   for(i=0;i<10;i++)
   test_intermediate2[j]=test_intermediate1[i]+test_intermediate2[j];
  }

test_intermediate2[0]=test_intermediate2[0]/3;
test_intermediate2[1]=test_intermediate2[1]/3;
test_intermediate2[2]=test_intermediate2[2]/3;
test_intermediate3=test_intermediate2[0]+test_intermediate2[1]+test_intermediate2[2];
shape();
convert();
}
}

Components :


LM35 Temperature Sensor :

LM35 is an exactness IC temperature sensor with its yield corresponding to the temperature (in oC). The sensor hardware is fixed and in this way it is not subjected to oxidation and other processes....

AT89C51 Microcontroller :

AT89C51 is a 8-bit microcontroller and fits in with Atmel's 8051 crew. ATMEL 89C51 has 4KB of Flash programmable and erasable read just memory

LCD :

LCD (Liquid Crystal Display) screen is an electronic presentation module and locate an extensive variety of uses. A 16x2 LCD showcase is exceptionally essential module and is usually utilized as a part of different gadgets and circuits.

ADC0804 :

Simple to computerized converters find tremendous application as a middle of the road gadget to change over the signs from simple to advanced structure. These advanced signs are utilized for further handling by the computerized processors. Different sensors like temperature, weight, power and so on believer the physical attributes into electrical signs that are simple in nature.

6 comments:

  1. wawo i was searching for this code ,,,, finally got it

    ReplyDelete
  2. wawo i was searching for this code ,,,, finally got it

    ReplyDelete
  3. can i get the code in assembly code 8051

    ReplyDelete
  4. Can I get the applications and limitations of the circuit

    ReplyDelete
  5. Fantastic Post! Lot of information is helpful in some or the other way. Keep updating.digital thermometer

    ReplyDelete