## How to Interface Temperature Sensor(LM35) with Arduino UNO         June, 2021

## INTRODUCTION

In this tutorial, we are going to learn how to interface a Temperature sensor (LM35) to an Arduino UNO. And we will learn how to measure temperature.

## THEORY

The LM35 series are precision integrated-circuit temperature devices with an output voltage linearly proportional to the Centigrade temperature.

It having an Ensured Accuracy of 0.5°C (at 25°C).

It has a range from l −55°C to 150°C.

Its operating voltage is from 4 V to 30 V. Basically, it has 3 pins

1. VCC
2. Aout
3. Ground(GND) ## REQUIREMENTS

 Parts Quantity Arduino UNO 1 A-B cable 1 LM35 Sensor 1 Bread Board 1 Connecting Wires As per required

## CIRCUIT DIAGRAM  ## CODE

For programming this concept we need to understand some basic syntax of Arduino IDE.

The first thing is we need to install Arduino. After that, we need to know about How to use Serial Monitor in Arduino IDE.

Then let us go towards the void setup function. In this, we only going to initialize the serial monitor.

``````void setup()
{

Serial.begin(9600);

}``````

Then let us start the sensor in the void loop function.

In digital sensors, we used the digitalRead function, but here we used the analogRead function to read the sensor data.

For calculating the temperature value we used a formula. i.e, temp = (Analog value* Input voltage) * 100.0) / 1024.

Here we have taken Input voltage as 5V and 1024bit.

``````void loop()
{

int X,Temp;  // X and TEMP variable we taken as integer
Serial.println(X);  // Print in serial monitor
Temp=X*0.0.48828125; // (A0*5*100)/1024

}``````

FINAL CODE

``````void setup()
{

Serial.begin(9600);

}

void loop()
{

int X,Temp;
Serial.println(X);
Temp=X*0.48828125;
Serial.println(Temp);

}``````