• sgprojects.co.in.jpg

Servo Based Thermometer

This is a classical analog type thermometer but the design technique used in this project is completely digital. The reading of the thermometer is shown by a screw driver which is attached with the servo horns to move through the scale in degree centigrade(°C). We have set the range from 0-50°C. For reducing the cost of the project, we used an 8-pin PIC microcontroller from Microchip. Due to the internal architecture of this RISC(Reduced Instruction Set Computer) microcontroller, we do not need any crystal or resistors.

ThermoFront ThermoThermo3Thermo4



Required Components :

  • PIC12F675 Microcontroller
  •  LM35 Temperature Sensor
  • Servo motor
  • 5V DC power supply source
  • Breadboard & wires etc.
  • PIC microcontroller Programmer

Circuit Schematic

PIC ServoBasedThermometer

A 5V DC power supply is suitable for the circuit as here all the electronics work on 5V. After connecting the system you just need to calibrate the °C scale aligned with the servo horn.

Working :

Temperature sensor LM35 provides the analog voltage output with 10mV/0°C scale factor. This output is connected to pin7(analog 0 pin) of the microcontroller. Hence the servo position depends on the output voltage of LM35. The mechanics of the project is based on the servo motor. These motors are generally used for angular movement. We are using the servo motor for 0° - 180° movement. Servo motor's angular  position are controlled by PWM(Pulse Width Modulation) technique.

Calibration :

Start the project by adjusting the servo to 0° angular position matching with the 0°C temperature scale without power supply. This calibration process is required for the first time only. That's it, now play the project.

The program is compiled using "mikroC PRO for PIC" compiler. You must be aware to the setting of the compiler while using the internal oscillator. Also disable the MCLR pin function.

Project : Analog type servo temperature indicator
Developer : Sameer Gupta (sgprojects.co.in)
MCU : PIC12F675
XL : Internal 4MHz osc with disabled MCLR pin function
Date : Jan 2016
Description : AN0(GP0) pin input from LM35, GP2 pin output for servo
We've set the temperature maxRange at 50°C Centigrade.
sbit Pulse at GP2_bit;
unsigned short delay;
unsigned long temp_value;
unsigned short multiplier = (250-60)/50; //Servo varies from 60 to 250 machine cycle with 50°C Max temp. range
void interrupt() {
Pulse = 1;
Pulse = 0;
TMR0 = 180; // TMR0 returns to its initial value
INTCON.T0IF = 0; // Bit T0IF is cleared so that the interrupt could reoccur
void main() {
CMCON = 0x07; // Disable Comparators
TRISIO = 0b00000001;
OPTION_REG = 0x07; // Prescaler (1:256) is assigned to the timer TMR0
TMR0 = 180; // Timer T0 counts from 180 to 255 to create ~20 ms period
INTCON = 0xA0; // Enable interrupt TMR0 and Global Interrupts
ANSEL = 0b00000001;
temp_value = ADC_Read(0);
temp_value = temp_value*488;
temp_value = temp_value/1000; // This line gives two digit temp. value
temp_value = temp_value*multiplier;

Download the source code.



Add comment

Security code


Visitors Today64
Visitors Yesterday171

  • Your IP Address :


SG Templetes by Sameer Gupta