Electronics

DHT22 AM2302 Digital Temperature & Humidity Sensor Module

AED 40.95

1

Description

The DHT-22, also known as the DHT22 or AM2302, stands as an affordable yet highly reliable instrument designed for measuring humidity and temperature. It utilizes a combination of two key components: a capacitive humidity sensor and a precision thermistor. Operating within a power supply range of 3 to 5 volts, this device establishes communication with platforms like Arduino through a single data connection. It's worth noting that the DHT-22 offers slow update rates, requiring sampling intervals of approximately 2 seconds to ensure accurate data acquisition.

 

Package Includes:

  • 1 x DHT22/AM2302 Temperature And Humidity Sensor. 

Features:

  • Full-Range Temperature Compensation: The DHT22/AM2302 module offers full-range temperature compensation, ensuring accurate humidity and temperature measurements across a wide spectrum of environmental conditions. This capability makes it ideal for applications with varying temperature profiles.
  • Relative Humidity and Temperature Measurement: It excels at measuring both relative humidity and temperature, making it a versatile sensor for comprehensive environmental monitoring.
  • Calibrated Digital Signal: The module provides calibrated digital signals, eliminating the need for manual calibration. This ensures data accuracy and simplifies the setup process, making it accessible even for beginners.
  • Outstanding Long-Term Stability: With exceptional long-term stability, the DHT22/AM2302 sensor delivers consistent and reliable measurements over extended periods. This reliability is crucial for applications that require continuous monitoring and data logging.
  • No Extra Components Needed: Unlike some sensors that require additional components for proper operation, this module is self-contained. It doesn't necessitate extra components or complex circuitry, reducing the overall complexity of your projects.
  • 3-Pin Module: The module's simplicity extends to its design, featuring only three pins: power (VCC), ground (GND), and data (S). This minimalistic approach streamlines the hardware setup and connection to microcontrollers.
  • Ultra-Low Power Consumption: Operating with ultra-low power consumption, the DHT22/AM2302 module is energy-efficient. This feature is beneficial for battery-powered applications, as it helps prolong the battery life while continuously collecting environmental data.

 

Description:

The DHT22 Humidity and Temperature Sensor is a versatile and affordable digital sensor designed for precise environmental monitoring. It combines a capacitive humidity sensor and a thermistor to accurately assess temperature and humidity in the surrounding air, providing data through a digital signal pin. While user-friendly in its application, it demands precise timing for data collection. Installation is straightforward, requiring the connection of the first pin to a 3-5V power source, one pin to the data input, and the last pin to the ground. Notably, it transmits data efficiently through a single connection, although it's essential to clarify that it is not compatible with the Dallas One Wire protocol. This sensor sets itself apart by offering superior precision and accuracy when compared to its counterpart, the DHT11. It excels in a broader temperature and humidity range, making it suitable for a wide array of applications. According to its datasheet, it boasts the ability to detect humidity levels ranging from 0% to 100% and temperatures spanning from -40 to 125 degrees Celsius. With a resolution of 0.1 for both relative humidity (RH) and degrees Celsius, this sensor ensures highly detailed and reliable data collection. It achieves an impressive level of accuracy, with a margin of +/- 2 for humidity measurements and +/- 0.3 degrees Celsius for temperature readings.

 

Principle of Work:

the DHT22/AM2302 sensor uses a combination of humidity and temperature-sensing elements, an integrated circuit, and a simple communication protocol to provide accurate environmental data to a microcontroller. Its versatility and factory calibration make it a convenient choice for various temperature and humidity monitoring applications:

Internal Working:

  1. Humidity Sensing Element: The DHT22 sensor contains two key detecting elements. The first is a humidity-sensing element, which comprises two electrodes separated by a moisture-holding substrate. This substrate absorbs moisture from the surrounding air, affecting the resistance between the electrodes. The sensor measures this resistance variation to determine the humidity level.
  2. NTC (Thermistor): The second detecting element is an NTC (Negative Temperature Coefficient) thermistor. It is used to measure temperature by altering its resistance with changes in temperature.
  3. Integrated Circuit (IC): On the rear of the sensor, there is a small integrated circuit (IC). This IC plays a crucial role in processing and measuring the analog signals generated by the humidity and temperature sensors. It also maintains calibration coefficients and converts the analog signals into digital data for transmission.
  4. Communication: The DHT22 sensor communicates with a microcontroller through a single data pin (Spin). Unlike communication protocols like I2C or SPI, it operates in asynchronous serial mode, akin to RS-232. This means that it doesn't require a clock pin and relies on the timing of the microcontroller to transmit and receive data.
  5. Voltage Compatibility: The DHT22 is designed to work with both 3.3V and 5V power sources. It can operate effectively with either voltage, making it versatile in different microcontroller setups.

