0% found this document useful (0 votes)
12 views4 pages

MEng 125n Laboratory Exercise 7

This document outlines an exercise for building a temperature monitoring system using an LM35 sensor and Arduino. It includes learning outcomes, materials needed, circuit setup, coding instructions, and post-lab questions. The exercise aims to teach students about temperature sensing, using the LM35 sensor, and programming with Arduino.
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)
12 views4 pages

MEng 125n Laboratory Exercise 7

This document outlines an exercise for building a temperature monitoring system using an LM35 sensor and Arduino. It includes learning outcomes, materials needed, circuit setup, coding instructions, and post-lab questions. The exercise aims to teach students about temperature sensing, using the LM35 sensor, and programming with Arduino.
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/ 4

For instructional purposes only • 1st Semester SY 2020-2021 25

Exercise No. 7:
Temperature Sensing
Introduction
In this exercise, we will build a simple temperature monitoring system and
display the values to the Arduino Serial Monitor. The value from the LM35
sensor is read and stored into the tempReading variable. Then, the value of
tempReading is multiplied by 0.488 and stored into the correctTemperature
variable. Then, the value of correctTemperature is printed to serial port,
displaying its value in the Serial monitor. A pause of 1000 milliseconds
happens, and the process repeats again.

Learning Outcomes
After this laboratory exercise, student should be able to:
1. discuss the concepts of Temperature Sensing;
2. use the LM35 IC as a Temperature Sensor; and
3. use the programming data type “float decimal numbers” and
arithmetic math function: multiplication (*).

Materials
• 1 – Arduino UNO R3
• 1 – USB Cable (USB-A to USB-B)
• 1 – LM35 Temperature Sensor
• 1 – Breadboard
• Connecting Wires
• Computer with Arduino software

Procedure

Part 1: The Circuit


1. Connect the +5V pin of LM35 to +5V pin of Arduino using (red) wire,
GND pin (black) to Arduino GND. OUT pin (green) to analog pin A0.
Figure 7 for your reference.
Page 25 of 56
Vision: A globally competitive university for science, technology, and environmental conservation.
TP-IMD-04
Mission: Development of a highly competitive human resource, cutting-edge scientific knowledge V0 07-15-2020
and innovative technologies for sustainable communities and environment. No. CET.ME
LM21-01
26 MEng 125n: Basic Electronics

Figure 7. Pictorial Diagram of the Temperature Sensing Circuit

Part 2: The Code


1. Open the Arduino Software IDE. Go to top-left corner of the Arduino IDE
window and click File>New. This action opens up a new coding editor
window for a new project.
2. Type the Arduino Code below to your Arduino IDE.
/*
Temperature Sensing with LM35
*/

//assign variable to use for the program


// use a float variable tempReading for decimal reading
float tempReading;

// use a float variable correctTemperature for decimal reading


float correctTemperature;

// use Arduino Analog pin 0 for temprature reading


int temperaturesensorPin = 0;

void setup()
{
// call a serial monitor communication to view the readings
Serial.begin(9600);
}

// the loop is where your program runs repeatedly.


void loop()
{
// First we get the value of the temperature read by the sensor
// from Arduino analog pin 0.
tempReading = analogRead(temperaturesensorPin);

// We multiply the resulting value of "tempreading" by .488

Page 26 of 56
Vision: A globally competitive university for science, technology, and environmental conservation.
TP-IMD-04
Mission: Development of a highly competitive human resource, cutting-edge scientific knowledge V0 07-15-2020
and innovative technologies for sustainable communities and environment. No. CET.ME
LM21-01
For instructional purposes only • 1st Semester SY 2020-2021 27

// to get the exact calibrated value of the temperature in degree


// Celsius.
correctTemperature = tempReading * 0.488;

// print the result to the serial monitor.


Serial.print(correctTemperature);
Serial.println(" degree Celsius"); // print result in a new line
delay(1000); // 1 second delay to display the value every second.
}

3. Click Verify button to review code for errors. If the code has no
errors and missing commands a message on the window below will
display “Done Compiling” this means your code is
ready to be uploaded into the Arduino microcontroller board.
4. Click Upload button to upload the Arduino Code to the Arduino
microcontroller board.
5. Run the program and open the Arduino Serial Monitor (configurations
of the Serial Monitor in the bottom of the window: checked Autoscroll,
Both NL&CR and 9600 baud). You should see the values of the
temperature in degrees Celsius print out in the Serial monitor. From the
code above, the value will be printed every 1 second.

Post Lab Questions


1. Try placing the LM35 circuit near a hot item or warm environment, what
happens to the values?
2. Try moving to another Arduino Analog Pin, what pin did you use? What
are the changes needed to do in the code?
3. What are your learning experiences in this laboratory exercise?

Instructions on how to submit the laboratory


1. Make a video of yourself while performing the laboratory. The video
must not be below 3 minutes but will not exceed for 5 minutes.
2. Upload your video on your Google Drive or YouTube account. Share the
link of this video to [email protected].
3. Make the laboratory report by following the format/template given in
the virtual classroom. Save it in a pdf file with a file name format of
Surname.Firstname_LE# (e.g. Rizal.Procorpio_LE1).
4. Upload your laboratory report in the virtual classroom.

References

1. Cameron, N. 2019. Arduino Applied. doi:10.1007/978-1-4842-3960-5


2. Culkin, Jody and Hagan, Eric. 2017. Make: Learn Electronics with
Arduino, An Illustrated Begnner’s Guide to Physical Computing. Maker
Media, Inc., 1700 Montgomery Street, Suite 240, San Francisco, CA
94111

Page 27 of 56
Vision: A globally competitive university for science, technology, and environmental conservation.
TP-IMD-04
Mission: Development of a highly competitive human resource, cutting-edge scientific knowledge V0 07-15-2020
and innovative technologies for sustainable communities and environment. No. CET.ME
LM21-01
28 MEng 125n: Basic Electronics

3. Monk, Simon. 2017. Electronics Cookbook. O’Reilly Media, Inc., 1005


Gravenstein Highway North, Sebastopol, CA 95472.
4. Osborne, William. 2017. Learn to Program in Arduino C: 18 Lessons,
from setup() to robots. Amdillo Books. United States of America.
5. Norris, Donald. 2015. The Internet of Things: Do-It-Yourself Projects
with Arduino, Raspberry Pi, and BeagleBone Black. McGraw-Hill
Education. United States of America.

Page 28 of 56
Vision: A globally competitive university for science, technology, and environmental conservation.
TP-IMD-04
Mission: Development of a highly competitive human resource, cutting-edge scientific knowledge V0 07-15-2020
and innovative technologies for sustainable communities and environment. No. CET.ME
LM21-01

You might also like