Want to measure temperature in your next Arduino project? The LM35 temperature sensor is one of the simplest and most affordable ways to add temperature sensing to your projects. What makes the LM35 especially beginner-friendly is that it’s fairly accurate, easy to use, and doesn’t need any extra components to function.
In this tutorial, you’ll learn how to connect the LM35 to your Arduino, understand how it works, and explore three practical examples—from reading values on the Serial Monitor to building a standalone digital thermometer with an LCD display. With just a few wires and a small piece of code, you can start measuring temperature right away!
Let’s get started!
LM35 Temperature Sensor
The LM35 is a low-voltage, high-precision temperature sensor from Texas Instruments. It outputs an analog voltage that is linearly proportional to temperature in degrees Celsius. Specifically, the output increases by 10 mV for every 1°C rise in temperature.

The LM35 operates on a power supply ranging from 4 to 30 volts and consumes less than 60 µA of current. This extremely low power consumption means it barely heats itself up while running (less than 0.08°C in still air). This low self-heating is important because if the sensor got too hot on its own, it would mess up the temperature readings and reduce accuracy.
Speaking of accuracy, the LM35 is impressively accurate. It offers a typical accuracy of ±0.5°C at room temperature (25°C) and ±1°C across its full operating range of -55°C to 150°C.
Here are the complete specifications:
| Power supply | 4V to 30V |
| Current draw | 60µA |
| Temperature range | −55°C to +155°C |
| Accuracy | ±0.5°C |
| Output scale factor | 10mV/°C |
| Output at 25°C | 250mV |
For more information, please refer below datasheet.
However, there is one downside: if you want to measure negative temperatures, the LM35 requires a negative bias voltage, which makes your circuit more complicated. If you need to measure negative temperatures but want to keep things simple, the TMP36 sensor from Analog Devices might be a better choice. It can handle temperatures from −40°C to +125°C without any special setup. If you’re interested in learning about the TMP36, you can find a dedicated tutorial here.
Working Principle of the LM35
The LM35 is a type of Silicon Bandgap Temperature Sensor. It works based on the fact that the forward voltage of a silicon diode changes in a predictable way when the temperature changes.
Rather than using a simple diode, the LM35 uses a diode-connected transistor, which is essentially a transistor wired to act like a diode but with better performance.
Here’s the functional block diagram of the LM35:

This component has a special property: as the temperature increases, the voltage between the transistor’s base and emitter (V_BE) decreases. This relationship is fairly linear—meaning the voltage drops at a steady rate as the temperature rises.
The graph below illustrates how temperature changes affect the current flowing through a transistor.

The LM35 sensor detects these tiny voltage changes, processes them, and produces an output signal that is linearly proportional to the temperature. If you’re curious and want to explore this topic further, a great resource is Diode-Based Temperature Measurement Techniques by Texas Instruments.
LM35 Sensor Pinout
The LM35 is available in different forms, but the most common one is the TO-92 package, which looks like a transistor with three pins. Here’s what each pin does:

+Vs is the power supply pin. You can connect it to any voltage between 4V and 30V.
Vout outputs an analog voltage that is lineary proportional to the temperature. You connect it to an analog input pin on the Arduino, such as A0.
GND is the ground pin.
Connecting the LM35 Temperature Sensor to an Arduino
Connecting the LM35 to an Arduino is super simple. You only need to connect three wires: two for power and one for the signal.
Start by connecting the +Vs pin of the LM35 to the 5V pin on the Arduino. Next, connect the GND pin to any of the Arduino’s GND pins. Finally, connect the Vout pin to A0 (or any other analog input pin) on the Arduino.
Here’s a quick reference table for the pin connections:
| LM35 | Arduino | |
| +Vs | 5V | |
| GND | GND | |
| Vout | A0 |
Here’s how to wire up the LM35:

Once it’s connected, you can use it to measure the temperature of the air, or you can place the sensor on something solid (like a metal heat sink) to measure its surface temperature. Just make sure the sensor is touching or exposed to whatever you’re trying to measure.
How to Read the LM35 Temperature Sensor
Once you connect power to the LM35, the Vout pin immediately begins sending out an analog voltage signal. This voltage changes in proportion (linear) to the temperature. Specifically, for every 1°C increase in temperature, the voltage goes up by 10 millivolts (mV), or 0.01 volts (V). For example, at 0°C, the sensor outputs 0V; at 25°C, it outputs 0.25V; and at 100°C, it gives 1.00V.
You can see this relationship clearly on the voltage vs. temperature graph below.

