Interfacing DHT11 Humdity & Temperature Sensor with Arduino & LCD
Interfacing DHT11 Humidity Temperature Sensor with Arduino & LCD Display; DHT11 Specifications, Features, Pinout, working, construction & Code
- Suitable forB.Tech/Diploma Arduino students
- Build time1-2 weeks
- LevelBeginner
- Available atAjvika Labs, Kakinada
About this project
Introduction
In this tutorial, we will be interfacing
DHT11 Humidity Temperature Sensor
with
Arduino
and a
16×2 LCD Display
Understanding and
monitoring environmental conditions
are crucial for various applications, ranging from ensuring comfort in living spaces to optimizing conditions in controlled environments. In this project, we introduce a
digital humidity and temperature meter,
which leverages the capabilities of the
DHT11 Humidity & Temperature Sensor
in conjunction with an
Arduino microcontroller
. Not only will you gain insights into the precise temperature and humidity levels of your surroundings, but you’ll also be presented with these metrics on a user-friendly
LCD display
The DHT11 Temperature and Humidity Sensor is an advanced piece of equipment that boasts a calibrated
digital signal output
, thanks to its integrated temperature and humidity sensor complex. Engineered for utmost reliability, it ensures commendable
long-term stability
. At the heart of this sensor lies an efficient 8
-bit microcontroller
. The DHT11 sensor is meticulously designed, featuring a r
esistive element
and a wet
NTC temperature
measuring component. With attributes like rapid response, stellar anti-interference capabilities, and exceptional value for money, it’s a top choice for DIY enthusiasts and professionals alike.
Components Required
The following are the components required for this tutorial
S.N.
Components
Quantity
Purchase Link
Arduino UNO Board
Amazon
AliExpress
SunFounder
DHT11 Humidity Temperature Sensor
Amazon
AliExpress
SunFounder
16X2 I2C LCD Display
Amazon
AliExpress
SunFounder
Breadboard
Amazon
AliExpress
SunFounder
Jumper Wires
Amazon
AliExpress
SunFounder
DHT11 Humidity Temperature Sensor
The
DHT11
is a commonly used and cost-effective sensor that provides readings of both
temperature
and
humidity
. Compact and cost-effective, it has become a popular choice in the electronics community for its
relative accuracy
and ease of integration. Operating on a simple
one-wire communication protocol
, the DHT11 can be seamlessly interfaced with a variety of
microcontrollers
, making it suitable for a wide range of applications.
Developed for digital systems, the DHT11 finds its applications in environments where there’s a need to monitor or control atmospheric conditions, such as in smart homes,
weather stations
, and
agricultural monitoring systems
Features/Specifications of DHT11 Sensor
Power Supply:
Typically operates from 3.3 to 5V DC, making it suitable for interfacing with most microcontrollers.
Temperature Range:
0°C to 50°C with ±2°C accuracy.
Humidity Range:
20% to 90% RH (Relative Humidity) with ±5% accuracy.
Output:
Calibrated digital signal. It employs a single-wire communication protocol which simplifies integration with microcontroller systems.
Sampling Period:
Suggested minimum time of 1 second between readings to ensure sensor accuracy.
Dimensions:
Compact size, often available in a 4-pin single-row package.
Longevity:
Offers excellent long-term stability, thanks to its calibrated digital output.
Construction of DHT11 Sensor
Sensing Elements:
The DHT11 integrates two primary components for its operations:
A thermistor for temperature measurements.
A capacitive humidity sensor for gauging atmospheric moisture.
IC Integration:
An 8-bit microcontroller reads the outputs from the two sensors and translates them into a format suitable for digital systems.
Packaging:
The sensor elements are often encased in a plastic casing, which ensures protection against environmental factors while still allowing for accurate readings.
Working of DHT11 Sensor
Temperature Measurement:
The core of the temperature sensing capability is the thermistor, a type of resistor whose resistance changes with temperature. As the temperature fluctuates, so does the resistance of the thermistor. This variance is then read and converted into temperature values by the onboard microcontroller.
Humidity Measurement:
The capacitive humidity sensor operates by having a dielectric material between two plates. As humidity changes, the dielectric constant of the material changes, leading to a variance in capacitance. This change in capacitance is then read and interpreted as a humidity percentage by the onboard microcontroller.
Signal Output:
After the microcontroller processes the readings, the data is sent as a digital signal through a single-wire communication protocol. This digital output can then be easily read by microcontrollers such as Arduino, making integration and data interpretation straightforward.
Pinout of DHT11 Sensor
The DHT11 typically comes with a 4-pin package, although only three of them are functionally used:
VCC (Pin 1):
This is the power supply pin, which can accept voltages from 3.3V to 5V, making it compatible with most microcontroller systems.
Data (Pin 2):
This is the pin through which the DHT11 communicates. It uses a proprietary single-wire protocol to transmit temperature and humidity data to the connected microcontroller.
NC (Pin 3):
Not connected or used.
GND (Pin 4):
Ground pin, used to complete the circuit.
Interfacing DHT11 Sensor with Arduino
Let us interface the DHT11 Humidity Temperature Sensor with Arduino UNO.
Hardware Connection
The connection diagram is pretty simple as shown in the image below.
Connect the VCC & GND Pin of DHT11 Sensor Module to 3.3V & GND pin of Arduino respectively. Similarly connect the DHT11 Data pin to Arduino Digital Pin 2.
You can use a jumper wire & connect the sensor with Arduino Board.
Source Code/Program
After hardware connection is done, you can move to the coding part of this project. First we need to install the DHT11 Sensor library. Download the DHT11 Sensor library from following link and add it to the Arduino Library Folder.
Download:
DHT11 Sensor Library
Here is a complete code for interfacing DHT11 Sensor with Arduino. Copy the following code and paste it on your Arduino IDE editor window.
#include "DHT.h"
#define DHTPIN 2 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11
DHT
dht
(
DHTPIN
DHTTYPE
)
;
void
setup
(
)
{
Serial
begin
(
9600
)
;
dht
begin
(
)
;
}
void
loop
(
)
{
// Wait a few seconds between measurements.
delay
(
2000
)
;
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float
h
=
dht
readHumidity
(
)
;
// Read temperature as Celsius (the default)
float
t
=
dht
readTemperature
(
)
;
// Read temperature as Fahrenheit (isFahrenheit = true)
float
f
=
dht
readTemperature
(
true
)
;
// Check if any reads failed and exit early (to try again).
if
(
isnan
(
h
)
||
isnan
(
t
)
||
isnan
(
f
)
)
{
Serial
println
(
F
(
"Failed to read from DHT sensor!"
)
)
;
return
;
}
// Compute heat index in Fahrenheit (the default)
float
hif
=
dht
computeHeatIndex
(
f
h
)
;
// Compute heat index in Celsius (isFahreheit = false)
float
hic
=
dht
computeHeatIndex
(
t
h
false
)
;
Serial
(
F
(
"Humidity: "
)
)
;
Serial
(
h
)
;
Serial
(
F
(
"% Temperature: "
)
)
;
Serial
(
t
)
;
Serial
(
F
(
"°C "
)
)
;
Serial
(
f
)
;
Serial
(
F
(
"°F Heat index: "
)
)
;
Serial
(
hic
)
;
Serial
(
F
(
"°C "
)
)
;
Serial
(
hif
)
;
Serial
println
(
F
(
"°F"
)
)
;
}
To upload this code, Select Arduino UNO from Board Manager and the COM port. Then you can click on upload button to upload the code.
After uploading the code, open the Serial Monitor.
The Serial Monitor will display the temperature readings in degree Celcius as well as Fahrenheit. It will also show the value of Humidity and Heat Index.
Interfacing DHT11 Sensor with Arduino & LCD Display
Using the above
In this tutorial, we will be interfacing
DHT11 Humidity Temperature Sensor
with
Arduino
and a
16×2 LCD Display
Understanding and
monitoring environmental conditions
are crucial for various applications, ranging from ensuring comfort in living spaces to optimizing conditions in controlled environments. In this project, we introduce a
digital humidity and temperature meter,
which leverages the capabilities of the
DHT11 Humidity & Temperature Sensor
in conjunction with an
Arduino microcontroller
. Not only will you gain insights into the precise temperature and humidity levels of your surroundings, but you’ll also be presented with these metrics on a user-friendly
LCD display
The DHT11 Temperature and Humidity Sensor is an advanced piece of equipment that boasts a calibrated
digital signal output
, thanks to its integrated temperature and humidity sensor complex. Engineered for utmost reliability, it ensures commendable
long-term stability
. At the heart of this sensor lies an efficient 8
-bit microcontroller
. The DHT11 sensor is meticulously designed, featuring a r
esistive element
and a wet
NTC temperature
measuring component. With attributes like rapid response, stellar anti-interference capabilities, and exceptional value for money, it’s a top choice for DIY enthusiasts and professionals alike.
Components Required
The following are the components required for this tutorial
S.N.
Components
Quantity
Purchase Link
Arduino UNO Board
Amazon
AliExpress
SunFounder
DHT11 Humidity Temperature Sensor
Amazon
AliExpress
SunFounder
16X2 I2C LCD Display
Amazon
AliExpress
SunFounder
Breadboard
Amazon
AliExpress
SunFounder
Jumper Wires
Amazon
AliExpress
SunFounder
DHT11 Humidity Temperature Sensor
The
DHT11
is a commonly used and cost-effective sensor that provides readings of both
temperature
and
humidity
. Compact and cost-effective, it has become a popular choice in the electronics community for its
relative accuracy
and ease of integration. Operating on a simple
one-wire communication protocol
, the DHT11 can be seamlessly interfaced with a variety of
microcontrollers
, making it suitable for a wide range of applications.
Developed for digital systems, the DHT11 finds its applications in environments where there’s a need to monitor or control atmospheric conditions, such as in smart homes,
weather stations
, and
agricultural monitoring systems
Features/Specifications of DHT11 Sensor
Power Supply:
Typically operates from 3.3 to 5V DC, making it suitable for interfacing with most microcontrollers.
Temperature Range:
0°C to 50°C with ±2°C accuracy.
Humidity Range:
20% to 90% RH (Relative Humidity) with ±5% accuracy.
Output:
Calibrated digital signal. It employs a single-wire communication protocol which simplifies integration with microcontroller systems.
Sampling Period:
Suggested minimum time of 1 second between readings to ensure sensor accuracy.
Dimensions:
Compact size, often available in a 4-pin single-row package.
Longevity:
Offers excellent long-term stability, thanks to its calibrated digital output.
Construction of DHT11 Sensor
Sensing Elements:
The DHT11 integrates two primary components for its operations:
A thermistor for temperature measurements.
A capacitive humidity sensor for gauging atmospheric moisture.
IC Integration:
An 8-bit microcontroller reads the outputs from the two sensors and translates them into a format suitable for digital systems.
Packaging:
The sensor elements are often encased in a plastic casing, which ensures protection against environmental factors while still allowing for accurate readings.
Working of DHT11 Sensor
Temperature Measurement:
The core of the temperature sensing capability is the thermistor, a type of resistor whose resistance changes with temperature. As the temperature fluctuates, so does the resistance of the thermistor. This variance is then read and converted into temperature values by the onboard microcontroller.
Humidity Measurement:
The capacitive humidity sensor operates by having a dielectric material between two plates. As humidity changes, the dielectric constant of the material changes, leading to a variance in capacitance. This change in capacitance is then read and interpreted as a humidity percentage by the onboard microcontroller.
Signal Output:
After the microcontroller processes the readings, the data is sent as a digital signal through a single-wire communication protocol. This digital output can then be easily read by microcontrollers such as Arduino, making integration and data interpretation straightforward.
Pinout of DHT11 Sensor
The DHT11 typically comes with a 4-pin package, although only three of them are functionally used:
VCC (Pin 1):
This is the power supply pin, which can accept voltages from 3.3V to 5V, making it compatible with most microcontroller systems.
Data (Pin 2):
This is the pin through which the DHT11 communicates. It uses a proprietary single-wire protocol to transmit temperature and humidity data to the connected microcontroller.
NC (Pin 3):
Not connected or used.
GND (Pin 4):
Ground pin, used to complete the circuit.
Interfacing DHT11 Sensor with Arduino
Let us interface the DHT11 Humidity Temperature Sensor with Arduino UNO.
Hardware Connection
The connection diagram is pretty simple as shown in the image below.
Connect the VCC & GND Pin of DHT11 Sensor Module to 3.3V & GND pin of Arduino respectively. Similarly connect the DHT11 Data pin to Arduino Digital Pin 2.
You can use a jumper wire & connect the sensor with Arduino Board.
Source Code/Program
After hardware connection is done, you can move to the coding part of this project. First we need to install the DHT11 Sensor library. Download the DHT11 Sensor library from following link and add it to the Arduino Library Folder.
Download:
DHT11 Sensor Library
Here is a complete code for interfacing DHT11 Sensor with Arduino. Copy the following code and paste it on your Arduino IDE editor window.
#include "DHT.h"
#define DHTPIN 2 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11
DHT
dht
(
DHTPIN
DHTTYPE
)
;
void
setup
(
)
{
Serial
begin
(
9600
)
;
dht
begin
(
)
;
}
void
loop
(
)
{
// Wait a few seconds between measurements.
delay
(
2000
)
;
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float
h
=
dht
readHumidity
(
)
;
// Read temperature as Celsius (the default)
float
t
=
dht
readTemperature
(
)
;
// Read temperature as Fahrenheit (isFahrenheit = true)
float
f
=
dht
readTemperature
(
true
)
;
// Check if any reads failed and exit early (to try again).
if
(
isnan
(
h
)
||
isnan
(
t
)
||
isnan
(
f
)
)
{
Serial
println
(
F
(
"Failed to read from DHT sensor!"
)
)
;
return
;
}
// Compute heat index in Fahrenheit (the default)
float
hif
=
dht
computeHeatIndex
(
f
h
)
;
// Compute heat index in Celsius (isFahreheit = false)
float
hic
=
dht
computeHeatIndex
(
t
h
false
)
;
Serial
(
F
(
"Humidity: "
)
)
;
Serial
(
h
)
;
Serial
(
F
(
"% Temperature: "
)
)
;
Serial
(
t
)
;
Serial
(
F
(
"°C "
)
)
;
Serial
(
f
)
;
Serial
(
F
(
"°F Heat index: "
)
)
;
Serial
(
hic
)
;
Serial
(
F
(
"°C "
)
)
;
Serial
(
hif
)
;
Serial
println
(
F
(
"°F"
)
)
;
}
To upload this code, Select Arduino UNO from Board Manager and the COM port. Then you can click on upload button to upload the code.
After uploading the code, open the Serial Monitor.
The Serial Monitor will display the temperature readings in degree Celcius as well as Fahrenheit. It will also show the value of Humidity and Heat Index.
Interfacing DHT11 Sensor with Arduino & LCD Display
Using the above
Technologies used
Hardware components
- Arduino
- DHT11
Software & tools
- Arduino IDE
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.