Temp DHT11
Temp DHT11
Temp DHT11
Programme: B.Tech(ECE)
BECE351E - Internet of Things (IoT) Lab
Lab Sheet 6
Temperature and Humidity Display using DHT11 and
Arduino
Name of the student: ANUBHAB BHATTACHARYYA
Reg. No.: 21BEC1848
Date of the Lab. Class: 22/06/2023
AIM:
To develop a Temperature and Humidity Display Hardware System using Arduino IDE
software and DHT11.
SOFTWARE USED: Arduino IDE
COMPONENTS USED:
1. Arduino board
2. DHT11
3. Wires
THEORY:
The DHT11 is a digital sensor that lets us easily get relative humidity and temperature
readings in our projects. Because of their low cost and small size, DHT11 sensors are perfect
for lots of different DIY electronics projects. Some projects where the DHT11 would be
useful include remote weather stations, home environment control systems, and
agricultural/garden monitoring systems.
CODE:
#include <dht.h>
dht DHT;
#define DHT11_PIN 7
void setup(){
Serial.begin(9600);
void loop(){
Serial.print(“Temperature=”);
Serial.println(DHT.temperature);
Serial.print(“Humidity=”);
Serial.println(DHT.humidity);
Delay(1000);
}
CODE EXPLANATION:
This code snippet demonstrates the setup and loop functions for reading temperature and
humidity values using the DHT11 sensor and Arduino. In the setup function, the code
initializes the serial communication at a baud rate of 9600. This allows the Arduino to
communicate with the computer through the serial monitor. In the loop function, the code
first declares an integer variable 'chk' to store the result of the DHT11 sensor reading. The
'read11' function is then called, passing the DHT11_PIN as an argument, to read the
temperature and humidity values from the sensor.Next, the temperature and humidity values
are printed to the serial monitor using the 'Serial.print' and 'Serial.println' functions. The
temperature value is displayed with the label "Temperature=" and the humidity value with the
label "Humidity=". Finally, the 'delay' function is used to introduce a 1-second delay between
sensor readings. This ensures that the temperature and humidity values are updated at regular
intervals.
Overall, this code continuously reads temperature and humidity values from the DHT11
sensor and prints them to the serial monitor with appropriate labels, allowing you to monitor
the environmental conditions in real-time.
1. All the components are properly wired according to the provided circuit diagram.
2. Once the wiring is complete, we launch the Arduino IDE.
3. The code is then entered and compiled.
4. After successful compilation without any errors, the Serial Monitor is accessed from
the tool’s menu.
5. The DHT11 detects the temperature and humidity in the surroundings and then gives
the output as per the situation.
HARDWARE CIRCUIT:
OUTPUT:
INFERENCE:
The experiment was conducted successfully using DHT11 and Arduino IDE software,
resulting in accurate outputs corresponding to the provided inputs. The experiment involved
utilizing the software and hardware setup to detect Temperature and Humidity , and the
expected results were obtained. The software interface and physical components effectively
facilitated the experiment's execution, leading to the desired outcome.