0% found this document useful (0 votes)
34 views11 pages

1-Lab 2 - Arduino 2 (Temperature Monitoring System)

The document outlines a lab agenda for an Arduino project focused on creating a temperature monitoring system using the LM35 temperature sensor and an LED. It includes steps for developing the project, such as flowchart creation, wiring, coding, and uploading the code, with specific instructions on how to read and display temperature data. Additionally, a practice exercise is provided to enhance learning by incorporating both red and green LEDs based on temperature thresholds.

Uploaded by

rvjk8sd5fm
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)
34 views11 pages

1-Lab 2 - Arduino 2 (Temperature Monitoring System)

The document outlines a lab agenda for an Arduino project focused on creating a temperature monitoring system using the LM35 temperature sensor and an LED. It includes steps for developing the project, such as flowchart creation, wiring, coding, and uploading the code, with specific instructions on how to read and display temperature data. Additionally, a practice exercise is provided to enhance learning by incorporating both red and green LEDs based on temperature thresholds.

Uploaded by

rvjk8sd5fm
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/ 11

Transforming Ideas into Innovations II-ENGR132

Arduino 2: Temperature Monitoring System


Lab Agenda

1. Temperature Monitoring System Example

2. Practice Exercise
ENGR 132

Temperature monitoring example


Example Project
Develop an Arduino project for temperature
monitor using LM35 temperature sensor
and an LED.
Read the temperature and display it on the
computer. If the temperature reading is
higher than 24°C , the LED will blink.
Otherwise, the LED will be off.

Note:To convert the analog signal from LM35


sensor to °C use the following equation

(5.0∗𝑟𝑒𝑎𝑑𝑖𝑛𝑔∗100.0)
Temperature(°C )=
1023
Step 1: Flowchart
Start

Read Signal

Calculate
temperature

Display
temperature

If Yes Turn LED ON Wait Turn LED OFF Wait


Temp.>24

No

Turn LED OFF


Step 2: Wiring
Step 3: Coding
Define Constants & Variables
//LM35 Pin Variables
const int ledPin = 9; // LED Pin connected to pin 9
const int sensorPin = A0; // Temp sensor (LM35) Vout is connected to pin A0
int reading; // New variable named reading to store reading from sensor
float temperatureC; // New variable named temperatureC of type float

Define Inputs & Outputs


void setup()
{
pinMode(ledPin, OUTPUT); // Set pin 9 as OUTPUT
pinMode(sensorPin, INPUT); // Optional: as all Analog pins are input in UNO
Serial.begin(9600); // begin serial connection with the computer to
} // view sensor readings on the monitor
Step 3: Coding
Code for your Program Loop
void loop()
{ reading = analogRead(sensorPin); // read data from LM35 using Arduino (A0) pin
temperatureC = (5.0 * reading* 100.0) / 1023.0; // Convert reading to temp

Serial.println(temperatureC); // Print voltage on serial monitor

if(temperatureC>24) {
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
else{
digitalWrite(ledPin, LOW);
}
}
Step 4: Upload your Code
ENGR 132

Practice Exercise
Temperature Monitoring

Develop an Arduino project for temperature


monitor using LM35 temperature sensor, red LED
and green LED.
Read the temperature and display it on the
computer. If the temperature reading is less than
25°C , the green LED will blink. Otherwise, the
red LED will blink.

Note:To convert the analog signal from LM35


sensor to °C use the following equation

(5.0∗𝑟𝑒𝑎𝑑𝑖𝑛𝑔∗100.0)
Temperature(°C )=
1023

You might also like