# How to use LM35 Temperature Sensor with Arduino

Welcome, Everyone
Here is the first Tutorial in the series of Learn by Doing.Learn Arduino by Doing projects.There is a long list of 100+ amazing Arduino projects.So we are going to start with some basic concepts.There are almost 10 first tutorials on Sensors then we will move towards doing amazing and cool projects.
In all these tutorials we will understand each and every component, circuit diagrams and complete Arduino codes.Stay connected on YouTube and follow for step by step Guide and source codes.

### Contents:

1. Introduction to LM35 Temperature Sensor
2. Components List
3. LM35 with Arduino Circuit Diagram
4. Arduino Code

### 1-Introduction to LM35 Temperature sensor:

Lm35 is a Temperature Sensor that works with the variations in temperature.The internal structure of Lm35 consists of transistors, amplifier, and few resistors.The integrated circuit and the resistors are calibrated in the factory to produce the accurate temperature.

The Lm35 has 3 pins:

• Input
• Output
• Ground
The output of Lm35 is in volts.EveryÂ 10 mv changeÂ is equal toÂ 1 degree Celsius.
The Exact Equation to convert voltage into degree Celsius is:

( THE SUPPLY_VOLTAGE x 1000 / 1024) / 10 where Â THE SUPPLY_VOLTAGE is 5.0Volts )
Â
1000 is used for changing the unit from Volts to mV
10 is constant and Each 10 mV is directly proportional to 1 degree Celcius.
5 is the supply voltage.

The final Equation is: [(5.0 * 1000 / 1024) / 10 Â ] = 0.4882

### 2-Components List:

1. Arduino Board with USB Cable
2. LM35 Temperature sensor
4. Arduino jumper wires

### 3-LM35 Temperature Sensor with Arduino Circuit diagram:

1. Connect first pin with 5v on Arduino
2. Second with analog pin of Arduino A0
3. Third with GND on Arduino

### 4-Arduino Code:

float temp; Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â //Defining the temp float variable
int sensor = 0; Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  // The output pin of LM35 on arduino analog pin 0 it could be A0
void setup()
{Serial.begin(9600); Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â //start the serial monitor
}
void loop(){
temp = analogRead(sensor); Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  //assigning the analog output to temp
float mv = ( temp/1024.0)*5000; Â  Â  Â  Â  Â  Â  // Converting equation for voltage to Celsius
float celsius = mv/10;
Serial.print(“The temperature is :”); Â  Â  Â  //Display the results on serial monitor
Serial.print(celsius);
Serial.println(“deg. Celsius”);
Serial.println();
delay(1000); Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â //1 second delay to avoid overloop
}

### Conclusion:

There will be more on Lm35.How to display Temperature on LCD and Weather displaying box Arduino Project.Stay connected and subscribe on YouTube for video Tutorials.
Learn by Doing.
Stay motivated and Stay Happy.

#### Mak

Mechatronics Engineer-Solution Architect-Entrepreneur-
Crazy about traveling and writing-Being average isn't a choice Never be the same ever-Be simple and Be happy..!!!

#### 1 Comment

• Amy says:

Hello, why I get 500 deg.celcius in temperature room? I set up the components and the coding same as the tutorial above. I just change the serial.begin(115200) since the serial.begin(9600) do not allow to open the serial monitor. Does it effect? Please help me. Thanks.

Arduino