To read this analog voltage using an Arduino, you use the analogRead() function in your code. However, this function doesn’t give you the actual voltage directly. Instead, it gives you a number that represents the voltage.
The Arduino has a 10-bit Analog-to-Digital Converter (ADC). It maps input voltages between 0 and the ADC reference voltage into integer values between 0 and 1023. That’s a total of 1024 different possible values.

So to convert the number you get from analogRead() back into the actual voltage, you use this formula:
Vout = (analogRead value) × (ADC reference voltage / 1024)
The ADC reference voltage depends on the type of Arduino board you’re using. By default, it is 5 volts (on 5 VDC Arduino boards) or 3.3 volts (on 3.3 VDC Arduino boards).
So the formulas become:
- For 5-volt Arduino boards (like the popular Arduino UNO):Vout = (analogRead value) × (5 / 1024)
- For 3.3-volt Arduino boards (like the Arduino Pro Mini):Vout = (analogRead value) × (3.3 / 1024)
Once you have the actual voltage, converting it to temperature is easy. Remember, the LM35 produces 10 mV (or 0.01 V) for every degree Celsius.
This means to calculate the temperature, you divide the voltage by 0.01:
Temperature (°C) = Vout / 0.01
or, even simpler:
Temperature (°C) = Vout × 100
Let’s work through a real example. Suppose you’re using an Arduino UNO (which is a 5-volt board), and your analogRead() function returns the value 100. Here’s how you’d find the temperature:
- First, calculate the voltage: Vout = 100 × (5 / 1024) = 0.488 V
- Now convert that voltage to temperature: Temperature = 0.488 × 100 = 48.8°C
So, the temperature is about 48.8 degrees Celsius.
Arduino Example 1 – Reading Temperature with LM35
In this example, we’re going to read temperature data from the LM35 sensor and display the results in both degrees Celsius (°C) and degrees Fahrenheit (°F) on the Serial Monitor.
// Define the analog pin, the LM35's Vout pin is connected to
#define sensorPin A0
void setup() {
// Begin serial communication at 9600 baud rate
Serial.begin(9600);
}
void loop() {
// Get the voltage reading from the LM35
int reading = analogRead(sensorPin);
// Convert that reading into voltage
// Replace 5.0 with 3.3, if you are using a 3.3V Arduino
float voltage = reading * (5.0 / 1024.0);
// Convert the voltage into the temperature in Celsius
float temperatureC = voltage * 100;
// Print the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.print("°C | ");
// Print the temperature in Fahrenheit
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureF);
Serial.println("°F");
delay(1000); // wait a second between readings
}Once the sketch is running, try placing your finger on the sensor or blowing gently across it. You should see the temperature rise slightly.

Code Explanation
First, we tell the Arduino which analog pin is connected to the LM35—in this case, analog pin 0.
#define sensorPin A0In the setup() section, we initialize serial communication.
void setup() {
Serial.begin(9600);
}In the loop() section, we read the voltage coming from the LM35 sensor using the analogRead() function.
int reading = analogRead(sensorPin);Next, we use the formulas discussed earlier to convert the analog reading into voltage, and then into temperature.
float voltage = reading * (5.0 / 1024.0);
float temperatureC = voltage * 100;After calculating the temperature in Celsius, we print it to the Serial Monitor.
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.print("°C | ");We also want to see the temperature in Fahrenheit, so we convert the Celsius value to Fahrenheit and print that to the Serial Monitor as well.
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureF);
Serial.println("°F");Arduino Example 2 – Improving the Accuracy
The LM35 sensor normally gives a pretty good temperature reading with an accuracy of about ±0.5°C at 25°C. While we can’t improve the sensor’s internal accuracy, we can improve how accurately the Arduino reads the sensor’s output.
Here’s the issue: the output voltage from the LM35 goes from 0V to 1V, which represents temperatures from 0°C to 100°C. However, the Arduino Uno’s analog-to-digital converter (ADC) works with a default range of 0V to 5V, and it breaks this range into 1024 steps. This means only about 205 of those steps fall within the LM35’s range (0V to 1V), giving you a resolution of about 4.9 millivolts per step, which is roughly equal to 0.5°C per step. That’s okay, but not ideal—especially since it matches the sensor’s error margin, meaning any measurement noise makes the reading jumpy.