Interaction with Microcontroller:

  1. Three Pins Usage: Despite having four pins, only three of them are used in typical applications. These three pins are power (VCC), ground (GND), and data (S) pins.
  2. Factory Calibration: The DHT22 sensor comes factory calibrated, simplifying its setup process. It's ready to provide accurate temperature and humidity data without the need for user calibration.
  3. Data Transmission: To read temperature and humidity data from the sensor, a 5K pull-up resistor is connected to the data pin (S) and an MCU (Microcontroller Unit) I/O pin. The data pin serially outputs the following data format: 8-bit humidity integer data, 8-bit humidity decimal data, 8-bit temperature integer data, 8-bit fractional temperature data, and an 8-bit parity bit.
  4. Data Request: To initiate data transmission, the microcontroller briefly pulls the data pin low and then maintains it at a high level. This action signals the DHT22 module to provide the data. The precise timing and duration of these signals are documented in the datasheet.

 

Pinout of the Board:

Vcc
Power supply 3.5V to 5.5V
Data
Outputs both Temperature and Humidity through serial Data
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 Stations: The module is widely used in weather stations to measure temperature and humidity, providing valuable data for weather monitoring and forecasting.
  • 2. Home Automation: It plays a crucial role in home automation systems, helping to regulate temperature and humidity levels for increased comfort and energy efficiency.
  • 3. HVAC (Heating, Ventilation, and Air Conditioning) Systems: HVAC systems utilize the module to monitor and control indoor climate conditions, ensuring optimal comfort and air quality.
  • 4. Greenhouses: In greenhouse environments, the module helps maintain ideal temperature and humidity levels for plant growth, improving crop yields.
  • 5. Data Logging: Researchers and environmentalists use the module for data logging applications to monitor climate conditions over time in various settings.
  • 6. IoT (Internet of Things) Projects: It's a popular choice in IoT projects, enabling remote monitoring of environmental conditions and integration with smart devices.
  • 7. Laboratories: Scientific laboratories use the module for precise control and monitoring of temperature and humidity during experiments.
  • 8. Food Storage and Transportation: The module helps monitor and control temperature and humidity in food storage facilities and during food transportation, ensuring product quality and safety.
  • 9. Industrial Control: In industrial settings, it can be used to monitor and control environmental conditions in manufacturing processes where temperature and humidity are critical.
  • 10. Home Brewing: Homebrewers use the module to monitor and control fermentation conditions, ensuring the successful brewing of beer and other fermented beverages.
  • 11. Climate-controlled Storage: It's employed in climate-controlled storage units to maintain specific environmental conditions for preserving sensitive items, such as art, documents, and pharmaceuticals.
  • 12. Energy Efficiency Projects: The module aids in energy efficiency projects by providing data for optimizing heating, cooling, and ventilation systems in buildings.
  • 13. Education: Educational institutions often use the module in science experiments and projects to teach students about environmental sensing and data collection.
  • 14. Agricultural Monitoring: Farmers and agricultural researchers use the module to monitor environmental conditions in the field, helping to make informed decisions about planting and crop management.

 

Circuit:

Setting up this sensor is simple and doesn't demand any intricate components or intricate wiring.this is a step-by-step guide for connecting the DHT22/AM2302 sensor to an Arduino:

  1. Ground Connection: Connect Pin 1 of the sensor to the GND (Ground) Pin on the Arduino board. This establishes the ground connection, ensuring a common reference for electrical potential.
  2. Data Connection: Wire Pin 3 of the sensor to Pin 2 on the Arduino. This establishes the data connection, allowing the sensor to communicate temperature and humidity data to the Arduino.
  3. Power Connection: Finally, connect Pin 2 of the sensor to the VCC (Voltage Common Collector) on the Arduino. This provides the necessary power supply (3.3V or 5V, depending on your setup) to the sensor.

 

Library: 

 

To install the SimpleDHT library in the Arduino IDE, you can follow these steps:

  1. Download the Library:

  2. Install the Library in Arduino IDE:

    • Open the Arduino IDE on your computer.

    • From the Arduino IDE menu, go to "Sketch" -> "Include Library" -> "Add .ZIP Library..."

    • Navigate to the location where you downloaded the ZIP file (usually your Downloads folder), select the ZIP file named "SimpleDHT-main.zip" (or a similar name), and click "Open."

 

Code:

This code continuously reads temperature and humidity data from a DHT22 sensor connected to pin 2 of the Arduino. It then displays this data on the Arduino's serial monitor, updating the readings approximately every 2.5 seconds:

#include "SimpleDHT.h"

