Here I discus on very good project on digital thermometer. I made this project by Lm35 interfacing with pic 16f877 through adc0808. Pic16f877 microcontroller has inbuilt ADC (Analog to Digital Converter  but I use external ADC IC (adc0808) because of simplicity of project if I use inbuilt adc then I have to take consideration on lots of mathematical calculation to get desire output.

To build my project I use LM35 (Temperature sensor) to sense temperature ,  IC ADC0808 for converting analog value to digital and microcontroller PIC16f877 for process and display the temperature in LCD. In bellow see the block diagram of my project.

 Lm35 interfacing with pic 16f877 through adc0808

LM35 : LM35 IC is a temperature Sensor. It sense the temperature and covert it equivalent voltage label. I supply 5 volt VCC on LM35 and it convert o.o1v per 1° of voltage change. Let take an example if I have to measure 35° C temperature then it will give output 0.35v.

ADC (adc0808) : The output of ADC then directly feed to channel 0 of IC ADC0808. And this IC convert the input voltage in 8-bit binary number. For voltage 0.01v the output will be generated 00000001 in 8-bit position. So if your LM35 sense 2°C temperature then you will get 00000010 in output of adc. Keep in mind I set 2.56v +Vref in adc0808 to get output for change of every 1°C.

Pic16f877: I use this Pic16f877 for just taking the output of adc to and process it and send the display to LCD. For that I have to define PORTB as a input port to take the data form ADC. And I initialized LCD at port PORTD to display our result.

See the circuit diagram in Proteus and get the embedded code in bellow.


  See embedded Code

Embedded C Code
// Name : Digital Thermometer // Purpose : To sense the room tamperature. // Author : Subham Dutta // Date : 20-09-13 // Website :
// LCD module connections
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
unsigned int temp_res,cal; char last[5];
void main() {TRISb = 0b11111111; // PORTB is input
do { temp_res = portb; // Get 8-bit results of AD conversion
cal = (temp_res);
Lcd_Out(1,15,” “);
} while(1);

See the simulation of our project digital thermometer “Lm35 interfacing with pic 16f877 through adc0808”