Arduino LM35 Thermometer

Source: Internet
Author: User

Use the Arduino to read the value of the LM35 temperature sensor to calculate the current temperature displayed on the LCD:

About the display of the control LCD the http://www.cnblogs.com/Zhang-Shangyu/p/5249206.html has been introduced in the previous article, here is a description of the LM35 temperature sensor

LM35 chip Real-picture

  

From http://www.arduino.cn/thread-1055-1-1.html

  

Hardware connection:

LCD Connection method Previous article http://www.cnblogs.com/Zhang-Shangyu/p/5249206.html

LM35 connection: VCC pin 5v,gnd foot panel bag gnd,vout pin connect Arduino analog signal foot A0

Do not connect the LM35 VCC foot and GND pin in the operation, from the flat side of the chip, the leftmost foot is VCC and the rightmost foot is GND.

    

Software code:

    

#include <LiquidCrystal.h>intTmp=0;//Analog Foot A0intdata;intCelsius; Liquidcrystal LCD (12,11,5,4,3,2);//LCD Construction FunctionvoidSetup () {Lcd.begin (16,2); Lcd.print ("The temperature"); Lcd.setcursor (3,1); Lcd.print ("Is"); }voidLoop () {Lcd.setcursor (6,1); Data= Analogread (TMP);//get the value of the temperature sensorCelsius= (125*data) >>8;//formula for calculating temperatureLcd.print (Celsius); Lcd.print ((Char) 223); Lcd.print (C); Delay (2000);//refresh after two seconds}

Run:

It seems to be a success, but the temperature show will have a 1-2-degree jump change.

  

Arduino LM35 Thermometer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.