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

OEL Microprocessor Systems

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

EE-416 Microprocessor Systems

Department of Electrical Engineering | The University of Faisalabad

Open Ended Lab

Smart Temperature Monitoring and Control System

Components:

 Arduino Uno R3: The microcontroller that controls the entire system.
 DHT11 Sensor: A low-cost sensor that measures temperature and humidity.
 16x2 LCD Display: Used to display the measured temperature and humidity values.
 Resistors and Jumpers: Used to connect the components together.

Circuit Description:
1. Power Supply: The Arduino Uno R3 and the DHT11 sensor are powered by a 5V power
supply.
2. DHT11 Connection: The DHT11 sensor is connected to the Arduino's digital pin 2. The
DHT11 requires a 10kΩ pull-up resistor connected between the data pin and VCC.
3. LCD Connection: The LCD display is connected to the Arduino's digital pins according
to the standard LCD connection.
4. Communication: The Arduino communicates with the DHT11 sensor through the digital
pin 2 using a specific protocol.
5. Data Processing: The Arduino reads the temperature and humidity data from the DHT11
sensor, processes the data, and then sends it to the LCD display.
6. Display: The LCD displays the measured temperature and humidity values in a user-
friendly format.

Functionality:
1. The Arduino initializes the DHT11 sensor and the LCD display.
2. The Arduino sends a request to the DHT11 sensor to start a measurement.
3. The DHT11 sensor measures the temperature and humidity and sends the data back to the
Arduino.
4. The Arduino receives the data, processes it, and stores the values in variables.
5. The Arduino sends the temperature and humidity values to the LCD display.
6. The LCD displays the received values.
7. The process repeats continuously to provide real-time temperature and humidity readings.

Procedure for Implementing the Temperature and Humidity Monitoring


Circuit

1. Circuit Setup in Proteus:

 Open Proteus software and create a new workspace.


 Place the following components on the virtual breadboard:

 Arduino Uno R3

54
EE-416 Microprocessor Systems
Department of Electrical Engineering | The University of Faisalabad

 DHT11 sensor
 16x2 LCD display
 10kΩ resistor
 Power supply
 Jumpers

 Connect the components according to the circuit diagram:

 Connect the DHT11 sensor's data pin to Arduino's digital pin 2.


 Connect the DHT11 sensor's VCC and GND to the power supply.
 Connect the 10kΩ resistor between the DHT11 sensor's data pin and VCC.
 Connect the LCD display to the Arduino's digital pins as per the standard LCD
connection.
 Connect the Arduino and LCD display to the power supply.

 Wire the circuit connections using jumpers.

2. Arduino Code Implementation:

 Open the Arduino IDE and create a new sketch.


 Include the necessary libraries: DHT.h for DHT sensor and LiquidCrystal.h for LCD.
 Define the DHT sensor type and pin, and LCD pins as constants.
 Create a DHT object using the defined pin and sensor type.
 In the setup() function:

 Initialize the LCD display using lcd.begin().


 Initialize the DHT sensor using dht.begin().

 In the loop() function:

 Read the temperature and humidity from the DHT sensor using
dht.readTemperature() and dht.readHumidity().
 Check if the readings are valid. If not, display an error message on the LCD.
 Clear the LCD and display the temperature and humidity values in a formatted
manner.
 Add a suitable delay to control the refresh rate.

3. Simulation in Proteus:

 Copy the Arduino code into the Arduino microcontroller in the Proteus workspace.
 Power on the circuit in Proteus.
 Observe the LCD display. The temperature and humidity values should be displayed.
 Test the circuit by checking if the readings are accurate and updated periodically.

4. Debugging and Refinement:

 If there are any errors or issues:

 Check the wiring connections for any loose or incorrect connections.

55
EE-416 Microprocessor Systems
Department of Electrical Engineering | The University of Faisalabad

 Verify the code for any syntax errors or logical errors.


 Modify the code or circuit connections as needed to correct the issues.

 Repeat the simulation and testing process until the circuit functions correctly.

Note:

 Make sure to install the DHT.h and LiquidCrystal.h libraries in the Arduino IDE if they
are not already installed.
 You can adjust the delay in the loop() function to control how often the temperature
and humidity are read and displayed.
 This procedure provides a general guideline. The specific steps and code may vary
depending on the exact requirements and implementation details.

By following these steps, you should be able to successfully design, simulate, and implement
the temperature and humidity monitoring circuit using Proteus and Arduino.

Simulation in proteus software:

56
EE-416 Microprocessor Systems
Department of Electrical Engineering | The University of Faisalabad

Code of this circuit:

#include <DHT.h> // Include DHT sensor library


#include <LiquidCrystal.h> // Include LCD library

// Define DHT sensor type and pin


#define DHTTYPE DHT11
#define DHTPIN 2

// Define LCD pins


const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// Create DHT object


DHT dht(DHTPIN, DHTTYPE);

void setup() {
// Initialize LCD
lcd.begin(16, 2);

// Initialize DHT sensor


dht.begin();
}

void loop() {
// Read temperature and humidity from DHT sensor
float tempC = dht.readTemperature();
float hum = dht.readHumidity();

// Check if readings are valid


if (isnan(tempC) || isnan(hum)) {
lcd.print("Failed to read from DHT sensor!");
return;
}

// Display temperature and humidity on LCD


lcd.clear();
lcd.print("Temp: ");
lcd.print(tempC);
lcd.print(" °C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(hum);
lcd.print("%");

delay(2000); // Delay for 2 seconds


}

57

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy