IOT Assignmenet
IOT Assignmenet
Report of
“DHT22 Sensor for Measuring Temperature and Humidity with the Arduino Board”
VIII Semester
Section - C
Submitted By
Mr. Jagadish P
Assistant Professor
Department of CSE
2023-2024
CHAPTER 1
INTRODUCTION
The DHT22 sensor is a versatile device widely used for measuring temperature and humidity
in various applications. When combined with an Arduino board, it becomes a powerful tool
for environmental monitoring, climate control, and data logging projects. This report provides
an overview of the DHT22 sensor, its features, and how to interface it with an Arduino board
for temperature and humidity measurement.
1.1 Overview
The DHT22 is the more expensive version which has better specifications. Its temperature
measuring range is from -40 to +125 degrees Celsius with +-0.5 degrees accuracy, while the
DHT11 temperature range is from 0 to 50 degrees Celsius with +-2 degrees accuracy. Also,
the DHT22 sensor has a better humidity measuring range, from 0 to 100% with 2-5%
accuracy, while the DHT11 humidity range is from 20 to 80% with 5% accuracy
The DHT22 sensor, also known as the AM2302, is a digital sensor manufactured by Aosong
Electronics. It utilizes a capacitive humidity sensor and a thermistor to measure relative
humidity and temperature, respectively. It operates on a wide voltage range (3.3V - 6V) and
communicates via a single-wire digital interface, making it easy to integrate into
microcontroller-based projects.
DHT22 Sensor for Measuring Temperature and Humidity with the Arduino Board CHAPTER 1
The DHT22 / AM2302 is more accurate and better over a larger range of temperatures, and
the complete range of relative humidity. Some of its features are listed below:
There are two versions of the DHT sensor, which look a bit similar and have the same pinout,
but have different characteristics. A comparison between these two sensors are shown below:
There are two specifications where the DHT11 is better than the DHT22. That’s the sampling
rate which for the DHT11 is 1Hz or one reading every second, while the DHT22 sampling
rate is 0.5Hz or one reading every two seconds, and also the DHT11 has a smaller body size.
The operating voltage of both sensors is from 3 to 5 volts, while the max current used when
measuring is 2.5 mA.
WORKING PRINCIPLE
The DHT22 sensor operates based on the principles of capacitive humidity sensing and
resistance temperature detection. They consist of a humidity-sensing component, an 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.
On the other hand, for measuring temperature these sensors use a NTC temperature sensor or
a thermistor.
A thermistor is a variable resistor that changes its resistance with a temperature change.
These sensors are made by sintering semiconductive materials such as ceramics or polymers
to provide larger changes in the resistance with just small temperature changes.
The term “NTC” means “Negative Temperature Coefficient”, which means that the resistance
decreases with an increase in temperature.
IMPLEMENTATION
The DHT22 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
to enable communication between the sensor and the Arduino Board. Some versions of these
sensors come with a breakout board with a built-in pull-up resistor and they have just 3 pins.
First, we need to include the DHT library which can be found on the Arduino official
website, then define the PIN to which our sensor is connected and create a DHT object. In the
setup section, we need to initiate the serial communication because we will use the serial
monitor to print the results. Using the read22() function we will read the data from the sensor
and put the values of the temperature and the humidity into the t and h variables. If you use
the DHT11 sensor you will need to you the read11() function. At the end, we will print the
temperature and the humidity values on the serial monitor.
After we upload this code to the Arduino board, the temperature and humidity results from
the sensor can be seen on the Serial monitor which is shown below:
We can also display the results on an LCD using the source code given below:
After we upload this code to the Arduino board, the temperature and humidity results from
the sensor can be seen on the LCD which is shown below: