Celsius Scale Digital Thermometer Using 8051 Microcontroller

A celsius scale digital thermometer is an electronic device that can measure the temperature of its surroundings and convert its analog data into digital form through digital display. Today we will be going to make such type of celsius scale digital thermometer using AT89C51 microcontroller and LM35 temperature sensor. LM35 has the advantage of providing direct output according to the celsius scale without any need for calibration.

This project also contains an 8-bit analog to digital converter i.e. ADC0804 which can process an approximate conversion technology. The output of the temperature sensor is shown in LCD display by converting through ADC0804 and AT89C51 microcontroller.

Must Read Password Based Door Lock System Using 8051 Microcontroller

Principle Behind Celsius Scale Digital Thermometer

The main principle behind the circuit is to convert analog data to accurate digital data. When the temperature of surroundings is sensed by an analog sensor (LM35), it then goes to ADC0804 ADC ( Analog to Digital Converter ). After that, the whole signal is processed through the AT89C51 microcontroller and displayed in an LCD display.

Project

Circuit Diagram

Celsius Scale Digital Thermometer Using AT89C51 Microcontroller Circuit Diagram

Components Required

  • 8051 Microcontroller (AT89C51)
  • 8051 Development Board
  • Programmer (8051)
  • 16×2 LCD Display
  • ADC0804 Analog to Digital Converter
  • LM35 Temparature Sensor
  • 10KΩ Resistor
  • 10KΩ Potentiometer
  • 150pF Ceramic Capacitor (Code 151)
  • Connecting Wires
  • Power Supply

Software Required

  • Keil µVision IDE Software
  • Willar Software

Additional Components

If you don’t have an 8051 Development Board then you need this additional components.

  • 11.0592 MHz Quartz Crystal
  • 33pF Ceramic Capacitor (x2)
  • 10KΩ Resistor (x2)
  • 10uF/25V Polarized Capacitor
  • Push Button

Celsius Scale Digital Thermometer Connection Section

Oscillator Section

Oscillator circuit consists of a crystal oscillator (11.0592 MHz) and two ceramic capacitors (33pF) for the stability.

Reset Section

The reset section consists of a push-button, a 10KΩ resistor and a 10uF/25V capacitor for 100ms pulse width and a reset voltage of 1.2V.

EA Pin

We are not using any external memory for this project. So we use a 10KΩ resistor for high enabling.

Interfacing ADC0804 Analog Digital Converter with LM35

Let discuss about how we can interface LM35 temperature sensor with ADC0804 converter for analog to digital input.

Here LM35 temperature sensor consists of three pins that are VOUT, VS and GND. Analog pin 6 (+VIN) of the ADC0804 ic is connected to the VOUT pin of the LM35 sensor.

Pin 20 (VCC) of ADC0804 is connected to a +5V power supply. And pins 1 (CS),7 (-VIN), 8 (AGND) and 10 (GND) of the ADC converter are directly connected to the ground. A 10KΩ resistor is connected between the clock pins 4 (CLKIN) and pin 19 (CLKR) of the ADC converter. Also, a 150pF ceramic capacitor is attached between pin 4 (CLKIN) and the ground. Pin 3 and pin 5 both are connected.

Data pins 11 to 18 (DB0 – DB7) of ADC converter are connected to PORT2 pin of the 8051 microcontroller.

Interfacing LCD Display with 8051 Microcontroller

The RS, RW and EN pins of the LCD display are directly connected to the port pins P3.6, GND and P3.7 respectively. The data pins are connected to PORT1 of the 8051 microcontroller.

Circuit Design Using PCB Software

To make the circuit compact and give a professional look, I have designed the PCB after testing all the features of the celsius scale digital thermometer on the breadboard. I will explain in detail how we can design and order PCB for our project.

Celsius Scale Digital Thermometer Using AT89C51 Microcontroller PCB

For Gerber file check out this link Celsius scale digital thermometer using microcontroller

Order PCB From PCBWay

I ordered the PCB prototype board from the www.pcbway.com website. PCBWay is a Chinese-based PCB (printed circuit board) prototype, PCB assembly, SMD Stencil, and Flexible PCB manufacturer. They ship to more than 170 countries worldwide and process more than 2100 PCB orders a day. It feels like PCBWay gives an excellent price and customer service factor in one single serving. The quality of the PCB is awesome and its thickness is really great. What is also spectacular about PCBWay to me, as a maker and customer, is their service. From their friendly support staff to their intuitive, user-friendly website features, it all counts towards what makes PCBWay an ideal company and brand for any electronic hobbyists In this article, I will state that how can we order PCB from PCBWay with step by step guide.

Features of PCBWay

1. PCB prototyping and manufacturing

They are not only producing FR-4 and Aluminum boards, but also advanced PCB like Rogers, HDI, Flexible and Rigid-Flex boards, at a very reasonable price.

Visit the link for Instant Quote

Visit the link for Gerber file viewer

2. PCB assembly

SMT & THT assembly starts from only $30 with a free stencil and free worldwide shipping. The components can be sourced and provided by PCBWay, or by clients themselves.

3. Layout and design

Partnering with quality service providers to offer design services.

4. Open source community

Student sponsorship shared PCB projects and so on.

5. 3D Printing & CNC

On-demand Production and Rapid Prototyping in as Fast as 1 Day Leading the Digital Manufacturing Revolution.

Step 1: Go to the PCBWay website and sign up/sign in. Into the PCB Prototype tab, enter the dimensions of your PCB, the number of layers, and the number of PCBs you require. After that proceed by clicking on the ‘Quote Now’ button.

Step 2: You will be redirected to a page where to set a few additional parameters like the board type, layers, material for PCB, thickness, and more, most of them are selected by default, if you are opting for any specific parameters, you can edit it in here.

Step 3: The final step is to upload the Gerber file and proceed with the payment. To make sure the process is smooth, PCBWAY verifies if your Gerber file is valid before proceeding with the payment. This way, you can be sure that your PCB is fabrication friendly.

Working Principle of Celsius Scale Digital Thermometer

The LM35 temperature sensor can sense the ambient temperature of surroundings which produces a minimal output voltage that is proportional to the temperature at a rate of 10mV/°C. This analog input voltage is given to the ADC converter (ADC0804), which can work on the principle of successive approximation conversion.

The ADC converter is configured to read the analog signals continuously and produces digital output through its digital pins. To read the analog input values continuously, we need to join both ADC0804’s pin 5 (INTR) and pin 3 (WR) together. Also, to transfer the digital data to the digital output pins of the ADC0804, pin 1 (CS) and pin 2 (RD) must pull ground for the low value.

Thus the analog to digital converter continuously takes the analog signals from the LM35 temperature sensor and converts them into digital signals. The digital output signal of the ADC0804 is the 8-bit binary data.

8051 microcontroller takes this digital signal and does a simple arithmetical calculation. This calculation will convert the received digital data from the ADC0804 converter and converts it to temperature in °C.

Now, the microcontroller will send this digital signal to the LCD and display the value. Since the ADC converter is continuously reading the analog signal from the LM35 temperature sensor and sending it to the microcontroller through the digital pins, the temperature will be updated at all times on the display.

Applications of Celsius Scale Digital Thermometer

  • It can be used in cars to keep track of temperature all time.
  • Thermoelectric devices can use this sensor for switching on/off their temperature like Air Conditioner, Geyser, etc.
  • It can also be used at homes, office to get the temperature reading of the surrounding.

Microcontroller 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]!='')
{
  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();
}
}

2 thoughts on “Celsius Scale Digital Thermometer Using 8051 Microcontroller”

Leave a Comment