Digital thermometer using arduino

Digital thermometer using arduino and LM35.

This article is about a simple three digit digital thermometer using arduino. Range of this thermometer is from 0°C to 99.9°C. There is also a provision for displaying the temperature in °F scale. Three terminal analog temperature sensor LM35 is used as the sensor here. LM35 can measure temperatures between -55°C to +155°C. The supply voltage range is from 4V to 30V DC and the current drain is 60uA. The LM35 is available in TO-92 package and it is very easy to use. The output voltage of the arduino increases 10mV per °C rise in temperature. That means if 25 °C is the temperature, then output  voltage of the sensor will be 250mV. Circuit diagram of the digital thermometer using arduino and LM35 is shown in the figure below.Digital thermometer using arduino

Circuit diagram.

Temperature sensor LM35 is connected to the arduino through the analog input pins. A0 pin of the arduino serves as the supply voltage source for LM35 and A2 pin of the arduino serves as the ground. Arduino reads the voltage output of the LM35 through the analog input pin A1. Digital  pin 4 is used for interfacing the °C/°F selector switch to the arduino. Digit driver transistors Q1, Q2 and Q3 are interfaced to the digital pins 1, 2 and 3 of the arduino respectively. Multiplexed segment lines  a to dp are interfaced to the digital pins 5 to 12 of the arduino respectively. Resistors R9, R10 and R11 limits the base current of the corresponding transistors. Resistors R1 to R8 limits the current through the corresponding segments.




int i;
int backup;
int a;
int unit;
int value;
int vcc=A0;
int sensor=A1;
int gnd=A2;
int select=4;
int disp1=1;
int disp2=2;
int disp3=3;
int segA=5;
int segB=6;
int segC=7;
int segD=8;
int segE=9;
int segF=10;
int segG=11;
int segDP=12;
void setup()
  pinMode(disp1, OUTPUT);
  pinMode(disp2, OUTPUT);
  pinMode(disp3, OUTPUT);
  pinMode(segA, OUTPUT);
  pinMode(segB, OUTPUT);
  pinMode(segC, OUTPUT);
  pinMode(segD, OUTPUT);
  pinMode(segE, OUTPUT);
  pinMode(segF, OUTPUT);
  pinMode(segG, OUTPUT);
  pinMode(segDP, OUTPUT);
  pinMode(sensor, INPUT);
  pinMode(vcc, OUTPUT);
  pinMode(gnd, OUTPUT);
  pinMode(select, INPUT);
  digitalWrite(vcc, HIGH);
  digitalWrite(gnd, LOW);

  void loop()
  value=analogRead(sensor); //Reads the sensor LM35
  unit=digitalRead(select); //Reads the selector switch
  {value=value;}  // Output in celcius
  {value=(value*1.8)+320;} //Output in Fahrenheit
  backup=value; //Backs up the content in variable value

 for(i=0;i<100;i++) //Loops the display loop 100 times(steadies the display)
  digitalWrite(disp3, HIGH);
  value = value/10;
  a = value%10;
  int display (int a)
  switch (a)
    case 0:
    digitalWrite(segA, LOW);
    digitalWrite(segB, LOW);
    digitalWrite(segC, LOW);
    digitalWrite(segD, LOW);
    digitalWrite(segE, LOW);
    digitalWrite(segF, LOW);
    digitalWrite(segG, HIGH);

    case 1:
    digitalWrite(segA, HIGH);
    digitalWrite(segB, LOW);
    digitalWrite(segC, LOW);
    digitalWrite(segD, HIGH);
    digitalWrite(segE, HIGH);
    digitalWrite(segF, HIGH);
    digitalWrite(segG, HIGH);

    case 2:
    digitalWrite(segA, LOW);
    digitalWrite(segB, LOW);
    digitalWrite(segC, HIGH);
    digitalWrite(segD, LOW);
    digitalWrite(segE, LOW);
    digitalWrite(segF, HIGH);
    digitalWrite(segG, LOW);

Digital thermometer using arduino SchematicAbout the program.

The voltage output of the LM35 is scanned using the analogRead function. The analogRead function will read the voltage at a particular analog input pin and converts it into a digital value between 0 and 1023. If 30°C is the temperature, the LM35 output will be 300mV. The code value=digitalRead(sensor) will read this voltage, convert it into a digital value and stores it in the variable “value”. So, for 30°C the number stored in variable “value” will be 3oomV/(5/1023)=61. This number is multiplied by 5 to get 305 a decimal point is place before the last digit while displaying on the seven segment display.The result will be 30.5°C.

For more detail: Digital thermometer using arduino

Leave a Comment

= 5 + 4

(Spamcheck Enabled)

Read previous post:
Multi-pole industrial relays provide more possibilities

Switching of three-phase motors or a realization of a sophisticated installation is a breeze with industrial relays Finder. As we...

Scroll to top