0% found this document useful (0 votes)
9 views

Iotexp 6

how sensors work

Uploaded by

Aradhika Thakur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Iotexp 6

how sensors work

Uploaded by

Aradhika Thakur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

EXPERIMENT - 6

Student Name: ARADHIKA UID: 22BCS15907


Branch: CSE Section/Group: 622-B
Semester: 5 Date of Performance: 27.09.24
Subject Name: IOT LAB Subject Code: 22CSP-329

1. Aim: To Investigate real-time relationship between humidity and temperature in IoT.


2.Objective:

An DHT11 Module features a temperature & humidity sensor complex with a calibrated digital
signal output. The exclusive digital-signal-acquisition technique and temperature and humidity
sensing technology ensure high reliability and excellent long-term stability.

3.Input/Equipment Used:
1.Arduino Board
2. Breadboard
3. Jumper Wires
4. DH11 Temperature and Humidity Sensor

4.Script:
About DH11 Sensor: DHT11 Module features a temperature & humidity sensor complex with a
calibrated digital signal output. The exclusive digital-signal-acquisition technique and temperature
& humidity sensing technology ensure high reliability and excellent long-term stability. This sensor
includes an NTC for temperature measurement and a resistive-type humidity measurement
component for humidity measurement. These are connected to a high-performance 8-bit
microcontroller, offering excellent quality, fast response, antiinterference ability, and cost-
effectiveness.
Procedure:
1. Install the DHT11 library in the Arduino IDE.
2. Open a new sketch and include the DHT.h library in the code.
3. Define the pin for the data connection (digital pin 2).
4. Initialize the DHT11 sensor using the DHT class.
5. In the setup() function, begin serial communication for displaying data.
6. In the loop() function, read humidity and temperature data from the DHT11 sensor.
7. Display the temperature and humidity values on the serial monitor.
Connections:
o Connect the VCC pin of DHT11 to the 5V pin of Arduino.
o Connect the GND pin of DHT11 to the GND pin of Arduino.
o Connect the DATA pin of DHT11 to the digital pin 2 of Arduino.
o Add a pull-up resistor (typically 10kΩ) between the DATA pin and VCC.
o Ensure proper filtering with a bypass capacitor between VCC and GND
Code-
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
delay(2000);
}

5. Learning Outcomes:
• Understand how to interface the DHT11 sensor with an Arduino for measuring temperature
and humidity.
• Learn how to read sensor data and display on Arduino monitor in real time.
• Gain experience in creating basic environmental monitoring systems for IoT applications.

You might also like