Interfacing LM35 Temperature Sensor with Arduino

LM35 Temperature Sensor

The LM35 is a low-voltage, precision centigrade temperature sensor manufactured by Texas Instruments. It is a chip that provides a voltage output that is linearly proportional to the temperature in °C and is, therefore, very easy to use with an Arduino.

Testing the LM35 Sensor

LM35 Sensor Pinout

The LM35 comes in three different form
factors, but the most common type is the
3-pin TO-92 package, which looks just like
a transistor.

Connecting the LM35 Temperature Sensor with Arduino

Reading the Analog Temperature Data

Vout = (reading from ADC) * (5 / 1024)
This formula converts the number 0-1023 from the ADC
into 0-5V
Then, to convert volts into temperature, use this formula:
Temperature (°C) = Vout * 100

Code:

// LM35 Temperature Sensor Interface

const int sensorPin = A0; // Analog pin A0 connected to the LM35 sensor

void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud rate
}

void loop() {
int sensorValue = analogRead(sensorPin); // Read the analog voltage from the sensor
float voltage = sensorValue * (5.0 / 1023.0); // Convert analog value to voltage (assuming 5V reference voltage)
float temperature = (voltage - 0.5) * 100; // Convert voltage to temperature in degrees Celsius (LM35 outputs 10mV per degree Celsius)

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

delay(1000); // Delay for 1 second before reading the temperature again
} 

PowerPoint:

 

 

Leave a Reply

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