Electronics ru
Advanced Search +


A Simple Digital Thermometer

his is truly a simple digital thermo meter, a beginner’s project, but having sufficient accuracy. The brain of this circuit is PIC16F877A; a Microcontroller from Microchip and it is easily available now. It has an inbuilt 10 bit Analog to digital converter, and also has many additional features that you love to explore.

Working principle

The temperature-sensing element is LM35, A chip from National Semiconductor. This chip has DC voltage output (10mV/°C) interface, which is fairly linear and easy to interface with the PIC PIC16F877A. This chip is easily available and samples can be ordered from National. It does not require any external calibration or trimming and provides typical accuracy of +/-0.25°C at room temperature. It can measure +2°C to +150°C, and if the circuit changed a little, then it can be used to measure temperature from –55°C to +150°C. Since only 3 display digits are used (one after the decimal point), this circuit can measure temperature up to 99.9°C.

Since there are 8 ADC channels, more than one LM35 can be connected to the MCU for measuring temperatures at various places using the setup. However, in this project only two numbers of LM35s are connected. A switch connected to RA4 input is used to display the temperature measured by these Sensors.

The software

The PIC16F877A has an inbuilt 8-bit Timer0 module, and this can be configured to generate timer interrupts when it overflows. The system clock divided by the programmable prescaler clocks the timer0. The timer interrupt rate can thus be controlled by prescaler divide value. On interrupt the microprocessor stops all other jobs, and goes to the interrupt routine. The interrupt routine is actually used to scan and refresh the multiplexed seven segment displays.

The inbuilt ADC (Analog to Digital Converter) has eight input channels. Only two of them are used, unused analog channel pins are used as digital I/O. The switch provided at RA4 selects the input channel. The program reads is written in such a way that it displays the temperature after taking the average of four consecutive readings. The ADC value is 10 bit wide and it is available in ADRESH:ADRESL register pairs after completing the conversion.

The specified absolute error of A/D converter is < +/- 1 LSB for VDD = VREF. To meet this accuracy, the charge holding capacitor (internal to the chip) must be allowed to fully charge to input voltage level (approximately 20μs is required) before starting conversion. Another 44 micro second is required to complete the A/D conversion if A/D clock is derived from internal A/D RC oscillator. Since usually the temperature wouldn’t change drastically, a 200 micro second delay is provided before the next attempt to read the temperature; this also helps to giving a continuous display of temperature of the selected channel.

Click for unlarge

Fig.1 Schematic of Thermometer


Since the circuit is so simple, it can be easily assembled on a common PCB. Always use a good IC socket for PIC16F877, and use minimum length for LM35 cable. A 9V DC supply is recommended for this circuit, and the current drain is 160mA (approx).


This circuit can be modified and may be add the following features:

  1. PC interface to log data.
  2. Interface to control devices as per the temperature.
  3. Audible warning when a set point temperature is reached.
  4. Interfacing 4 x 4key board.

Finally it can also be used to ON/OFF various equipments depends on the temperature, as shown in the program. The program is written in C and compiled using HI-TECH PICC-Lite, free software from HI-TECH Softwares . This IC can be programmed using Fengs Multi PIC programmer and IC Prog. The circuit, Program and the hex file for programming PIC16F877A is available in the Downloads of this site.

Slices ↓
Radiolocman facebook Radiolocman twitter Radiolocman google plus