// Define the pin for the DHT22 sensor.
// Connect VCC to 5V or 3V, GND to GND, and DATA to pin 2.
int pinDHT22 = 2;
SimpleDHT22 dht22(pinDHT22);

void setup() {
  // Initialize serial communication for debugging.
  Serial.begin(115200);
}

void loop() {
  // Start data collection...
  Serial.println("=================================");
  Serial.println("Reading DHT22 Sensor...");
  
  // Read sensor data without taking multiple samples.
  // Using read2 to obtain float data (e.g., 10.1°C).
  // If you need less precise data, you can use read to get byte data (e.g., 10°C).
  float temperature = 0;
  float humidity = 0;
  int err = SimpleDHTErrSuccess;
  
  // Attempt to read sensor data.
  if ((err = dht22.read2(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Failed to read DHT22, error code="); 
    Serial.println(err);
    delay(2000);
    return;
  }
  
  // Display the collected sensor data.
  Serial.print("Sensor Data: ");
  Serial.print(temperature, 1); // Display temperature with one decimal place.
  Serial.print(" °C, ");
  Serial.print(humidity, 1);    // Display humidity with one decimal place.
  Serial.println(" RH%");
  
  // The DHT22 sensor samples data at a rate of 0.5Hz (every 2 seconds).
  delay(2500);
}

  1. Include Library: It includes the "SimpleDHT" library, which simplifies communication with the DHT22 sensor.
  2. Define Sensor Pin: The code specifies that the DHT22 sensor is connected to pin 2 of the Arduino.
  3. Setup Function: 
    Initializes serial communication with a baud rate of 115,200 for debugging purposes.
  1. Loop Function:

    • Prints headers for the data being displayed, providing a clear indication of what's happening.
    • Reads temperature and humidity data from the DHT22 sensor using the dht22.read2() function.
    • Checks if the data reading was successful by examining the error code returned by the read2() function. If there's an error, it prints an error message and waits for 2 seconds before the next attempt.
    • If the reading is successful, it displays the temperature and humidity values on the serial monitor with one decimal place precision.
    • Delays for 2.5 seconds (2500 milliseconds) before repeating the data collection. This delay is important because the DHT22 sensor has a sampling rate of 0.5Hz, meaning it should be sampled every 2 seconds.

 

Technical Details:

Operating voltage 3.3 – 5.5 V
Operating current Measuring: 0.5 mA, standby: 15 μA
Humidity measuring range 0 – 99.9 % RH ± 2 % RH
Temperature measuring range -40 – 80 °C ± 1 °C
Communication protocol 1-Wire bus protocol
Sampling period 2 seconds
Body dimensions 39 x 23  mm, ⌀ 3 mm mounting hole
Pin dimensions 7 mm length, 2.54 mm spacing

 

Resources:

 

Comparisons:

The DHT22 and DHT11 modules are both popular sensors for measuring temperature and humidity, but they have some significant differences. the DHT22 is a more accurate and versatile sensor with a wider operating range and higher resolution compared to the DHT11. However, the choice between the two depends on the specific requirements of your project and your budget. If precision and a broader range are crucial, the DHT22 is the better option. If cost is a primary concern and you can tolerate lower accuracy and a narrower range, the DHT11 might suffice for simpler applications:

1. Accuracy:

  • DHT22: The DHT22 is more accurate than the DHT11. It typically has an accuracy of ±2% for humidity measurements and ±0.3°C for temperature measurements.
  • DHT11: The DHT11 has lower accuracy, with approximately ±5% accuracy for humidity and ±2°C for temperature.

2. Temperature and Humidity Range:

  • DHT22: The DHT22 operates in a wider temperature and humidity range, typically from -40°C to 125°C for temperature and 0% to 100% for humidity.
  • DHT11: The DHT11 has a narrower operating range, usually from 0°C to 50°C for temperature and 20% to 80% for humidity.

3. Resolution:

  • DHT22: It offers higher resolution data, providing decimal places in both temperature and humidity readings (e.g., 20.1°C, 50.5% RH).
  • DHT11: It provides integer data without decimal places (e.g., 20°C, 50% RH).

4. Cost:

  • DHT22: The DHT22 is slightly more expensive than the DHT11, but it offers better accuracy and a wider operating range, making it a good choice for applications where precision is required.
  • DHT11: The DHT11 is more budget-friendly and suitable for basic applications where precision is not critical.

5. Power Supply:

  • DHT22: It can operate with a wider voltage range, including 3.3V and 5V power supplies.
  • DHT11: It typically operates with a 3.3V power supply, which can be a limitation in some projects.

6. Compatibility:

  • DHT22: The DHT22 uses a different protocol than the DHT11, so they are not directly interchangeable in code. You need to use different libraries or adapt your code when switching between the two.