Embedded Report
Embedded Report
Systems
Done By:
Mohamed 201739
Omar 218283
Omar 194927
Introduction
An embedded system is a specialized computing system designed
to perform dedicated functions or tasks within a larger system.
Unlike general-purpose computers, which can run various
applications, embedded systems are typically optimized for
specific operations, often with real-time computing constraints.
Some of Key characteristics of embedded systems:
1.Integration : Embedded systems combine hardware and software to accomplish a
specific function. The hardware often includes microcontrollers or microprocessors,
memory, and peripheral devices.
Main components
Arduino Uno (ATmega328P MCU)
Simple usability, accessibility of ADC channels, and PWM functions necessary for
fan control were guiding factors in choosing the Arduino Uno. The board works on
a 5V supply and 16MHz clock frequency carrying a comfortable space for
processing. Using a 10-bit ADC, the ATmega328P microcontroller digitizes the
temperature-analog output from the LM35 and varies output to the PWM pins in
order to control fan speed.
Hardware Connections
LM35: Its connected at analog pin A0; VCC goes to 5V, and GND goes to GND.
DHT11: The data pin goes to digital pin 2; VCC goes to 5V, GND goes to GND.
LCD (I2C): SDA goes to A4, SCL goes to A5; VCC goes to 5V, GND goes to
GND.
DC Fan: The fan is controlled through an NPN transistor; the base of the transistor
to PWM pin-9 (through resistor); the collector is connected to the negative of the
fan; the emitter is connected to GND. The positive of the fan is connected to 5V.
Code Implementation
The code reads temperature value from LM35 via its ADC, reads humidity and
temperature from DHT11, shows the readings on LCD, and controls the speed of
the fan as per temperature. The speed of the fan increases in a linear manner as soon
the temperature values go beyond a certain threshold.
Libraries
LiquidCrystal_I2C: For controlling the LCD using I2C.
MCU Interfaces
ADC: The ADC function on ATmega328P, which is of the 10-bit
type, reads the voltage from LM35 at pin A0.
Digital I/O: Communication with DHT11 is on pin 2.
I2C: For communicating with the LCD (A4 for SDA, A5 for SCL).
PWM: For fan speed control on pin 9.
Code
// Include necessary libraries
#include <Wire.h> // Required for I2C communication
#include <LiquidCrystal_I2C.h> // Library for I2C LCD display
#include <DHT.h> // Library for DHT sensor
// Create an LCD object with I2C address 0x27 and 16x2 character display
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Define pins
const int lm35Pin = A0; // Analog pin A0 connected to LM35 temperature
sensor
const int fanPin = 9; // PWM digital pin 9 used to control fan speed
void setup() {
// Initialize the LCD display
lcd.init(); // Start the LCD
lcd.backlight(); // Turn on the backlight
void loop() {
// Read analog value from LM35 sensor
int sensorValue = analogRead(lm35Pin); // Read voltage from LM35 (0-1023)
References
ATmega328P Datasheet: To provide documentation for the ADC, PWM,
and digital I/O.
Contribution
This project was done in a group of three students , all work is done together , we first we buyed the
components , we then made all the connections done and then we searched and run the code suitable for our
project