Now here’s another problem: the Arduino’s ADC uses the board’s supply voltage as the reference voltage. If the Arduino is powered through USB, the voltage can vary slightly and may not be exactly 5V, which makes your temperature readings even less accurate.
Fortunately, the Arduino Uno has a built-in solution. It provides an internal reference voltage of 1.1V that doesn’t depend on the supply voltage. By using this more stable voltage reference, we can make the readings more precise. To activate this, we include the command analogReference(INTERNAL); in the setup section of the code.
Once this internal reference is turned on, the Arduino’s ADC now works in a smaller voltage range, from 0V to 1.1V instead of 0V to 5V. This means that the same 1024 steps are now spread over a much narrower range, giving a finer resolution. Now each step equals about 1.07 millivolts, which means the resolution improves to around 0.1°C per step. This makes your readings much more stable and reliable.

Here is the updated code:
// Define the analog pin, the LM35's Vout pin is connected to
#define sensorPin A0
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Use 1.1 V reference for ADC measurements
analogReference(INTERNAL);
}
void loop() {
// Get the voltage reading from the LM35
int reading = analogRead(sensorPin);
// Convert that reading into voltage
float voltage = reading * 1.1 / 1024.0;
// Convert the voltage into the temperature in Celsius
float temperatureC = voltage * 100;
// Print the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.print("°C | ");
// Print the temperature in Fahrenheit
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureF);
Serial.println("°F");
delay(1000); // wait a second between readings
}Once you’ve uploaded the sketch to your Arduino, try running this version and compare it to the earlier example. You’ll likely notice that in the first example, the temperature may have shifted by nearly 1°C between readings, while this version provides a much steadier and more consistent result.

Code explanation
This sketch is similar to the previous one. However, there are two important differences.
First, in the setup section of the code, we use the analogReference(INTERNAL) function to change the reference voltage for the Arduino’s analog readings. Instead of using the default 5 volts, we’re now telling the Arduino to use its internal 1.1-volt reference.
analogReference(INTERNAL);Second, because we changed the reference voltage from 5V to 1.1V, we also need to adjust the formula that converts the analog reading into a voltage. So instead of multiplying by 5, we now multiply by 1.1, like this:
float voltage = reading * 1.1 / 1024.0;Arduino Example 3 – Standalone Thermometer with LM35 and an I2C LCD
Sometimes, you may want to display temperature readings in real time without using a computer. For example, if you’re building a small thermometer or a temperature monitoring system that shows an alert when the temperature goes out of a safe range, using the Serial Monitor won’t be very useful. In that case, a 16×2 character LCD is a great solution.
In this example, we’ll connect an I2C LCD display to the Arduino along with the LM35 temperature sensor. The I2C version of the LCD is very convenient because it uses only two wires for communication with the Arduino, making the wiring much simpler.
If you haven’t worked with I2C LCDs before, it’s a good idea to skim through the quick tutorial below.
Wiring
This diagram shows you exactly how to connect everything:

Arduino Code
The sketch below reads the temperature from the LM35 and then displays the temperature directly on the LCD screen. The code is almost the same as in the previous example, except this time, instead of printing to the Serial Monitor, we’re sending the temperature values to the I2C LCD so you can see them in real time without needing a computer.
// Include the LiquidCrystal_I2C library
#include <LiquidCrystal_I2C.h>
// Create a new instance of the LiquidCrystal_I2C class
LiquidCrystal_I2C lcd(0x3F, 16, 2);
// Define a custom degree character
byte Degree[] = {
B00111,
B00101,
B00111,
B00000,
B00000,
B00000,
B00000,
B00000
};
// Define the analog pin, the LM35's Vout pin is connected to
#define sensorPin A0
void setup() {
// Use 1.1 V reference for ADC measurements
analogReference(INTERNAL);
// Start the LCD and turn on the backlight
lcd.init();
lcd.backlight();
// Create a custom character
lcd.createChar(0, Degree);
}
void loop() {
// Get the voltage reading from the LM35
int reading = analogRead(sensorPin);
// Convert that reading into voltage
float voltage = reading * 1.1 / 1024.0;
// Convert the voltage into the temperature in Celsius
float temperatureC = voltage * 100;
// Print the temperature on the LCD;
lcd.setCursor(0, 0);
lcd.print("Temperature:");
lcd.setCursor(0, 1);
lcd.print(temperatureC, 1);
lcd.write(0); // print the custom degree character
lcd.print("C ");
// Print the temperature in Fahrenheit
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
lcd.print(temperatureF, 1);
lcd.write(0); // print the custom degree character
lcd.print("F ");
delay(1000); // wait a second between readings
}When the sketch is running, the LCD will show the current temperature:


