LM35 Temperature Sensor: The Ultimate Guide

Posted by

Introduction to LM35 Temperature Sensor

The LM35 is a precision integrated-circuit temperature sensor, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. It is a popular choice for measuring temperature in various applications due to its high accuracy, low self-heating, and easy interfacing with microcontrollers or other electronic circuits.

Key Features of LM35

  • Calibrated directly in Celsius (Centigrade)
  • Linear +10.0 mV/°C scale factor
  • 0.5°C accuracy guaranteeable (at +25°C)
  • Rated for full -55° to +150°C range
  • Suitable for remote applications
  • Low cost due to wafer-level trimming
  • Operates from 4 to 30 volts
  • Less than 60 μA current drain
  • Low self-heating, 0.08°C in still air
  • Nonlinearity only ±1⁄4°C typical
  • Low impedance output, 0.1 Ω for 1 mA load

How LM35 Temperature Sensor Works

The LM35 temperature sensor is based on the principle that the forward voltage of a silicon diode is temperature-dependent. The sensor consists of a precision, temperature-compensated, integrated circuit with three terminals: +Vs, Vout, and GND.

The LM35 is designed to provide a linear output voltage proportional to the Celsius temperature. It has a sensitivity of 10 mV/°C, meaning that for every degree Celsius change in temperature, the output voltage changes by 10 mV. The relationship between the output voltage and temperature can be expressed as:

Vout = 10 mV/°C × T

where Vout is the output voltage in millivolts (mV) and T is the temperature in degrees Celsius (°C).

For example, at 25°C, the LM35 will output a voltage of 250 mV (10 mV/°C × 25°C). Similarly, at 0°C, the output voltage will be 0 mV, and at 100°C, it will be 1000 mV (1 V).

LM35 Temperature Sensor Pinout and Connections

The LM35 temperature sensor comes in various packages, such as TO-92, TO-220, and SO-8. The most common package is the TO-92, which has three pins:

  1. +Vs: Positive supply voltage (4 to 30 V)
  2. Vout: Output voltage (proportional to temperature)
  3. GND: Ground

To use the LM35 temperature sensor, follow these steps:

  1. Connect the +Vs pin to a power supply (4 to 30 V).
  2. Connect the GND pin to the ground of the power supply.
  3. Connect the Vout pin to an analog input pin of a microcontroller or an ADC (Analog-to-Digital Converter).

Here’s a simple connection diagram for the LM35 temperature sensor:

         +Vs
          |
          |
       ┌──┴──┐
  ┌───┤1    3├───┐
  │    └──┬──┘   │
  │       │      │
  │     LM35     │
  │              │
GND            Vout

Interfacing LM35 with Arduino

Interfacing the LM35 temperature sensor with an Arduino is straightforward. Follow these steps:

  1. Connect the LM35’s +Vs pin to the Arduino’s 5V pin.
  2. Connect the LM35’s GND pin to the Arduino’s GND pin.
  3. Connect the LM35’s Vout pin to one of the Arduino’s analog input pins (e.g., A0).

Here’s a sample Arduino sketch that reads the temperature from the LM35 and displays it on the serial monitor:

const int lm35Pin = A0;

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

void loop() {
  int rawValue = analogRead(lm35Pin);
  float voltage = rawValue * 5.0 / 1023.0;
  float temperature = voltage * 100.0;

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println("°C");

  delay(1000);
}

In this sketch:

  1. We define the analog pin connected to the LM35’s Vout (A0 in this example).
  2. In the setup() function, we initialize the serial communication at 9600 baud.
  3. In the loop() function:
  4. We read the raw analog value from the LM35 using analogRead().
  5. We convert the raw value to voltage using the formula: voltage = rawValue * 5.0 / 1023.0.
  6. We convert the voltage to temperature in Celsius using the formula: temperature = voltage * 100.0.
  7. We print the temperature on the serial monitor.
  8. We add a delay of 1 second (1000 milliseconds) before the next reading.

Upload this sketch to your Arduino, open the serial monitor, and you will see the temperature readings in degrees Celsius.

LM35 Temperature Sensor Accuracy and Calibration

The LM35 temperature sensor is factory-calibrated to provide an accuracy of ±0.5°C at room temperature (25°C) and ±0.75°C over the full -55°C to 150°C temperature range. This accuracy is achievable without any external calibration or trimming.

However, if you require higher accuracy or need to compensate for any offset in your specific application, you can perform a simple calibration procedure:

  1. Measure the temperature using a reliable reference thermometer.
  2. Read the output voltage of the LM35 at that temperature.
  3. Calculate the offset voltage by subtracting the expected voltage (based on the reference temperature) from the measured voltage.
  4. Subtract this offset voltage from future readings to obtain the calibrated temperature.

For example, if the reference thermometer reads 30°C and the LM35 outputs 310 mV (instead of the expected 300 mV), the offset voltage is 10 mV. To calibrate future readings, subtract 10 mV from the measured voltage before converting it to temperature.

LM35 Temperature Sensor Applications

The LM35 temperature sensor is widely used in various applications, such as:

  1. Environmental monitoring
  2. HVAC systems
  3. Process control
  4. Automotive temperature sensing
  5. Medical equipment
  6. Consumer appliances
  7. Weather stations
  8. Industrial automation
  9. Robotics
  10. Internet of Things (IoT) devices

