Electronics

DHT22 Temperature and Humidity Sensor (Generic)

AED 15.95

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 and DHT22 module are both based on the same temperature and humidity sensor chip and can measure temperature and humidity levels. However, there are some differences between the two:

  1. Form factor: The DHT22 sensor is a standalone component that needs to be connected to a microcontroller or other circuitry to operate, while the DHT22 module integrates the sensor with additional components, such as voltage regulation and signal conditioning, to provide a more convenient and easy-to-use package.
  2. Pinout: The DHT22 sensor has four pins, which need to be connected to appropriate microcontroller pins for power, ground, and data communication. The DHT22 module usually has only three pins, with the data pin already connected to a digital input/output pin of the module.
  3. Power supply: The DHT22 sensor typically requires a voltage supply in the range of 3V to 5.5V, while the DHT22 module may have a built-in voltage regulator that allows it to be powered from a wider range of voltage sources.
  4. Accuracy and precision: The accuracy and precision of temperature and humidity measurements may vary slightly between the DHT22 sensor and DHT22 module due to differences in the circuitry and other factors, such as the quality of the PCB design.