Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

Measuring Room temperature using LM35 Temperature Sensor with Arduino

By EG Projects

Measuring Temperature of a place through Arduino is very easy by using any of the commercial temperature sensor available in the market. I am going to measure the temperature using low cost and efficient lm35 analog output temperature sensor with arduino. For this tutorial we need an arduino board(Uno, Maga, Lenardo etc) and Lm35 temperature sensor. Lm35 is the oldest analog output temperature sensor still serving and available in the market. Some other old analog temperature sensors like TMP36 is also available in market but they are not popular among students, hobbyist and diy electronics project makers. I prepared a nice tutorial on Lm35 pin out its internal structure and working. I also derived temperature measuring formula for lm35 temperature sensor. I suggest you to take that tutorial if you are new and don’t know much about the lm35 temperature sensor. It will help you in understanding the code below.

  • Lm35 Pin out, working, temperature measuring formula and internal structure.
16x2 lcd displaying lm35 temperature value with arduino uno

16×2 lcd displaying lm35 temperature value with arduino uno

Lm35 Temperature sensor working

LM-35  Measuring room TemperatureLM-35 Measuring room Temperature

​Lm35 output voltage is proportional to centigrade/Celsius temperature. Lm35 Celsius/centigrade resolution is 10 mills volt. 10 mills volt represent one degree centigrade/Celsius. So if Lm35 outputs 100 mills volts the equivalent temperature in centigrade/Celsius will be 100/10 = 10 centigrade/Celsius. Lm35 can measure from -50 degree centigrade/Celsius up to 150 degree centigrade/Celsius. 

​Arduino analog pin is used to read the analog output signals from the sensor. The circuit diagram of the project is given below. To Pin#1 of Lm35 apply 5v, make Pin#2 ground, and the third one the middle pin is output pin. It gives a voltage signal that is actually the temperature of the particular place. 
​
Note:  LM35 is an absolute temperature sensor. It can only measure the temperature of the surroundings with in the circle of between 100 to 500 feet . So if you are using internet and you are matching your temperature reading from the one that is given for your city on a weather forecast site than your reading will not be same like theirs. It will be near but not the same.


Lm35 temperature sensor voltage to temperature conversion

Now one of the most difficult thing is how to convert the voltage generated/output by the lm35 sensor at output in Celsius or Fahrenheit scales. Well this needs you to first go through the data sheet of temperature sensor and know about the characteristics of the sensor. 

Main crux from data sheet: LM35 Output temperature in Celsius form. It Increments the output by 1 on every 10 mV change in temperature. 

  • when the sensor outputs 500 mv voltage, the temperature in Celsius is 50 degree Centigrade.
  • For 400 mv output temperature in Celsius is 40 degree centigrade.
  • For 600 mv temperature is 60 degree Celsius.

Now we now the resolution of Lm35 and its characteristics lets derive the formula to convert the output raw voltage by Lm35 in to centigrade/Celsius temperature. ​

Lm35 voltage conversion to temperature formula/equation derivation for Arduino 

  • Arduino analog pins can measure up-to +5 volts OR the voltage on which it is working normally +5 volts.  
  • ​Arduino analog pin resolution is 1023 starting from 0. On +5 volts input it counts to 1023.
  • Lm35 max voltage output is 1500mV( At 150 degree centigrade). 1500mV is equal to 1500/1000 = 1.5 volts. So Lm35 at max outputs 1.5 voltage.
  • Arduino analog pin count for 1.5 volts equals to (1.5 / 5)*1023 = 307.5 . At +5 volts its 1023 and at 1.5 volts its 307.5.
  • New Arduino-Lm35 Resolution = 307.5 / 150 = 2.048 . Now if arduino analog pin counts 2.048 its equal to 1 degree change in centigrade/Celsius temperature of LM35.

The same above formula/equation is in the code and its working perfectly.

LM35 with Arduino - Measuring Room Temperature

LM35 with Arduino – Measuring Room Temperature

Arduino uno measuring temperature using Lm35 temperature sensor – Circuit diagram

The circuit diagram of the project is simple. Analog pin A0 of the arduino uno is used as input pin. Connect LM35 analog output pin to it. Apply +5 volts to Vcc pin of LM35 and ground the Gnd pin. In the loop function i am continuously measuring the temperature, and then i am printing the temperature on a 16×2 character lcd. I also converted the Celsius temperature in Fahrenheit with the formula that i think all of you are familiar with (temperature C ) * 9.0 / 5.0) + 32.0, then again i print the Temperature in Fahrenheit on 16×2 lcd. 16×2 lcd is interfaced in 4-bit mode with arduino. You can see the circuit diagram of the project below.

Note: For temperatures measurement i used the float data types to accurately measure the temperature in decimal form.                                                       

Lm35 temperature sensor 16x2 lcd with arduino uno - Measuring Temperature

Lm35 temperature sensor 16×2 lcd with arduino uno – Measuring Temperature

On first row of 16×2 lcd temperature in centigrade or Celsius scale is displayed and on second row of 16×2 lcd temperature in Fahrenheit scale is displayed. Temperature reading is updated after every 0.8 seconds. 
 
More projects on interfaicning Lm35 temperature sensor with various other mirocontrollers. Each project code is open source. One can use and modify it according to his needs.

Lm35 With 89c51 Microcontroller Measuring Temperature

Lm35 WiFi temperature monitoring using Nodemcu

​Measuring Room Temperature with Arduino Code
Watch the Project Video Here!!!!
Sorry for the bad quality of the video


Filed Under: Arduino, Microcontroller Projects

 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Adjustable 0 to 30V 2A DC Power Supply Circuit (Part 1/13)
  • Adjustable +/- 1.25V to +/-22V 1A Power Supply Circuit (Part 2/13)
  • Adjustable 0 to 15V 1A Mini Power Supply (Part 3/13)
  • Constant 12V Power Supply for LED Circuits (Part 4/13)
  • Constant +/-9V DC Symmetrical Power Supply Circuit (Part 5/13)
  • Making a Circuit Breaker (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

“ee

“ee

“ee

“ee

“ee

“ee

Recent Articles

  • STMicroelectronics and MACOM announce successful RF GaN-on-Si prototypes
  • Infineon expands its CoolSiC portfolio
  • STMicroelectronics and AWS collaborate for secure IoT connections
  • Pet feeding system using WhatsApp (protocol bridging with MQTT)
  • STMicroelectronics launches new MDmesh MOSFETs

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd ldr led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics Research robot samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • P-Channel MOSFET always on
  • Space Vector PWM Help Needed
  • DIY test leads - source for lead ends?
  • hardcore floquet bloch scattering problem help
  • Limiting variable DC power source

RSS Electro-Tech-Online.com Discussions

  • 24v dc relays not de-energising
  • How do I test amplifier speaker output polarity?
  • How to get lots of PCBs made cheap?
  • XOR Gate Circuit From Diodes
  • 3.3V microcontroller vs 5V relay
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering