Thermometer using Arduino and LM35 Temperature Sensor. How To?

Programming, Tutorial, Coding, New Design, and/or any project for your Arduino and Raspberry Pi can post your topic /suggestion here.
User avatar
Diy
Admin
Admin
Contact:
Location: Philippines
Posts: 185
Joined: Sat Apr 23, 2016 10:32 pm

Thermometer using Arduino and LM35 Temperature Sensor. How To?

Sat Jul 21, 2018 6:01 am

Thermometers are useful apparatus being used since long time for temperature measurement. In this project we have made an Arduino based digital thermometer to display the current ambient temperature and temperature changes on a LCD unit in real time . It can be deployed in houses, offices, industries etc. to measure the temperature. This project is based on Arduino which communicates here with LM35 temperature sensor and a 16x2 display unit. We can divide this arduino based thermometer into three sections - The first senses the temperature by using temperature sensor LM 35, second section converts the temperature value into a suitable numbers in Celsius scale which is done by Arduino, and last part of system displays temperature on LCD. The same is demonstrated in below block diagram.
Arduino-Digital-Thermometer.jpg
Arduino-Digital-Thermometer.jpg (63.1 KiB) Viewed 784 times
In this Arduino LM35 temperature sensor interfacing, Arduino Uno is used to control the whole process. An LM35 temperature sensor is used for sensing environment temperature which gives 1 degree temperature on every 10mV change at its output pin. You can easily check it with voltmeter by connecting Vcc at pin 1 and Ground at pin 3 and output voltage at pin 2 of LM35 sensor. For an example if the output voltage of LM35 sensor is 250m volt, that means the temperature is around 25 degree Celsius.

Arduino reads output voltage of temperature sensor by using Analog pin A0 and performs the calculation to convert this Analog value to a digital value of current temperature. After calculations arduino sends these calculations or temperature to 16x2 LCD unit by using appropriate commands of LCD.
block diagram.PNG
block diagram.PNG (16.7 KiB) Viewed 784 times
block diagram.PNG
block diagram.PNG (16.7 KiB) Viewed 784 times
Circuit Components
Arduino

In this project we have used a microcontroller to control whole the process of system that is ARDUINO board. Actually arduino is not a mere controller as it has an operating system or boot-loader which runs on AVR controllers. Arduino is an open source hardware platform and very useful for project development purpose. There are many types of arduino boards like Arduino UNO, arduino mega, arduino pro mini, Lilypad etc. are available in the market or you can also build one by yourself.

LM35 Temperature Sensor

LM35 is a 3 pin temperature sensor which gives 1 degree Celsius on every 10mVolt change. This sensor can sense up to 150 degree Celsius temperature. 1 number pin of lm35 sensor is Vcc, second is output and third one is Ground.
LM35.jpg
LM35.jpg (8.34 KiB) Viewed 784 times
Pin1: Supply voltage; 5V (+35V to -2V) Vcc

Pin2: Output voltage (+6V to -1V) Output

Pin3: Ground (0V) Ground

LCD

16x2 LCD unit is widely using in embedded system projects because it is cheap, easily available, small in size and easy to interface. 16x2 have two rows and 16 columns, which means it consist 16 blocks of 5x8 dots. 16 pin for connections in which 8 data bits D0-D7 and 3 control bits namely RS, RW and EN. Rest of pins are used for supply, brightness control and for backlight.

Power Supply


Arduino Board already have an inbuilt power supply section. Here we only need to connect a 9 volt or 12 volt adaptors with the board.

Circuit Diagram and Explanation
Arduino-Thermometer-Circuit-using-lm35.png
Arduino-Thermometer-Circuit-using-lm35.png (88.65 KiB) Viewed 784 times
Circuit diagram for digital thermometer using Arduino LM35 temperature sensor, is shown in the above figure. Make the connections carefully as shown in the schematic. Here 16x2 LCD unit is directly connected to arduino in 4-bit mode. Data pins of LCD namely RS, EN, D4, D5, D6, D7 are connected to arduino digital pin number 7, 6, 5, 4, 3, 2. A temperature sensor LM35 is also connected to Analog pin A0 of arduino, which generates 1 degree Celsius temperature on every 10mV output change at its output pin.

After getting analog value at analog pin we reads that value using Analog read function and stores that value in a variable. And then by applying given formula converts it in temperature.

float analog_value=analogRead(analog_pin);

float Temperature=analog_value*factor*100

where

factor=5/1023

analog_value= output of temperature sensor
code-s2.gif
code-s2.gif (1.18 KiB) Viewed 784 times
Here degree symbol is created using custom character method
code-s3.gif
code-s3.gif (969 Bytes) Viewed 784 times
Code

Code: Select all

/*-----------Arduino LM35 Code-------------*/

/*-----------Digital Thermometer Using Arduino-------------*/

#include<LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);

#define sensor A0

byte degree[8] = 
              {
                0b00011,
                0b00011,
                0b00000,
                0b00000,
                0b00000,
                0b00000,
                0b00000,
                0b00000
              };

void setup()
{
  lcd.begin(16,2);
  lcd.createChar(1, degree);
  lcd.setCursor(0,0);
  lcd.print("    Digital    ");
  lcd.setCursor(0,1);
  lcd.print("  Thermometer   ");
  delay(4000);
  lcd.clear();
  lcd.print(" Circuit Digest  ");
  delay(4000);
  lcd.clear();
}

void loop()
{
  /*---------Temperature-------*/
     float reading=analogRead(sensor);
     float temperature=reading*(5.0/1023.0)*100;
     delay(10);
  
  /*------Display Result------*/
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temperature");
    lcd.setCursor(4,1);
    lcd.print(temperature);
    lcd.write(1);
    lcd.print("C");
    delay(1000);
}


Return to “ARDUINO AND RASPBERRY PI”

Links

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests
Registered users: No registered users
Most users ever online was 156 on Sun Jun 17, 2018 7:42 am
Total posts 439
Total topics 318
Total members 62
Our newest member anonymous-kali
No birthdays today