Its small size, low power consumption, and ease of use make it an ideal choice for embedding temperature sensing capabilities into various systems and projects.

Comparing LM35 with Other Temperature Sensors

There are several other temperature sensors available in the market, each with its own advantages and disadvantages. Let’s compare the LM35 with some popular alternatives:

LM35 vs. TMP36

The TMP36 is another analog temperature sensor with similar features to the LM35. However, there are a few key differences:

Feature LM35 TMP36
Output voltage 10 mV/°C 10 mV/°C
Accuracy ±0.5°C (at 25°C) ±2°C (over full range)
Temperature range -55°C to 150°C -40°C to 125°C
Supply voltage 4 to 30 V 2.7 to 5.5 V
Output at 25°C 250 mV 750 mV

The TMP36 has a wider supply voltage range and a higher output voltage at 25°C, but the LM35 offers better accuracy and a wider temperature range.

LM35 vs. DHT11/DHT22

The DHT11 and DHT22 are digital temperature and humidity sensors that use a single-wire protocol to communicate with a microcontroller. They offer the advantage of measuring both temperature and humidity, but they have some limitations compared to the LM35:

Feature LM35 DHT11 DHT22
Output Analog voltage Digital (single-wire) Digital (single-wire)
Temperature range -55°C to 150°C 0°C to 50°C -40°C to 80°C
Temperature accuracy ±0.5°C (at 25°C) ±2°C ±0.5°C
Humidity measuring No Yes (20-80%, ±5%) Yes (0-100%, ±2-5%)
Response time Fast (0.08°C in still air) Slow (1 Hz sampling rate) Slow (0.5 Hz sampling rate)

The DHT sensors are useful when you need to measure both temperature and humidity, but the LM35 is a better choice if you only need temperature measurements, require faster response times, or need to measure temperatures outside the range of the DHT sensors.

LM35 vs. Thermistor

A thermistor is a temperature-sensitive resistor whose resistance changes non-linearly with temperature. Thermistors are widely used for temperature sensing, but they have some differences compared to the LM35:

Feature LM35 Thermistor
Output Analog voltage Resistance
Temperature range -55°C to 150°C -90°C to 130°C (typical)
Linearity Linear Non-linear (exponential)
Accuracy ±0.5°C (at 25°C) ±0.1°C to ±1.5°C (typical)
Interchangeability High Low (requires calibration)
Cost Low Low to moderate

Thermistors offer high accuracy and a wide temperature range but require linearization and calibration due to their non-linear response. The LM35 provides a linear output and high interchangeability without calibration, making it easier to use in many applications.

FAQ

  1. Q: Can I use the LM35 temperature sensor with a 3.3V microcontroller?
    A: Yes, you can use the LM35 with a 3.3V microcontroller, as long as the supply voltage is within the sensor’s operating range (4 to 30 V). However, you may need to use a voltage divider to scale down the output voltage to match the microcontroller’s analog input range.

  2. Q: How can I improve the accuracy of the LM35 temperature sensor?
    A: To improve the accuracy of the LM35, you can:

    • Ensure a stable power supply with minimal noise and ripple.
    • Use a high-resolution ADC (e.g., 12-bit or higher) to read the analog output.
    • Perform a two-point calibration to compensate for any offset and gain errors.
    • Minimize self-heating by using a low-current excitation source and providing adequate air circulation around the sensor.
  3. Q: Can I use the LM35 temperature sensor in a outdoor environment?
    A: Yes, the LM35 can be used in outdoor environments, but you should protect it from direct exposure to rain, snow, and sunlight. You can use a weatherproof enclosure or a protective coating to shield the sensor from the elements. Additionally, ensure that the ambient temperature stays within the sensor’s operating range (-55°C to 150°C).

  4. Q: How do I connect multiple LM35 sensors to a single microcontroller?
    A: To connect multiple LM35 sensors to a single microcontroller, you can:

    • Use a separate analog input pin for each sensor.
    • Use an analog multiplexer (e.g., CD4051) to switch between multiple sensors connected to a single analog input pin.
    • Use a multi-channel ADC (e.g., ADS1115) to read multiple sensors simultaneously.
  5. Q: Can I use the LM35 temperature sensor for measuring body temperature?
    A: While the LM35 can be used for measuring body temperature, it is not designed for direct contact with the skin. For medical applications, it is recommended to use sensors specifically designed for body temperature measurement, such as thermistors or infrared sensors. Additionally, ensure that the sensor and its application comply with relevant medical device regulations and standards.

Conclusion

The LM35 temperature sensor is a versatile, accurate, and easy-to-use device for measuring temperature in various applications. Its linear output, wide temperature range, and low power consumption make it an ideal choice for embedded systems, industrial automation, and IoT projects.

By understanding the working principle, interfacing methods, and calibration techniques of the LM35, you can effectively integrate temperature sensing capabilities into your projects and ensure reliable and accurate measurements.

When selecting a temperature sensor for your application, consider factors such as accuracy, temperature range, output type, and compatibility with your system. The LM35 offers a balanced combination of features that make it suitable for a wide range of applications, but other sensors like thermistors or digital sensors may be more appropriate in specific cases.

As you explore the world of temperature sensing, keep in mind the best practices for sensor placement, signal conditioning, and calibration to optimize the performance and reliability of your temperature measurement system.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

Tag Cloud

There’s no content to show here yet.