• shrey mittal

Interfacing Temperature Sensor with Arduino

Updated: Sep 18, 2020

On a sunny hot day, you all might have thought what's the temperature and might have checked on the phone. But did you ever thought that is it actually correct or not?. I also check the temperature every day but it feels like fake and I don't believe the weather forecast since what they say never happens.

So why don't we make your thermometer to check the real-time temperature at your location? Let's make a temperature device using #Arduino and #temperature sensor LM35. it comes in three edition- LM35A, LM35C, LM35D. The main difference is the temperature range-

  • LM35A has the widest range of -55 degrees Celcius to 155-degree Celcius.

  • LM35C has a lesser range of -40 degrees Celcius to 110-degree Celcius.

  • LM35D has the shortest range of 0 degrees Celsius to 100 degrees Celsius.

Hardware required:

  • Arduino board: Any Arduino board will work either in be UNO or MEGA or NANO or any other. Since all have the same functionality. We used an Arduino UNO.

  • LM35: It's a temperature sensor, you can choose any variant depending on your use.

  • A Breadboard: A breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes let you easily insert electronic components to prototype to an electronic circuit since they are internally connected as rows and columns.

  • Jumper wire: A jumper wire is an electrical wire, or group of them in a cable, with a connector or pins at each end used to connect component, sensors, etc to a breadboard they are of three types male to female, female to female, and male to male.here we need male to male jumper wires.

Circuit :

You just have to connect LM35 to an Arduino board in this simple way: -

  1. The supply voltage is the voltage through which we supply the current and need to be connected to 5V on the Arduino board and power the temperature sensor LM35.

  2. The output voltage is the analog pin connect to A1 through which we receive data or in this case temperature from the sensor.

  3. The last pin is the ground pin that needed to be connected to GND on the Arduino board.


Firstly, we will assign a variable or constant to the pin in which we connected the output voltage pin.

constant tempPin = A1;    //here we connected LM35 to Arduino 
float temp; //variable to store the temperature from the sensor

In void setup(), we assign the Serial.begin(9600); to set the default baud speed. It is to tell the Arduino to get ready to exchange messages with Serial monitors at a speed of 9600 bits per second.

TXT • 358B

In the void loop(), read the data from the sensor using analogRead is called the ADC value. It can be converted into Celsius temperature by multiplying it with 0.48828125. Then we can easily print the temperature in Celcius using Serial.print.

float temp;
int tempPin = A1;

void setup()

void loop()
  temp = analogRead(tempPin);// reading the temperature from sensor
  temp = temp * 0.48828125;//converting ADC value to digital value
  Serial.print("TEMPRATURE = ");
  delay(1000);// delay for 1 second


Now, connect all the circuits to Arduino and connect your system to the Arduino. Upload the code and finally open your serial monitor window in the Arduino IDE. The serial monitor is found in the toolbar. Soon, you will see the #temperature popping up after each second.

Learn Electronics. (Jul 8, 2020) . "Interfacing Temperature Sensor(LM35) with Arduino". https://www.youtube.com/watch?v=jeCKOQJR7Mo.

You can also add a #LED screen to it and then, print the temperature on that and connect your Arduino to the battery and you will not need your system. It will be more portable. You can try more things with it that you want like transferring the data through #Bluetooth and wifi or making a dataset.

If you don't understand the code refer to:

Arduino reference.


  1. Controlling LED using Blynk App - IoT Project

  2. Smart Lighting System - Arduino - Controlling an LED & Buzzer using LDR Sensor

  3. Smart Lighting System