Description
The LM35 Analog Temperature Sensor is a popular option for temperature sensing over the range of -55 to 150°C.
PACKAGE INCLUDES:
- LM35 Temperature Sensor
KEY FEATURES OF LM35 ANALOG TEMPERATURE SENSOR:
- Provides analog output directly readable in degrees Celsius
- Output voltage corresponds to 10.0mV/°C
- -55 to 150°C measurement range with ±0.5°C accuracy°
- 5V compatible. 3.3V uC compatible if the sensor is run off separate 4 to 20V supply.
If you have a uC like an Arduino and you want to measure temperature, the LM35 is one of the more popular temperature measurement ICs to use.
The LM35 is a 3-pin analog thermometer packaged in a TO-92 package. The output is a linear voltage that corresponds to 10.0mV/°C, so the output is directly readable in degrees Celsius using an analog port on a uC. Accuracy is typically within 0.5°C.
Since the voltage output range of the sensor is limited to 1.5V, if a greater resolution is desired, the analog reference voltage on the uC can be changed from the default 5V to something closer to 1.5V which will decrease the voltage step size on the analog readings.
Hook-up is very simple. Connect GND pin to ground, Vs pin to 5V (or anything between 4 – 20V) and Vout pin to an analog pin on the uC. The device can be left open air for measuring air temps or it can be glued or cemented to an object that you want to measure the temperature of such as a heat sink.
When using the LM35 with a single supply voltage, the temperature measurement range is limited to 2°C to 150°C which is adequate for most applications. If the negative range is required, see the datasheet for specifics.
An alternative for temperature measurement is to use a digital temperature sensor like the DS18B20 which comes in the same package. Digital temp sensors tend to have better noise immunity which is useful when the sensor will be placed some distance away or is in an electrically noisy environment, but they do require a software library to implement the communication protocol. Libraries are readily available for most common microcontrollers such as the Arduino and are very straightforward to use.
OUR EVALUATION RESULTS:
The LM35 can be used to experiment with a number of different applications where temperature measurement is useful such as determining when a cooling fan should be turned on and it is perfectly suitable for integration into a final product.
The program below simply reads the value from the LM35 using analog port A0, but this can be changed to any convenient analog port. It then prints the temperature in Celcius and Farenheit out to the Serial Monitor window.
The program uses the line float voltage = (raw_temp * 5.0 / 1024) * 100; to convert the LM35 output to degrees Celsius.
This line simply takes the raw analog reading and multiples it by 5.0 because the ADC reference voltage is 5V. It then divides that number by 1024 because the Arduino has a 10-bit ADC which gives 1024 steps of resolution. The result of that bit of math gives us the voltage that we are measuring out of the LM35 (which will be in a range of 0 to 1.5V). To get from voltage to temperature in Celcius, we multiply that number by 100 because the LM35 output is 0.010V per degree.
/* LM35 Analog Temperature Sensor Test Reads the output of LM35 connected to pin A0 and reports that temperature in degrees Celcius and Farenheit out to the Serial Monitor Window */ const int LM35_PIN = A0; // Define analog pin the LM35 is connected to int temp_C, temp_F; // Define a couple of variables to hold the temperatures //=============================================================================== // Initialization //=============================================================================== void setup() { Serial.begin(9600); // Initialize Serial Monitor window comm speed } //=============================================================================== // Main //=============================================================================== void loop() { temp_C = Get_Temp(LM35_PIN); // Get the temp in C temp_F = C_To_F(temp_C); // Convert the temp from C to degrees F // Printout the results Serial.print(temp_C); Serial.println(" Degrees C"); Serial.print(temp_F); Serial.println(" Degrees F"); Serial.println(""); delay(1000); // Pause 1 sec then repeat } //=============================================================================== // Get_Temp - subroutine to read the temperature from the LM35 //=============================================================================== int Get_Temp(int pin) { int raw_temp = analogRead(pin); float voltage = (raw_temp * 5.0 / 1024) * 100; // Calculate temp based on raw reading return voltage; } //=============================================================================== // C_To_F - subroutine to convert temp from Celcius to Fahrenheit //=============================================================================== int C_To_F(int temp) { return (temp * 9 / 5) + 32; // Basic formula for converting degrees C to F }
Notes:
- None
Technical Specifications
Interface | Analog | |
Scale Factor | 10.0mV / °C | |
Supply Voltage | Maximum | 30V |
Minimum | 4V | |
Temperature | Max Range | -55°C to +150°C |
Accuracy (at +25°C) | ± 0.5°C | |
Package | TO-92 | |
Package Type | Plastic, thru-hole | |
Mfr | National | |
Datasheet | LM35 |