# Temperature Meter by using PIC In this project, a temperature meter is designed and implemented to measure the temperature a room, or outside. There are a large variety of temperature sensors, in this project LM35 is used, I choose that sensor for several reasons. These reasons are:

• precision integrated-circuit temperature sensors.

• its output voltage is linearly proportional to the Centigrade temperature.

• it has low output impedance.

• linear output.

• precise inherent calibration.

• The LM35 has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling.

For the reasons mentioned above, the interfacing with PIC Micro-controller became much easier!!!

The output voltage of this LM35 sensor is an analog voltage, so it must be converted to digital to deal with it easily. The analog output voltage is converted to 8-bit digital number using the internal ADC of PIC16F877A. According to the data sheet of LM35, there is an output voltage equal to 10mv for every 1°C. From this, we can derive a mathematical relation between the sensor output voltage and ADC result to find the correct value of the temperature that will be displayed on LCD.

The reference voltage of ADC=5v , so the resolution=5/255;

Temp. in °C= ADC measured Value x (1/51) x (1/10mV) .

```// Author: Abdullah M. Zyarah
// www.DigitalComputing.net

#include <16f877a.h>
#use delay(clock=20M)
#include <lcd420.c>
#fuses hs,nowdt,nocpd,nolvp,noprotect

#byte portc=0x07
#bit  led=portc.4

unsigned int16 value;
char temp;

void main()
{
set_tris_c(0x00);
led=1;
delay_ms(50);
lcd_init();
delay_ms(50);
printf(lcd_putc,"   *Temp. Meter*");
lcd_gotoxy(1,3);
printf(lcd_putc,"   Temp.=       ");
lcd_gotoxy(1,4);
printf(lcd_putc,"www.pic-tronics.com");
delay_ms(50);

while(1)
{