Incorporating an LM35 Temperature Sensor into your Arduino project is a simple and low-cost option for temperature detection. These accurate sensors need no further hardware. When it comes to temperature sensors, all it takes is a few simple connections and some Arduino code!

LM35 Temperature sensor

LM35 is a low-voltage, high-precision centigrade temperature sensor. Because it outputs a voltage directly proportional to the temperature in degrees Celsius, it’s ideal for usage with Arduino boards.

LM35 sensors have a typical accuracy of 0.5°C in the room temperature range and 1°C over the complete range of temperatures from 55°C to +155°C. They do not require any calibration to function correctly.

During active temperature conversions, the sensor uses less than 60 mA of power and has very low self-heating (less than 0.08°C in still air).

Because the LM35 sensor requires a negative bias voltage to record negative temperature, it has only one disadvantage. The TMP36 temperature sensor is recommended if you plan to utilize the sensor to measure negative temperature. Using the Analog Devices TMP36, you can monitor temperatures between -40°C and 125°C without requiring a negative bias voltage.

The DS18B20, housed in the same packaging as the LM35, is a superior digital temperature sensor to the LM35. Since digital temperature sensors offer excellent noise immunity, they are more suited for usage in noisy environments or at a distance.

LM35 front and back views

Application of LM35 Temperature Sensor:-

  • Measurement of a particular environment’s temperature
  • Providing a circuit or component with thermal shutdown
  • Temperature measurement for HVAC use.

LM35 Working Principles (Understanding LM35 Linear Scale Factor)

Uses solid-state technology to detect temperatures. When the temperature rises, a predictable rate is observed in the voltage drop between the base and emitter (forward voltage – Vbe) of the Diode-connected transistor. Constructing an analog signal directly proportional to temperature is simple by properly magnifying this voltage change.

The fact that diode-connected transistors have a linear relationship between forwarding voltage and temperature explains why they are utilized as thermometers. This is the primary method for determining temperature, though it has seen various advancements.

The good news is that the LM35 performs all of these complicated calculations internally. A voltage that is directly related to temperature is all it does.

Features of the LM35 temperature sensor

  • Its input voltage ranges from 35 V to -2 V at their extremes. It’s usually on at 5 volts.
  • From -55°C to 150°C, it can measure the temperature of an object.
  • The output voltage of this device can be expected to raise 10mV (0.01V) for every 1°C increase in temperature.
  • It’s an inexpensive temperature sensor.
  • It’s compact, so it’s ideal for remote use.
  • It comes in various package sizes, including TO-92, TO-220, TO-CAN, and SO IC.

Pinout of the LM35 sensor.

The LM35 is available in three distinct packages, the most popular of which is the 3-pin TO-92, which resembles a transistor in shape and function.

Depending on the sensor, +Vs might range from 4 to 30 volts.

The analog voltage generated by the Vout pin is directly proportional (linear) to the measured temperature.

GND is a grounding pin, as the name suggests.

How to Connect an Arduino to an LM35 Temperature Sensor

It’s a breeze to connect the LM35 to an Arduino. Connect one of the sensor’s pins and two of the sensor’s power pins together to read the sensor value. A 5V supply can power the sensor. ‘+Vs’ and ‘GND’ link the positive and negative voltages, respectively. Connect Arduino A0‘s analog input to a sensor’s ‘Vout‘ middle pin, its analog output. It’s best to leave a temperature sensor in the open or attach it to a specific object, such as a heat sink. connection is exactly the same as a TMP36 temperature sensor.

Arduino code

The following code prints the temperature on the serial monitor.

/*
 * Created by electronicsmith.com
 *
 * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-lm35-temperature-sensor
 */

#define LM35 A0

float lm_value;
float tempc;

void setup() {
  Serial.begin(9600);
}

void loop() {
  lm_value = analogRead(LM35);
  tempc = (lm_value * 500) / 1023;
  Serial.println(tempc);//Temperature in Celcius
}

FAQ

  • How do I connect two LM35 sensors and Code for it?

Attach sensors output with A0 and A1 of Arduino.

void loop() { 
float lmvalue0 = analogRead(A0);
float tempr0 = (lmvalue0 * 500)/1023;
Serial.println(tempr0); 

float lmvalue1 = analogRead(A1);
float tempr1 = (lmvalue1 * 500)/1023;
Serial.println(tempr1); 
delay(200); }
Newsletter SignupLoving Our Content?

Subscribe to our weekly newsletter below and never miss any update that is most likely to blow your mind.