0

members

Easy Basics Project 006a DHT 11 21 22 module

of Acoptex.com in UNO

Basics: Project 006a

Project name: DHT11 21 22 Humidity and temperature module

Tags: Arduino, Arduino Uno, DHT11 21 22, Humidity and temperature module

Attachments: library1, library2 and sketch

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.DHT11 or DHT21 or DHT22

3.Arduino IDE ( you can download it from here  )

4.Jumper cables

5. Resistor 1 pc 10 K Om (if 4 pin sensor used - see picture of Arduino and sensor 4 pin connections)

6. Breadboard

Understanding DHT humidity and temperature sensor

We will use DHT11 module for this project. The DHT11 humidity and temperature sensor makes it really easy to add humidity and temperature data to your DIY electronics projects. It’s perfect for remote weather stations, home environmental control systems, and farm or garden monitoring systems.

Here are the ranges and accuracy of the DHT11:

Humidity Range: 20-90% RH
Humidity Accuracy: ±5% RH
Temperature Range: 0-50 °C
Temperature Accuracy: ±2% °C
Operating Voltage: 3V to 5.5V
  • Humidity Range: 20-90% RH
  • Humidity Accuracy: ±5% RH
  • Temperature Range: 0-50 °C
  • Temperature Accuracy: ±2% °C
  • Operating Voltage: 3V to 5.5V

RELATIVE HUMIDITY

The DHT11 measures relative humidity. Relative humidity is the amount of water vapor in air vs. the saturation point of water vapor in air. At the saturation point, water vapor starts to condense and accumulate on surfaces forming dew.

The saturation point changes with air temperature. Cold air can hold less water vapor before it becomes saturated, and hot air can hold more water vapor before it becomes saturated.

The formula to calculate relative humidity is:

Relative humidity is expressed as a percentage. At 100% RH, condensation occurs, and at 0% RH, the air is completely dry.

HOW THE DHT11 WORKS

The DHT11 detects water vapor by measuring the electrical resistance between two electrodes. The humidity sensing component is a moisture holding substrate with electrodes applied to the surface. When water vapor is absorbed by the substrate, ions are released by the substrate which increases the conductivity between the electrodes. 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.

The DHT11 measures temperature with a surface mounted NTC temperature sensor (thermistor) built into the unit. 

The DHT11 uses just one signal wire to transmit data to the Arduino. Power comes from separate 5V and ground wires. A 10K Ohm pull-up resistor is needed between the signal line and 5V line to make sure the signal level stays high by default (see the datasheet for more info).

There are two different versions of the DHT11 you might come across. One type has four pins, and the other type has three pins and is mounted to a small PCB. The PCB mounted version is nice because it includes a surface mounted 10K Ohm pull up resistor for the signal line. Here are the pin outs for both versions:

With the plastic housing removed, you can see the electrodes applied to the substrate:

An IC mounted on the back of the unit converts the resistance measurement to relative humidity. It also stores the calibration coefficients, and controls the data signal transmission between the DHT11 and the Arduino:

Datasheet can be found here.

DHT 11, DHT 21 and DHT 22 have different specifications.

DHT11

Measurement Range 20-90%RH and 0-50 ℃

Humidity Accuracy ±5%RH

Temperature Accuracy ±2℃ 

Sensing period 1s 

DHT 21

Measuring range  0-100% RH and 40 - 80℃

Accuracy humidity ±3%RH(Max ±5%RH)

Accuracy temperature < ±1℃ 

Sensing period Average: 2s 

DHT 22

Measuring range 0-100%RH amd 40~80℃

Accuracy humidity ±2%RH(Max ±5%RH)

Accuracy temperature <±0.5℃

Sensing period Average: 2s 

Signals and connections of DHT11 module

There are 3 : VCC (+5V), Data, GND (-)

Wiring

The following picture shows the needed connections with the Arduino Uno - 3 pin DHT11 sensor module.

The following picture shows the needed connections with the Arduino Uno - 4 pin DHT11 sensor (resistor 10 K Om required).

Step by Step instruction

  1. Plug your Adruino Uno board into your PC and select the correct board and com port
  2. Open up serial monitor and set your baud to 9600 baud
  3. Modify sketch(program) for your sensor (DHT11 or DHT21 or DHT 22)
  4. Verify and upload the the sketch to your Adruino Uno.
  5. If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h

 

Libraries:

  • See attachments on the begining of this project description
  • Adafruit_Sensor library included.Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. 
  • DHT-sensor library included. You will need to unzip and add the DHT-sensor-library-master library to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries OR
  • You can install it in Arduino IDE too: select Sketch-> Include library->Manage your libraries->type DHT in Filter your search line and you will see DHT sensor library by Adafruit->More info->select version->install
  • If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h.

Sketch

  • See attachments on the begining of this project description


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 05-05-2017
Viewed: 890 times