HomeDigital Temperature and Humidity Sensor Module DHT22
Digital Temperature and Humidity Sensor Module DHT22
Digital Temperature and Humidity Sensor Module DHT22Digital Temperature and Humidity Sensor Module DHT22
Standard shipping in 3 working days

Digital Temperature and Humidity Sensor Module DHT22

₹160
₹125
Saving ₹35
22% off
Product Description

The DHT22 (also known as AM2302) is a popular digital sensor used to measure temperature and humidity in various DIY electronics projects. It's widely used with microcontrollers like Arduino, Raspberry Pi, and other embedded systems for sensing environmental conditions. The DHT22 is a more accurate and stable sensor compared to its sibling, the DHT11, which is why it is preferred for projects requiring higher precision.

Key Features of the DHT22 Sensor:

  • Measures: Temperature and Humidity
  • Temperature Range: -40 to +80°C (±0.5°C accuracy)
  • Humidity Range: 0 to 100% RH (Relative Humidity) (±2% RH accuracy)
  • Output: Digital signal (data is sent as a serial stream)
  • Power Supply: 3.3V to 6V DC (ideal for 5V systems)
  • Pinout: 4 pins (VCC, GND, Data, and Not Connected)
  • Sampling Rate: Once every 1-2 seconds (approx.)
  • Response Time: Around 1 second (time to update the reading)
  • Precision: Higher accuracy compared to DHT11, with better temperature and humidity readings

Pinout of the DHT22 Module:

Here’s the typical pin configuration for the DHT22 sensor (in a 4-pin module package):

PinNameDescription1VCCPower supply (3.3V to 6V)2DataData output (connected to the microcontroller)3NCNot Connected (can be left unconnected)4GNDGround (0V)

How DHT22 Works:

The DHT22 sensor uses a capacitive humidity sensor and a thermistor to measure the relative humidity and temperature, respectively. It uses a single-wire digital interface for communication with the microcontroller, which makes it simple to interface with devices like the Arduino and Raspberry Pi.

  • The sensor measures the temperature and humidity.
  • It converts this analog data into a digital signal.
  • The digital data is then sent to the microcontroller over a single data line (serial communication).

When you read from the DHT22, it outputs a 40-bit data stream, which includes:

  1. Humidity (16 bits)
  2. Temperature (16 bits)
  3. A checksum (8 bits)

The data is sent as a serial stream, and the microcontroller must read it bit by bit, assemble the data into usable values, and then calculate the humidity and temperature.

Wiring the DHT22 to an Arduino:

To connect the DHT22 sensor to an Arduino, follow these simple steps:

  1. VCC pin of the DHT22 to 5V (or 3.3V depending on your model).
  2. GND pin of the DHT22 to GND of the Arduino.
  3. Data pin of the DHT22 to a digital input pin of the Arduino (e.g., pin 2).
  4. Optionally, connect a 10kΩ pull-up resistor between the Data pin and the VCC pin. This resistor helps stabilize the data signal.

Here’s the basic connection diagram:

DHT22 Pin   ->   Arduino Pin
------------------------------
VCC         ->   5V
GND         ->   GND
DATA        ->   Pin 2 (or any other available digital pin)

Using DHT22 with Arduino:

To read the temperature and humidity from the DHT22 sensor, you need the DHT sensor library for Arduino, which simplifies the process of communication with the sensor.

  1. Install the DHT Sensor Library:
  • Open the Arduino IDE.
  • Go to SketchInclude LibraryManage Libraries.
  • Search for DHT sensor library and install the library by Adafruit or any other available one.
  1. Example Code: Here's an example of how to use the DHT22 with an Arduino to read the temperature and humidity:
#include <DHT.h>

// Define the pin where the DHT22 data line is connected
#define DHTPIN 2

// Define the type of sensor (DHT22)
#define DHTTYPE DHT22

// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  // Start the serial communication
  Serial.begin(9600);
  // Initialize the DHT sensor
  dht.begin();
}

void loop() {
  // Wait a few seconds between readings
  delay(2000);

  // Read temperature as Celsius
  float temperature = dht.readTemperature();
  // Read humidity
  float humidity = dht.readHumidity();

  // Check if readings failed, if so, display error message
  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Print temperature and humidity values to the serial monitor
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print(" °C");
  
  Serial.print("  Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");
}

Explanation of the Code:

  • DHT dht(DHTPIN, DHTTYPE): Initializes the DHT22 sensor on the defined pin and type.
  • dht.readTemperature(): Reads the temperature in Celsius.
  • dht.readHumidity(): Reads the humidity level as a percentage.
  • The code prints the values to the Serial Monitor every 2 seconds.

Reading Data from DHT22:

  • The DHT22 sensor requires a delay between readings, typically around 1-2 seconds. This is because the sensor takes time to process the readings and send data.
  • If you read the sensor too frequently without giving it time to stabilize, you may get inaccurate results or errors.

Things to Keep in Mind:

  • Timing: The sensor requires a proper timing sequence to fetch data correctly. Too many rapid readings can result in failures.
  • Pull-up Resistor: The data line of the DHT22 sensor may require a pull-up resistor (usually 10kΩ) between the Data pin and the VCC pin to stabilize the data signal.
  • Power Supply: The sensor works well with a 5V power supply, but it can also operate at 3.3V if you're using a low-power system like the Raspberry Pi.
  • Accuracy: The DHT22 is more accurate than the DHT11, but still not suitable for very precise measurements. For professional applications, you may want to use more accurate sensors like the SHT31.

Alternative: DHT22 with Raspberry Pi:

If you're using a Raspberry Pi, you can interface with the DHT22 sensor using the GPIO pins. You'll need the Adafruit Python DHT library to read the sensor data.

To install the necessary libraries on Raspberry Pi:

sudo apt-get update
sudo apt-get install build-essential python-dev python-openssl
sudo pip3 install Adafruit-DHT

Once installed, use the following Python code to read the sensor:

import Adafruit_DHT

# Set sensor type and pin
sensor = Adafruit_DHT.DHT22
pin = 4  # GPIO pin (e.g., GPIO4)

# Read temperature and humidity
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)

if humidity is not None and temperature is not None:
    print('Temp: {0:0.1f} C  Humidity: {1:0.1f}%'.format(temperature, humidity))
else:
    print('Failed to get reading. Try again!')

This will print the temperature and humidity to the console. Make sure the DHT22 is connected to the GPIO pin you specify in the code.

Applications of DHT22 Sensor:

  • Weather stations: Measure temperature and humidity in an environment.
  • Home automation systems: Monitor indoor climate conditions (e.g., temperature/humidity control).
  • Greenhouse monitoring: Ensure optimal conditions for plant growth.
  • HVAC systems: Measure room temperature and humidity to control air conditioning or heating systems.
  • Data logging: Collect temperature and humidity data for analysis or record-keeping.


Brand:- Generic

Origin:- China

Share
Customer Reviews

Secure Payments

Shipping in India

Cash on Delivery

Great Value & Quality