Fahrenheit scale digital thermometer is a temperature indicator which displays temperature in Fahrenheit scale. It is similar to Celsius scale digital thermometer, except a little modification in the microcontroller program. The temperature sensed in Celsius scale in the Celsius scale thermometer project is converted into the Fahrenheit scale temperature just by using the Celsius to Fahrenheit conversion formulae. This project also uses 8051 microcontroller (AT89C51).
A digital thermometer can be easily made by interfacing a temperature sensor to the microcontroller AT89C51. The temperature sensor used in the project is LM35. The LM 35 IC generates a 10mV variation to its output voltage for every degree Celsius change in temperature. The Output of the temperature sensor is analog in nature so we need an analog to digital convertor for converting the analog input to its equivalent binary output. The ADC 0804 is the analog to digital convertor IC used in the project. 0804 is a single channel convertor which converts the analog input up to a range of 5V to an equivalent 8-bit binary output.
The step size is defined by the voltage applied at the Vref/2 pin of the ADC IC. For example, if the voltage at Vref/2 pin is set to 1.28V then ADC has a step size of 10 mV. So if the input voltage is 1V the equivalent binary output of ADC will be 100 or 0110 0100 in binary. The 8 bit binary output of the ADC is incremented by one for every 10 mV rise of input voltage. Different step size can be selected by changing the voltage input to the Vref/2 pin. The step size of the ADC is calibrated using a preset to match the actual temperature. Once the ADC is calibrated it will give the correct output further. The binary output of ADC is fed parallel to a port of the microcontroller . The microcontroller reads the input through ADC and displays the corresponding decimal value on LCD indicating the temperature.
Project Source Code
###
//Program to display temperature in Celsius and Farenheit 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 commands 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; return; } void lcd_data_string(unsigned char *str) // Function to string to LCD { int i=0; while(str[i]!='