Electronics

DHT22 Temperature Humidity Sensor

AED 17.85

1

Description

The DHT22 Humidity and Temperature Sensor is a low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to sense the surrounding air and delivers a digital signal pin. It is quite simple to use

Package Includes:

  • 1 x DHT22 Temperature And Humidity Sensor.
  •  

Features:

  • Full-range temperature compensated
  • Relative humidity and temperature measurement
  • Calibrated digital signal
  • Outstanding long-term stability
  • Extra components not needed
  • 4 pin housing
  • ultra low power

Description:

The DHT22 Humidity and Temperature Sensor is a low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to monitor the surrounding air and delivers a digital signal pin. It is quite simple to use, although accurate timing is required for data collection. Easily plug the first pin into 3-5V power, one pin into your data input pin, and the last into the ground. Despite the fact that it transmits data via a single connection, it is not Dallas One Wire compatible!  this sensor is more precise and accurate than the DHT11 and works in a higher temperature/humidity range, but it is more expensive and larger, According to its datasheet, it is capable of detecting 0 to 100% relative humidity and temperatures from -40 to 125-degree celsius. The resolution for both humidity and temperature is 0.1 (RH and degree celsius) while the accuracy is +/ 2 for humidity and +/ 0.3 for temperature.

Principle of Work:

The S pin is used to read data to the microcontroller. Because there is no clock pin like in I2C and SPI, the DHT22 must operate in asynchronous serial mode, similar to RS-232. Because a pull-up resistor is required, the sensor can function with both 3.3V and 5V sources. Because of this communication mechanism, known as single-bus, The sensor will come as a 4-pin package out of which only three pins will be used. The DHT22 is factory calibrated and produces serial data, making it extremely simple to set up. A 5K pull-up resistor is used to connect the data pin to an MCU I/O pin. This data pin serially outputs the temperature and humidity values. The data pin will output 8 bit humidity integer data + 8 bit humidity decimal data +8-bit temperature integer data +8-bit fractional temperature data +8-bit parity bit. To request that the DHT11 module provide these data, the I/O pin must be briefly low and then maintained high. The datasheet explains the length of each host signal in precise parts.

 

Pinout of the Board:

1

Vcc

Power supply 3.5V to 5.5V

2

Data

Outputs both Temperature and Humidity through serial Data

3

NC

No Connection and hence not used

4

Ground

Connected to the ground of the circuit


Note
: The sensor will burn down if you connect VCC and GND in the wrong Wiring. 


Applications:

  1. Weather station
  2. Humidity regulator
  3. Air conditioner

Circuit:

The circuit for this sensor is pretty straightforward and doesn’t require any complex parts or wiring.

  • Place the 10k resistor from pin 1 to pin2 on the humidity sensor.
  • Wire Pin 1 to the 5v Pin on the Arduino
  • Wire pin 2 to pin 2 on the Arduino
  • Do not use pin 3 on the sensor.
  • Lastly wire pin 4 to GND on the Arduino.

  • VCC of the Module connected to the 5V Arduino Pin 
  • GND of the Module connected to the GND Arduino Pin 
  • Data of the Module connected to the 2 Arduino Pin 

 

Library: 

You need to install the below DHT11 library. Just download the below library and open Arduino IDE. Now go to Sketch > Include Library > Add .Zip Library.

DHT Library

. Once it’s done, you can use the code below.

Code:

#include "SimpleDHT.h"

// for DHT22, 
//      VCC: 5V or 3V
//      GND: GND
//      DATA: 2
int pinDHT22 = 2;
SimpleDHT22 dht22(pinDHT22);

void setup() {
  Serial.begin(115200);
}

void loop() {
  // start working...
  Serial.println("=================================");
  Serial.println("Sample DHT22...");
  
  // read without samples.
  // @remark We use read2 to get a float data, such as 10.1*C
  //    if user doesn't care about the accurate data, use read to get a byte data, such as 10*C.
  float temperature = 0;
  float humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht22.read2(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Read DHT22 failed, err="); Serial.println(err);delay(2000);
    return;
  }
  
  Serial.print("Sample OK: ");
  Serial.print((float)temperature); Serial.print(" *C, ");
  Serial.print((float)humidity); Serial.println(" RH%");
  
  // DHT22 sampling rate is 0.5HZ.
  delay(2500);
}

 

Technical Details:

  • Temperature range: -40 to 80ºC +/- 5ºC
  • Relative humidity range: 0 to 100% +/-2%
  • Temperature resolution: 0.1ºC
  • Humidity resolution: 0.1%
  • Operating voltage: 3 to 6 V DC
  • Current supply: 1 to 1.5 mA
  • Sampling period: 2 seconds

Resources:

Tutorial1

Datasheet

 

Comparisons:

The DHT22 sensor is the replacement to the DHT11 module, and it is available as a sensor or a module. The sensor's performance is the same in either case. The Sensor will have 4pins. The only difference between the sensor and the module is that the module includes a filtering capacitor and a pull-up resistor, whereas the sensor requires you to use them externally if necessary. The module is slightly more expensive than the DHT11, but it has a larger measuring range and superior precision. if you want to use the more basic sensor in your beginner project or something easy to code we recommend starting with LM35.