0% found this document useful (0 votes)
9 views5 pages

090 PostLab4

The document details an experiment on interfacing the LM35 temperature sensor with an Arduino board, explaining its features, working principle, and how to measure temperature using the sensor. It includes instructions for reading analog temperature data, converting it to Celsius, and provides sample code for implementation. Additionally, it outlines a post-lab exercise to display temperature data on an LCD.

Uploaded by

premjoshi.int
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

090 PostLab4

The document details an experiment on interfacing the LM35 temperature sensor with an Arduino board, explaining its features, working principle, and how to measure temperature using the sensor. It includes instructions for reading analog temperature data, converting it to Celsius, and provides sample code for implementation. Additionally, it outlines a post-lab exercise to display temperature data on an LCD.

Uploaded by

premjoshi.int
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Marwadi University

Faculty of Engineering & Technology


Department of Information and Communication Technology
Subject: Foundation skills in
Aim: Interfacing force sensor with Arduino board
sensor interfacing (01CT1103)
Experiment No: 04 Date: 31 Aug Enrollment No: 132261

Aim: Interfacing temperature sensor with Arduino board

IDE:

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.

The LM35 temperature sensor is fairly precise, never wears out, works under many environmental conditions
and requires no external components to work. In addition, the LM35 sensor does not require calibration and
provides a typical accuracy of ±0.5°C at room temperature and ±1°C over a full −55°C to +155°C temperature
range.
The sensor can be powered with a 4V to 30V power supply and consumes less than 60µA during active
temperature conversions, providing very low self-heating (less than 0.08°C in still air).
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: Interfacing force sensor with Arduino board
sensor interfacing (01CT1103)
Experiment No: 04 Date: 31 Aug Enrollment No: 132261

The only disadvantage of the LM35 sensor is that it requires a negative bias voltage to measure negative
temperature. The TMP36 by Analog Devices is fairly accurate (-40°C to 125°C) and has the advantage of being
able to measure negative temperatures without the need for negative bias voltage.
A better alternative to the LM35 is to use a digital temperature sensor like the DS18B20 which comes in the
same package. Digital temperature sensors have better noise immunity which is useful when the sensor is
placed at a distance or in an electrically noisy environment.

Working Principle
The LM35 uses a solid-state technique to measure the temperature. It makes use of the fact that the voltage drop
between the base and emitter (forward voltage – Vbe) of the Diode-connected transistor decreases at a known
rate as the temperature increases. By precisely amplifying this voltage change, it is easy to generate an analog
signal that is directly proportional to temperature.

How to Measure Temperature


The LM35 is easy to use; just connect the left pin to power (4V to 30V) and the right pin to ground. Then the
middle pin will have an analog voltage that is directly proportional (linear) to the temperature in °C. To convert
the voltage to temperature, simply use the basic formula:

Temperature (°C) = Vout * 100

For example, if the voltage out is 0.5V that means that the temperature is 0.5 * 100 = 50 °C
LM35 Sensor Pinout
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: Interfacing force sensor with Arduino board
sensor interfacing (01CT1103)
Experiment No: 04 Date: 31 Aug Enrollment No: 132261

+Vs is the power supply for the sensor which can be anywhere between 4V to 30V.

Vout pin produces an analog voltage that is directly proportional (linear) to the temperature. It should be
connected to an Analog (ADC) input.

GND is a ground pin.

Reading the Analog Temperature Data


The output of the LM35 is connected to one of the analog inputs of the Arduino. The value of this analog input
can be read with the analogRead() function.
However, the analogRead() function does not actually return the output voltage of the sensor. Instead it maps
the input voltage between 0 and the ADC reference voltage (technically it is the operating voltage i.e. 5V or
3.3V unless you change it) to 10-bit integer values ranging from 0 to 1023. To convert this value back to the
sensor’s output voltage, use this formula:
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:
#define sensorPin A0
void setup() {
// Begin serial communication at 9600 baud rate
Serial.begin(9600);
Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: Interfacing force sensor with Arduino board
sensor interfacing (01CT1103)
Experiment No: 04 Date: 31 Aug Enrollment No: 132261

}
void loop() {
// Get the voltage reading from the LM35
int reading = analogRead(sensorPin);

// Convert that reading into voltage


float voltage = reading * (5.0 / 1024.0);

// Convert the voltage into the temperature in Celsius


float temperatureC = voltage * 100;

// Print the temperature in Celsius


Serial.print("Temperature: ");
Serial.print(temperatureC);
delay(1000); // wait a second between readings
}

}Post Lab Exercise:

1. To display Temperature data on the LCD


Marwadi University
Faculty of Engineering & Technology
Department of Information and Communication Technology
Subject: Foundation skills in
Aim: Interfacing force sensor with Arduino board
sensor interfacing (01CT1103)
Experiment No: 04 Date: 31 Aug Enrollment No: 132261

Complete Post Lab Exercise

Fig 1: Circuit Diagram

//Post-Lab4 Code-MU-ICT-SEM1-ICT-EK1-090
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

#define sensorPin A0
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
}

void loop()
{
int reading = analogRead(sensorPin); // Collects the voltage reading from TMP36
float voltage = reading * (5.0 / 1024.0); // Convert that reading into analog characters
float temperatureC = (voltage * 100)- 49.8; // Convert the voltage into the temperature in Celsius
lcd.setCursor(0,0);
lcd.print("Temp. (C) ");
lcd.print(temperatureC);
delay(1000);
}

You might also like