Sei sulla pagina 1di 21

TEMPERATRE

AND
HUMIDITY

DETECTOR
FARAZ ALI
(BEEPF17/0172)

ISRAR ALI
(BEEPF17-0182)

Muhammad Adil
(CMS 1564-2017)

____ Data Structure &Algorthim _________


Lab Title

Ms Mazia Ada
Lab Instructor Name
Faculty of Engineering Sciences and Tech nology
Hamdard Institute of Engineering a n d Technology
Hamdard University, Main Campus, Karachi, Pakistan

Faculty of Engineering Sciences and


Technology

HamdardInstitute of Engineering and


Technology

Hamdard University, Main Campus, Karachi.

CERTIFICATE
This project “Temp & Humiditity Detector ”presented by studentsunder the direction of
Lab Instructor and Theory Teacherhas been presented for partial fulfillment of the
requirementsas a Semester Project for Bachelor of Engineering (Electronics).

FARAZ ALI (Lab Instructor Name: Ms Mazia


(BEEPF17/0172) Ada)

ISRAR ALI
(BEEPF17-0182) (Theory Teacher Name : Ms Mazia
Ada)

Muhammad Adil
(CMS 1564-2017)

ii
ABSTRACT

Due to different weather


around us temperature and
humidity is also exist in
surrounding, this study
aims to control the
temperature and humidity
in a
Room using Arduino Uno
microcontroller

Temperature is a physical
quantity expressing hot and
cold. It is measured with a
thermometer calibrated in
one or more temperature
scales.

Humidity is the amount of


water vapors present in air.
Water vapors, the gaseous
state of water, is generally
invisible to the human eye

Lots of devices are used to


measure the temperature
and humidity which are not
applicable in some
conditions we are using
sensor DHT11 with
Arduino which is very
sensitive to detect and
measure scale of
temperatur
iii
ACKNOWLEDGEMENTS

All praises and thanks to Almighty ”ALLAH”, the most merciful, the most gracious, the
source of knowledge and wisdom endowed to mankind, who conferred us with the power
of mind and capability to take this project to the exciting ocean of knowledge. All
respects are for our most beloved Holy Prophet “HazratMUHAMMAD(Peace Be Upon
Him)”, whose personality will always be source of guidance for humanity.

Acknowledgement is due to Hamdard Institute of Engineering and Technology for


support of this Project, a highly appreciated achievement for us in the undergraduate
level.

We wish to express our appreciation to our Ms Mazia Ada who served as our major
advisor. We would like to express our heartiest gratitude for their keen guidance, sincere
help and friendly manner which inspires us to do well in the project and makes it a
reality.

Many people, especially our classmates and team members itself, have made valuable
comment suggestions on this proposal which gave us an inspiration to improve our
project. We thank Theory Teacher Ms Mazia Ada & all the people for their help
directly and indirectly to complete our project

iv
Table of Contents
Abstract Iii
Acknowledgements Iv

1. INTRODUCTION 1
1.1 Theoretical Background 1
1.2 Literature Review 2
1.3 Problem Statement 2
1.4 Problem Analysis
1.5 --- 1

2. METHODOLOGY 5
2.1 5
2.1.1 6
2.1.2 7
2.2 8
2.3 9

4. RESULTS 10
5. CONCLUSIONS & FUTURE WORKS 11
6. REFERENCES 12
7. APPENDICES (Program Coding, Datasheet etc.) 13

v
CHAPTER 1

INTRODUCTION

DHT11 is a Humidity and Temperature Sensor, which generates calibrated digital output.
DHT11 can be interface with any microcontroller like Arduino, Raspberry Pi, etc. and get
instantaneous results. DHT11 is a low cost humidity and temperature sensor which
provides high reliability and long term stability.

In this project, we will build a small circuit to interface Arduino with DHT11 Temperature
and Humidity Sensor. One of the main applications of connecting DTH11 sensor with
Arduino is weather monitoring.

We have already seen about humidity, relative humidity, humidity sensors and their types
in this article.

1
CIRCUIT DESCRIPTION

We will see the circuit design of DHT11 interfacing with Arduino. The DHT11 Humidity
and Temperature sensor comes in two variants: just the sensor or a module.

The main difference is that the module consists of the pull – up resistor and may also
include a power on LED. We have used a module in this project and if you wish to use the
sensor itself, you need to connect a 5K Ω pull – up resistor additionally.

Coming to the design, the data pin of the DHT11 Sensor is connected to the Pin 11 of
Arduino. A 16 x 2 LCD display is used to display the results. The control pins of LCD i.e.
RS and E (Pins 4 and 6 on LCD) are connected to pins 4 and 5 of Arduino. The data pins of
LCD i.e. D4 to D7 (pins 11 to 14 on LCD) are connected to pins 0 to 3 on LCD.

