LM35 temperature sensor

From SainSmart Wiki
Jump to: navigation, search

LM35 temperature sensor

Temperature sensor

What’s temperature sensor?

The temperature sensor is that use substances of various physical properties with temperature variation of the sensor and let the temperature converted to electricity. These regularly change the physical properties of the main body temperature sensor is a core part of the temperature measuring instruments, and a wide variety. In accordance with the measurement method is divided into contact and non-contact two major categories, In accordance with the characteristics of sensor materials and electronic components into the thermal resistance and thermocouple. Used in this experiment is the LM35 temperature sensor.

QQ图片20130716182633.jpg

Working principle

LM35 temperature sensor output voltage linear relationship between the Celsius temperature scale,0 ℃, output is 0V, for every 1℃increases in output voltage of 10mV.

QQ图片20130716182649.jpg

LM35 pin diagram is as follows

QQ图片20130716182703.jpg

Out can be seen from experimental cartridge of the temperature sensor, temperature sensor side is flat, and the other side is semicircular. Flat face of our own, the leftmost VCC pin (connected to +5 v), the middle of the GND pin VOUT (voltage value output pin, then the analog pins on the board), and the rightmost pin (connected board GND). Three pins, respectively, then you can use.

Temperature alarm experiment

Experiment component

  • LM35 temperature sensor module*1
  • Breadboard & jumper wire few

Connection

First ready experimental board; Follow the LM35 temperature sensor connection connected to VOUT is connected to an analog 0. Such temperature alarm experimental circuit connected.

Experimental principle

LM35 temperature sensor works shows that the temperature is increased by 1 ° C vout the mouth output voltage increases 10MV. According to this principle procedures in real time reading out the analog voltage value of 0, since the analog port reads out a voltage value of 0 to 1023, i.e. 0V corresponding 0,5 V corresponds to 1023. Application, we only need to LM35 module, analog interface, the read analog value is converted to the actual temperature.

Example code

int potPin = 0 ;//define pin0 connect with LM35 void setup() {

 Serial.begin(9600);

} void loop() {

 int val;
 int dat;
 val = analogRead(potPin);
   dat = (125*val)>>8 ; // Temperature calculation formula
   Serial.print("Tep : ") ; //print “Tep” means temperature
 Serial.print(dat) ; // print the value of dat 
 Serial.println("C"); //print “C” means degree
 delay(500);//delay 0.5s

}

Program function Download the program to the experimental board, open the monitor, you can see the current ambient temperature. (In fact, the temperature value a little deviation, according to the ambient temperature modify the program so that it is completely consistent with their own environment.)

QQ图片20130716182724.jpg