0% found this document useful (0 votes)
22 views7 pages

Iot 7-8

The document describes using a DHT11 sensor to sense humidity and temperature and display the output on the Arduino serial monitor. It details the components, hardware, software, schematic, code and output of the program.

Uploaded by

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

Iot 7-8

The document describes using a DHT11 sensor to sense humidity and temperature and display the output on the Arduino serial monitor. It details the components, hardware, software, schematic, code and output of the program.

Uploaded by

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

PRACTICAL NO.

-7
 AIM: Write a program to sense the humidity & temperature of the room using DHT – 11
sensor & display the output on the serial monitor.

 THEORY:
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, anti-
interference ability, and cost- effectiveness.
The DHT11 module has a total of 3 pins. In which two are for power and one is
forcommunication. The pinout of a DHT11 Sensor module is as follows:

1. DATA – Data pin for 1-wire communication.


2. GND – Ground Connected to Ground pin of the Arduino.
3. VCC – Provides power for the module, Connect to the 5V pin of the Arduino.

The humidity sensing component consists of a moisture-holding substrate sandwiched in


between two electrodes. When the substrate absorbs water content, the resistance between
the two electrodes decreases. The change in resistance between the two electrodes is
proportional to the relative humidity. Higher relative humidity decreases the resistance
between the electrodes, while lower relative humidity increases the resistance between the
electrodes. This change in resistance is measured with the onboard MCU’s ADC and the
relative humidity is calculated.

 COMPONENTS REQUIRED:

 HARDWARE REQUIREMENTS:
1. Arduino Board: Choose an appropriate Arduino board based on your project
requirements. Popular options include Arduino Uno, Arduino Nano, or Arduino Mega.
The Arduino board will serve as the control unit for the relay.
2. DHT11 sensor: For sensing the changes in temperature & humidity of
surroundings.
3. Resistor: A current-limiting resistor for the LED to prevent excessive current flow.
4. Breadboard: Optional but recommended for prototyping and connecting the
components.
5. Jumper Wires: Use jumper wires to establish connections between the Arduino board,
relay module, and LED. Ensure that you have a variety of male-to-male, male-to-
female, and female-to-female jumper wires to make the necessary connections.
 SOFTWARE REQUIREMENTS:
Arduino IDE: The open-source Arduino Software (IDE) makes it easy to write code and
upload it to the board. This software can be used with any Arduino board.
HANUMANT SINGH NEGI(01015007722) 23
 SCHEMATIC DIAGRAM:

 CIRCUIT DIAGRAM:

HANUMANT SINGH NEGI(01015007722) 24


 CODE:

#include "DHT.h"
#define DHTPIN 6
#define DHTTYPE DHT11
DHT dht(DHTPIN,
DHTTYPE);

void setup() {
Serial.begin(9600);
Serial.println("DHT
test!");dht.begin();
}

void loop()
{
delay(200
0);
float h =
dht.readHumidity(); float t =
dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT
sensor!");return;
}
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h,
false);Serial.print ("Humidity: ");
Serial.print (h);
Serial.print (" %\t");
Serial.print ("Temperature:
");Serial.print (t);
Serial.print (" *C ");
Serial.print (f);
Serial.print (" *F\t");
Serial.print ("Heat index:
");Serial.print (hic);
Serial.print (" *C ");
Serial.print (hif);
Serial.println (" *F");
}

HANUMANT SINGH NEGI(01015007722) 25


 OUTPUT:

 SERIAL MONITOR:

HANUMANT SINGH NEGI(01015007722) 26


PRACTICAL NO. -8
 AIM: Write a program to detect obstacle/unauthorized object using IR & Ultrasonic sensor
& display the appropriate notifications on serial monitor.

 THEORY:
IR sensor is an electronic device, that emits the light in order to sense some object of the
surroundings. An IR sensor can measure the heat of an object as well as detects the motion.
Usually, in the infrared spectrum, all the objects radiate some form of thermal radiation.
These types of radiations are invisible to
our eyes, but infrared sensor can detect
these radiations. The emitter is simply an
IR LED (Light Emitting Diode) and the
detector is simply an IR photodiode .
Photodiode is sensitive to IR light of the
same wavelength which is emitted by the
IR LED. When IR light falls on the
photodiode, the resistances and the
output voltages will change in proportion
to the magnitude of the IR light received.
There are five basic elements used in a
typical infrared detection system: an infrared source, a transmission medium, optical
component, infrared detectors or receivers and signal processing. Infrared lasers and
Infrared LED’s of specific wavelength used as infrared sources.

 COMPONENTS REQUIRED:

 HARDWARE REQUIREMENTS:
1. IR sensor: For sensing the changes in surroundings. Resistor: A current-limiting resistor
for the LED to prevent excessive current flow.
2. Arduino Board: Choose an appropriate Arduino board based on your project
requirements. Popular options include Arduino Uno, Arduino Nano, or Arduino Mega.
The Arduino board will serve as the control unit for the relay.
3. Resistor: A current-limiting resistor for the LED to prevent excessive current flow.
4. Breadboard: Optional but recommended for prototyping and connecting the components.
5. Jumper Wires: Use jumper wires to establish connections between the Arduino board,
relay module, and LED. Ensure that you have a variety of male-to-male, male-to-female,
and female-to-female jumper wires to make the necessary connections.

 SOFTWARE REQUIREMENTS:
Arduino IDE: The open-source Arduino Software (IDE) makes it easy to write code and
upload it to the board. This software can be used with any Arduino board.

HANUMANT SINGH NEGI(01015007722) 27


 SCHEMATIC DIAGRAM:

 CIRCUIT DIAGRAM:

 CODE:
1. int ir = 2;
2. int PinLed = 10;
3. int val=0;
4. void setup()
5. {
6. pinMode(ir, INPUT);
7. pinMode(PinLed, OUTPUT);
8. }
9. void loop()
10. {
11. if(digitalRead(ir) == LOW) }
12. digitalWrite(PinLed, HIGH);
13. else { digitalWrite(PinLed, LOW); } }
HANUMANT SINGH NEGI(01015007722) 28
 OUTPUT:

(WHEN NO OBJECT DETECTED) ( WHEN ANY OBJECT DETECTED)

 SERIAL MONITOR:

HANUMANT SINGH NEGI(01015007722) 29

You might also like