NOTE: For ease of connection, we have connected the DHT11 Sensor Module at the ICSP
pins of the Arduino as it provides adjacent VCC, DATA and GND pins. This type of
connection is not necessary and you can connect the data pin of sensor to normal Digital
I/O pins

Issue Statement

one or two sentences that describe the problem using specific issues. It is not a "lack of a
solution" statement. For example, our problem is that we don't have an ERP system.
Method - the process that will get followed to solve the problem

Problem analysis
is focused on identifying cause and effect. It can be very difficult to determine what is
cause and what is effect. For example, a problem that initially looks like a human error
may be a latent human error that is the result of a poorly designed user interface, system or
process.

2
Circuit Diagram
The following circuit diagram shows all the necessary connections required to implement
this project.

Components Required

 DHT11 Temperature and Humidity Sensor


 Breadboard (or perfboard)
 Power supply
 16 x 2 LCD Display
 10K Ohm Potentiometer
 5K Ohm Resistor (1/4 W)
 Connecting wires
 Arduino UNO

3
Component Description

DHT11 Temperature and Humidity Sensor

DHT11 is a part of DHTXX series of Humidity sensors. The other sensor in this series is
DHT22. Both these sensors are Relative Humidity (RH) Sensor. As a result, they will
measure both the humidity and temperature. Although DHT11 Humidity Sensors are cheap
and slow, they are very popular among hobbyists and beginners.

The DHT11 Humidity and Temperature Sensor consists of 3 main components. A resistive
type humidity sensor, an NTC (negative temperature coefficient) thermistor (to measure the
temperature) and an 8-bit microcontroller, which converts the analog signals from both the
sensors and sends out single digital signal.

This digital signal can be read by any microcontroller or microprocessor for further
analysis.

DHT11 Humidity Sensor consists of 4 pins: VCC, Data Out, Not Connected (NC) and
GND. The range of voltage for VCC pin is 3.5V to 5.5V. A 5V supply would do fine. The
data from the Data Out pin is a serial digital data.

4
The following image shows a typical application circuit for DHT11 Humidity and
Temperature Sensor. DHT11 Sensor can measure a humidity value in the range of 20 –
90% of Relative Humidity (RH) and a temperature in the range of 0 – 500C. The sampling
period of the sensor is 1 second i.e.

All the DHT11 Sensors are accurately calibrated in the laboratory and the results are stored
in the memory. A single wire communication can be established between any
microcontroller like Arduino and the DHT11 Sensor.

Also, the length of the cable can be as long as 20 meters. The data from the sensor consists
of integral and decimal parts for both Relative Humidity (RH) and temperature.

The data from the DHT11 sensor consists of 40 – bits and the format is as follows:

8 – Bit data for integral RH value, 8 – Bit data for decimal RH value, 8 – Bit data for
integral Temperature value, 8 – Bit data for integral Temperature value and 8 – Bit data for
checksum.

Example

Consider the data received from the DHT11 Sensor is

00100101 00000000 00011001 00000000 00111110.

This data can be separated based on the above mentioned structure as follows

5
In order to check whether the received data is correct or not, we need to perform a small
calculation. Add all the integral and decimals values of RH and Temperature and check
whether the sum is equal to the checksum value i.e. the last 8 – bit data.

00100101 + 00000000 + 00011001 + 00000000 = 00111110

This value is same as checksum and hence the received data is valid. Now to get the RH
and Temperature values, just convert the binary data to decimal data.

RH = Decimal of 00100101 = 37%

Temperature = Decimal of 00011001 = 250C

Working of the Project


A simple project is built using Arduino UNO and DHT11 Humidity and Temperature
Sensor, where the Humidity and Temperature of the surroundings are displayed on an LCD
display.

After making the connections, we need not do anything as the program will take care of
everything. Although there is a special library for the DHT11 module called “DHT”, we
didn’t use it. If you want to use this library, you need to download this library separately
and add it to the existing libraries of Arduino.

The program written is based on the data timing diagrams provided in the datasheet. The
program will make the Arduino to automatically read the data from the sensor and display
it as Humidity and Temperature on the LCD Display.

6
Specification of DHT11

 It has humidity range from 20 to 90% RH


 It has temperature range from 0 – 50 C
 It has signal transmission range of 20 m
 It is inexpensive
 It has fast response and it is also durable

DHT11 Pin out

 The first pin of the DHT11 is vcc pin.


 The second pin of the DHT is Data pin.
 The third pin is not used.
 The fourth pin of the DHT sensor is ground.

DHT11 interfacing with arduino

First of all connect the ground and the VCC of the DHT11 temperature and humidity
sensor to the ground and 5v of the Arduino. Then connect the data pin of the DHT11
sensor to the pin 2 of the Arduino.

7
First of all connect the ground and the VCC of the DHT11 temperature and humidity
sensor to the ground and 5v of the Arduino. Then connsensor to the pin 2 of the Arduino.

Installing the DHT11 Library

