0% found this document useful (0 votes)
4 views3 pages

Practical 1a

Students will design and implement a simple embedded system using an Arduino and a temperature sensor to measure temperature and control an LED indicator. The project involves setting up the hardware, programming the microcontroller, and testing the system to observe real-time temperature feedback. The exercise aims to reinforce understanding of embedded systems' characteristics, including application-specific design and real-time operation.

Uploaded by

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

Practical 1a

Students will design and implement a simple embedded system using an Arduino and a temperature sensor to measure temperature and control an LED indicator. The project involves setting up the hardware, programming the microcontroller, and testing the system to observe real-time temperature feedback. The exercise aims to reinforce understanding of embedded systems' characteristics, including application-specific design and real-time operation.

Uploaded by

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

Building a Simple Embedded System: Temperature Sensor with an LED Indicator

Objective:
Students will design and implement a simple embedded system that measures temperature and
provides feedback using an LED, demonstrating real-time functionality and application-specific
design.

Materials:
 Arduino board (or any microcontroller)
 Temperature sensor (e.g., LM35 or DHT11)
 LED
 Resistors (220 ohms for the LED)
 Breadboard and jumper wires
 Laptop with Arduino IDE installed
 USB cable for programming the Arduino

Step-by-Step Instructions:
1. Setup (10 minutes):
o Connect the temperature sensor to the Arduino:
 VCC (power) to the 5V pin on the Arduino.
 GND (ground) to the GND pin.
 Data pin to any analog input pin (e.g., A0).
o Connect the LED to the breadboard:
 Connect one leg of the LED (longer leg) to a digital pin (e.g., D3) through
a 220-ohm resistor.
 Connect the shorter leg to GND.
2. Programming the Microcontroller (20 minutes):
o Open the Arduino IDE and write the following code:
int sensorPin = A0; // Analog pin connected to the temperature sensor
int ledPin = 3; // Digital pin connected to the LED
int threshold = 30; // Temperature threshold in Celsius

void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as output
Serial.begin(9600); // Start the serial communication
}

void loop() {
int sensorValue = analogRead(sensorPin); // Read sensor data
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage
float temperature = voltage * 100.0; // Convert to Celsius (for LM35)
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");

if (temperature > threshold) {


digitalWrite(ledPin, HIGH); // Turn on the LED if temperature exceeds threshold
} else {
digitalWrite(ledPin, LOW); // Turn off the LED otherwise
}
delay(1000); // Wait 1 second
}
o Upload the code to the Arduino board using the USB cable.
3. Testing the System (15 minutes):
o Open the serial monitor in the Arduino IDE to observe the temperature readings.
o Increase the temperature (e.g., by holding the sensor between your fingers).
o Observe how the LED turns on when the temperature exceeds the threshold (30°C
in this example).
4. Discussion and Reflection (15 minutes):
o Discuss how this system exemplifies the key characteristics of embedded systems:
 Application-Specific: Designed to monitor temperature and respond.
 Real-Time Operation: Immediate response to temperature changes.
 Reliability: Consistent performance with minimal resources.
o Explore modifications, such as adding a buzzer or using a networked system to
send temperature data to a smartphone.

Expected Outcome:
Students will have hands-on experience building and programming a basic embedded system,
reinforcing theoretical knowledge and understanding of embedded systems' practical
applications.

You might also like