What is conversion system of LM35 (temperature sensor) in Celsius for Arduino?

Submitted by erick on Sat, 07/23/2016 - 15:02

What is conversion system of LM35 (temperature sensor) in Celsius for Arduino?

for Arduinos is:

val = analogRead(tempPin);

float mv = ( val/1024.0)*5000;

float cel = mv/10;

 

Example:

//getting the voltage reading from the temperature sensor

int reading = analogRead(tempPin0);

float mv = ( reading / 1024.0) * 5000;

float cel = mv / 10;

Serial.print(cel); Serial.println(" degress C");

reading = analogRead(tempPin1);

mv = ( reading / 1024.0) * 5000;

float cel2 = mv / 10;

LM35 Arduino
Arduino Sensor Temperature LM35

https://github.com/ericklan/ArduinoFanServer/blob/master/fanserver.ino

Remember that you can use anywhere between 2.7V and 5.5V as the power supply. For this example I'm showing it with a 5V supply but note that you can use this with a 3.3v supply just as easily. No matter what supply you use, the analog voltage reading will range from about 0V (ground) to about 1.75V.
If you're using a 5V Arduino, and connecting the sensor directly into an Analog pin, you can use these formulas to turn the 10-bit analog reading into a temperature.

LM35
LM35

LM35 temperature sensor Data Sheet

This sensor is an analog sensor Texas Instruments house, which allows us to perform temperature measurements in a fairly accurately via the analog inputs of our Arduino (pins A0-A5) without using any library specified for programming.

As you can see it is a sensor having only 3 pins (VCC, GND and Data), so their connection is very simple. In addition the following features:

     It is calibrated directly in degrees Celsius.
     Measuring range -55 to 150 ° C.
     The output voltage is proportional to temperature. This means that 1 ° C equals 10mV.
     It has a guaranteed accuracy of 0.5 ° C to 25 ° C.
     It has a power range between 4 and 30V.
     It has a low output impedance.
     It has low supply current (60uA).
     No need for additional circuitry for calibration.
     It presents a fairly low cost.