To run the following code in Arduino IDE you will first have to install the DHT library in
you Arduino directory.

Download the zip file from here and place it in your Arduino library folder. The path to
Arduino library folder for my computer is

Documents/ Arduino/ Libraries

Unzip the downloaded file and place it in this folder.

After copying the files, the Arduino library folder should have a new folder named DHT
containing the dht.h and dht.cpp. After that copy the following code in the Arduino IDE
and upload the code.

8
DHT11 / DHT22 Working Principle

Ok now let’s see how these sensors actually work. They consist of a humidity sensing
component, a NTC temperature sensor (or thermistor) and an IC on the back side of the
sensor.

For measuring humidity they use the humidity sensing component which has two
electrodes with moisture holding substrate between them. So as the humidity changes, the
conductivity of the substrate changes or the resistance between these electrodes changes.
This change in resistance is measured and processed by the IC which makes it ready to be
read by a microcontroller.

9
On the other hand, for measuring temperature these sensors use a NTC temperature sensor
or a thermistor.

A thermistor is actually a variable resistor that changes its resistance with change of the
temperature. These sensors are made by sintering of semiconductive materials such as
ceramics or polymers in order to provide larger changes in the resistance with just small
changes in temperature. The term “NTC” means “Negative Temperature Coefficient”,
which means that the resistance decreases with increase of the temperature.

10
The DHTxx sensors have four pins, VCC, GND, data pin and a not connected pin which
has no usage. A pull-up resistor from 5K to 10K Ohms is required to keep the data line
high and in order to enable the communication between the sensor and the Arduino Board.
There are some versions of these sensors that come with a breakout boards with built-in
pull-up resistor and they have just 3 pins.

The DHTXX sensors have their own single wire protocol used for transferring the data.
This protocol requires precise timing and the timing diagrams for getting the data from the
sensors can be found from the datasheets of the sensors. However, we don’t have to worry
much about these timing diagrams because we will use the DHT library which takes care of
everything.

11
CODE

#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 5, 0, 1, 2, 3);
byte degree_symbol[8] =
{ 0b00111,
0b00101,
0b00111,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
int gate=11;
volatile unsigned long duration=0;
unsigned char i[5];
unsigned int j[40];
unsigned char value=0;
unsigned answer=0;
int z=0;
int b=1;
void setup()
{

lcd.begin(16, 2);
lcd.print("Temp = ");
lcd.setCursor(0,1);
lcd.print("Humidity = ");
lcd.createChar(1, degree_symbol);

12
lcd.setCursor(9,0);
lcd.write(1);
lcd.print("C");
lcd.setCursor(13,1);
lcd.print("%");
}

void loop()
{

delay(1000);
while(1)
{
delay(1000);
pinMode(gate,OUTPUT);
digitalWrite(gate,LOW);
delay(20);
digitalWrite(gate,HIGH);
pinMode(gate,INPUT_PULLUP);//by default it will become high due to internal pull up
// delayMicroseconds(40);

duration=pulseIn(gate, LOW);
if(duration <= 84 && duration >= 72)
{
while(1)
{
duration=pulseIn(gate, HIGH);

if(duration <= 26 && duration >= 20){


value=0;}

else if(duration <= 74 && duration >= 65){


value=1;}

13
else if(z==40){
break;}

i[z/8]|=value<<(7- (z%8));
j[z]=value;
z++;
}
}
answer=i[0]+i[1]+i[2]+i[3];

if(answer==i[4] && answer!=0)


{
lcd.setCursor(7,0);
lcd.print(i[2]);
lcd.setCursor(11,1);
lcd.print(i[0]);
}

z=0;
i[0]=i[1]=i[2]=i[3]=i[4]=0;
}
}

14
Applications

 DHT11 Relative Humidity and Temperature Sensor can be used in many


applications like:
 HVAC (Heating, Ventilation and Air Conditioning) Systems
 Weather Stations
 Medical Equipment for measuring humidity
 Home Automation Systems
 Automotive and other weather control applications

REFERENCE
https://www.electronicshub.org/dht11-humidity-sensor-
arduino/?fbclid=IwAR1XMUrHfPeU28F153GzXYKzY_s922pWPhI07hcWEg-
ojyhnYovEQzNPtZo

15
Due to different weather
around us temperature
and humidity is also exist
in surrounding, this study
aims to control the
temperature and humidity
in a
Room using Arduino Uno
microcontroller

Temperature is a physical
quantity expressing hot and
cold. It is measured with a
thermometer calibrated in
one or more temperature
scales.

Humidity is the amount of


water vapors present in air.
Water vapors, the gaseous
state of water, is generally
invisible to the human eye

Lots of devices are used to


measure the temperature
and humidity which are not
applicable in some
conditions we are using
sensor DHT11 with
Arduino which is very
sensitive to detect and
measure scale of
temperatur

16

Potrebbero piacerti anche