A temperature sensor IC is a two-terminal integrated circuit that generates an output current that is proportional to temperature. Temperature sensor ICs are available in two types analog temperature sensor IC and digital temperature sensor ICs which are used in consumer, industrial, portable, home appliances, medical, etc because of their low power consumption and accuracy. The main features of analog temperature sensors are good linearity, less power utilization, accuracy, and temperature ranges from –55 °C to +130 °C whereas digital temperature sensor features are; less power utilization, high accuracy & operating temperature ranges from –55 °C to +125 °C. This article discusses an overview of analog temperature sensor IC like an LM35 temperature sensor, working, and their applications.
What is LM35 Temperature Sensor?
LM35 is a linear, precise, and low-cost temperature measuring chip and it provides an analog output voltage that is proportional to the temperature it measures. So, the output voltage of this sensor changes linearly through a change in temperature. LM35 does not need any extra calibration circuit to provide the output within degree Celsius. This temperature sensor IC is used to measure the temperature of air, electric circuits, battery packs, boiling water, etc. This IC is very small, used to measure temperatures from -55°C to 150°C range anywhere. This IC can be interfaced easily with any Microcontroller which has an ADC function or any Arduino.
Pin Configuration:
The pin configuration of the LM35 temperature sensor is shown below. This IC includes three pins which are discussed below.
- Pin1 (Vcc): It is a voltage supply pin and it uses +5V input voltage.
- Pin2 (Analog Out): This pin provides an analog output voltage that is proportional to the temperature in degrees Celsius.
- Pin3 (GND): It is a GND pin, connected to the GND of the circuit.
Features & Specifications:
The features and specifications of the LM35 temperature sensor are discussed below.
- LM35 is a three-terminal a high-precision and low-power temperature sensor
- This sensor is calibrated in Celsius directly.
- The type of package is TO-92, SOIC & TO-220.
- The sensitivity of this sensor is 10 mV/degree Celsius.
- It provides precise output as compared to a thermistor.
- Ensured accuracy is 0.5°C.
- It is suitable mainly for remote applications.
- Its operating voltage ranges from 4V – 30V.
- Its current drain is below 60-µAmps.
- It has 0.08°C of low self-heating within the air.
- It has a low output impedance of 0.1 ohms for a 1mA load.
- Its output voltage is 10mV/°C.
- Its linearity error for 0°C to +100°C is ±1°C.
- Its operating temperature ranges from -55°C to +150°C.
- Its power consumption typically is 60 μA.
- The type of output is analog.
- Its accuracy is typically ±1°C.
Equivalent & Alternate Temperature Sensor ICs
The equivalent LM35 temperature sensors are; DS18B20, LM34, LM94022 and DS1620 whereas alternate LM35 temperature sensors are; DS18B20, DHT11, RTD PT100, TMP36, etc.
LM35 Temperature Sensor Working
The LM35 temperature sensor provides the output voltage that is linearly proportional to the Celsius temperature. This sensor’s output scale factor is 10 mV/ degree Celsius. By measuring the voltage on the o/p pin of this IC, we can measure the temperature value.
If the temperature of the IC is 0°C, then the o/p voltage of this IC can also be 0V. For every degree Celsius increase in temperature, there will be an increase of 0.01V or 10mV. By using Vout = 10mV°C *T formulae, the voltage can be changed into temperature. In this formula, the ‘Vout’ is the output voltage of IC, and ‘T’ is the temperature within °C.
Temperature Indicator Circuit
The temperature indicator circuit with LEDs using the LM35 temperature sensor is shown below. In the industrial sector or in some other applications, temperature detecting, monitoring, and controlling is a very significant procedure. So LM35 temperature indicator circuit using LEDs is designed by using some basic electronic components. This circuit works simply without any microcontroller & indicates the status of temperature whether it is below or above the threshold.
The required components to make this circuit are; LM35 temperature sensor, MC1458 op-amp IC, two BC547 NPN transistors, Green color LED, Red color LED, 10KΩ variable resistor, 8.2KΩ Resistor, 10KΩ Resistor, and 3 680Ω resistors.
Connections
To design this circuit, first, connect the MC1458 op-amp and LM35 temperature sensor as shown in the above circuit diagram. The output of the LM35 temperature sensor output to the non-inverting input pin of MC1458 op-amp and inverting pin of this op-amp must be connected with the variable resistor VR1 to set the threshold level of temperature.
The MC1458 op-amp output is connected to the base terminal of the Q1 transistor with the R3 Resistor & Q1 transistor’s collector terminal is connected to the base terminal of the Q2 transistor with the R5 Resistor. Here the Red color LED is connected with the collector terminal of ‘Q1’ & Green color LED is connected with the collector terminal of Q2 throughout 680Ω Resistors.
Working
The temperature indicator circuit works with a 5V DC supply. This simple circuit uses Red LED & Green LED to specify the threshold level of temperature & this temperature level can be changed with VR1 variable resistor.
If the temperature is below the threshold level, MC1458 op-amp doesn’t generate output & thus Q1 transistor will turn OFF and the base terminal of the Q2 transistor will get the voltage supply with R2 Resistor so that Green LED will Glow. Once the temperature is above the threshold level, MC1458 op-amp will generate output & Q1 transistor will turn ON to make the Red color LED Glow thus, the Q2 transistor will turn OFF because it won’t get bias.
Interface of LM35 with Arduino Microcontroller:
Connect LM35 with Android as per the below connections:
- Connect the LM35’s Vcc pin to the 5V supply.
- Connect the LM35’s GND pin to the ground of the power supply.
- Connect the LM35’s Vout pin to an analog input pin of the microcontroller A0 on Arduino.
Arduino Code Example:
Here’s a basic Arduino code example to read temperature from the LM35 sensor and display it on the serial monitor: In the below code the LM35 is assigned to A0 analog port pin of Android and then a serial interface is initiated to display it in the LCD for every two secs. The below code reads the analog voltage value from LM35 and converts into celsius and displays it . It is a continuous loop.
#include <Arduino.h> // Include the Arduino core library
#include <LiquidCrystal.h> // Include the LiquidCrystal library for LCD display
const int lm35Pin = A0; // Analog pin connected to LM35 output
float temperature = 0.0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Initialize LCD object with pin numbers
void setup() {
Serial.begin(9600); // Start serial communication
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
}
void loop() {
int rawValue = analogRead(lm35Pin); // Read analog value from LM35
temperature = (rawValue * 5.0 / 1023 – 0.5) * 100; // Convert to Celsius
Serial.print(“Temperature: “);
Serial.print(temperature);
Serial.println(” °C”);
lcd.clear(); // Clear the LCD display
lcd.print(“Temp: “);
lcd.print(temperature);
lcd.print(” C”);
delay(1000); // Delay for 1 second
}
In the above code
- The lm35Pin constant is set to the analog pin to which the LM35 output is connected (A0 in this case).
- The analogRead function reads the raw analog value from the LM35 sensor.
The LM35 temperature sensor provides an analog output voltage range that is typically 0V to 1.5V when the temperature range is within the sensor’s specified limits.
When this analog voltage is connected to an ADC input on a microcontroller (such as the Arduino), the ADC converts this voltage into a digital value. In the case of a 10-bit ADC, like the one on Arduino, the range of digital values is from 0 to 1023.
To convert this digital value back into a temperature in degrees Celsius, you need to reverse the formula provided by the LM35 datasheet. The LM35 has a sensitivity of 10 mV per degree Celsius, which means that for every 1°C change in temperature, the output voltage changes by 10 mV.
Here’s the formula for converting the analog value to temperature:
Temperature (Celsius) = (AnalogValue * (Vref / 1023) – Voffset) / 0.01
- AnalogValue: The raw digital value obtained from the ADC (0 to 1023).
- Vref: The reference voltage of the ADC (5V in your case).
- Voffset: The voltage at 0°C (typically 0.5V for the LM35).
- 0.01: The temperature coefficient of the LM35, which is 10 mV per degree Celsius.
In the code snippet provided, the calculation (rawValue * 5.0 / 1023 – 0.5) * 100 is a simplification of above formula to convert the digital value to temperature in Celsius.
The 0.5 subtracted is the offset value.
Interface of LM35 with PIC Microcontroller
The code for Connecting LM35 with PIC is the same as ARDUINO here the Vout of LM35 should be connected to the an analog input pin of a pic microcontroller. The header files and the interface functions are different but the calculation is the same as above.
#include <xc.h>
#include <stdint.h>
#include “lcd.h” // Include your LCD library header
#define _XTAL_FREQ 8000000 // Set the oscillator frequency
// Function to initialize ADC module
void ADC_Init() {
ADCON0 = 0b01000001; // Select AN0 channel and enable ADC
ADCON1 = 0b11000000; // Set result format to right-justified, Vref+ = VDD, Vref- = VSS
}
// Function to read ADC value from LM35
uint16_t ADC_Read(uint8_t channel) {
ADCON0bits.CHS = channel; // Select ADC channel
__delay_us(10); // Short delay
GO_nDONE = 1; // Start ADC conversion
while(GO_nDONE); // Wait for conversion to complete
return ((ADRESH << 8) + ADRESL); // Return ADC result
}
void main() {
// Initialize LCD
LCD_Init();
LCD_Clear();
// Initialize ADC
ADC_Init();
uint16_t adcValue;
float temperature;
while(1) {
adcValue = ADC_Read(0); // Read LM35 value from AN0 channel
temperature = (adcValue * 5.0 / 1023 – 0.5) * 100; // Convert to Celsius
// Display temperature on LCD
LCD_Clear();
LCD_String(“Temperature:”);
LCD_GoTo(1, 0);
LCD_Float(temperature, 2); // Display temperature with 2 decimal places
__delay_ms(1000); // Delay for 1 second
}
}
LM35 Temperature Sensor Applications
The applications of the LM35 temperature sensors include the following.
- The LM35 temperature sensor is used to provide thermal shutdown for a component or circuit used within a specific project.
- This sensor is used for measuring battery temperature.
- This sensor gives protection to a battery from overheating
- This sensor is used for measuring temperature through an electrical o/p relative to the temperature in °Centigrade.
- This sensor is used to measure temperatures in HVAC applications.
- This temperature sensor is used to measure an object’s body temperature & also measures ambient temperature.
- This IC is used to measure the soil temperature.
- This sensor is used in various weather detection applications for monitoring weather or home automation.
LM35 is or can also be used in some of the home appliances like
- Thermostats: They are commonly used in thermostats to measure room temperature and control heating and cooling systems to maintain a comfortable indoor environment.
- Refrigerators and Freezers: It can be found in refrigerators and freezers to monitor the temperature and ensure that the contents are stored at the appropriate conditions.
- Ovens and Microwaves: Some ovens and microwaves use It for temperature control and safety features to prevent overheating.
- Air Conditioners: It are used in air conditioning units to measure room temperature and adjust cooling operations.
- Water Heaters: It can monitor water temperature in water heaters to regulate heating and ensure safe and efficient water heating.
- Coffee Makers and Kettles: Some appliances use LM35 sensors to monitor water temperature and control the brewing or heating process.
- Irons: It might be used in irons to regulate the temperature of the ironing plate.
- Slow Cookers and Crock-Pots: It can be used in slow cookers to maintain consistent cooking temperatures.
- Heating Pads: It might be used in heating pads for medical or comfort purposes.
- Aquarium Heaters: It can monitor water temperature in aquarium heaters to maintain a suitable environment for aquatic life.
- Space Heaters: It can be used in space heaters for temperature control and safety purposes.
- Dehumidifiers and Humidifiers: It can help monitor and control humidity levels in these appliances.
- Bread Makers: Some bread makers use LM35 sensors to monitor the temperature of the baking chamber.
- Electric Blankets: It can be used to regulate the temperature in electric blankets.
- Wine Coolers: It can monitor the temperature in wine coolers to ensure proper storage condition
Please refer to this link for LM35 Temperature Sensor Datasheet.
Thus, this is an overview of an LM35 temperature sensor, its working, Interfacing and its applications. Here is a question for you, what are the other temperature sensor ICs?