DHT22 Digital Temperature and Humidity Sensor

----

The DHT22 is a basic digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data.

Out of stock

Join Waitlist

Frequently Bought Together

DHT22 Digital Temperature and Humidity Sensor+Arduino Nano R3 Main+Solderless Prototyping Breadboard 840 Tie Point+Usb_Main
Price for all:   223.00 EGP

Description

DHT22 Specifications

  • Supply voltage: 3.0 ~ 5.0V DC
  • Output: single-bus digital signal
  • Measuring range: Humidity 0-100% RH, Temperature -40 ~ +80 ℃
  • Accuracy: Humidity +/-2% RH, temperature +/-0.5 ℃
  • Resolution: Humidity 0.1% RH, temperature 0.1 ℃
  • Long-term stability: <± 0.5% RH / Year

Required Hardware Devices

  • Arduino controller × 1
  • USB data cable × 1
  • DHT 22 module × 1

Connecting

  • Arduino pin 6 –> Pin S module
  • Arduino GND –> Pin – module
  • Arduino +5 –> Pin Middle

Code

//
//    FILE: dht_test.ino
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.07
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
//     URL: http://arduino.cc/playground/Main/DHTLib
//
// Released to the public domain
//

#include <dht.h>

dht DHT;

#define DHT11_PIN 4
#define DHT21_PIN 5
#define DHT22_PIN 6

void setup()
{
  Serial.begin(115200);
  Serial.println("DHT TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT_LIB_VERSION);
  Serial.println();
  Serial.println("Type,tstatus,tHumidity (%),tTemperature (C)");
}

void loop()
{
  // READ DATA
  Serial.print("DHT22, t");
  int chk = DHT.read22(DHT22_PIN);
  switch (chk)
  {
    case DHTLIB_OK:  
		Serial.print("OK,t"); 
		break;
    case DHTLIB_ERROR_CHECKSUM: 
		Serial.print("Checksum error,t"); 
		break;
    case DHTLIB_ERROR_TIMEOUT: 
		Serial.print("Time out error,t"); 
		break;
    default: 
		Serial.print("Unknown error,t"); 
		break;
  }
  // DISPLAY DATA
  Serial.print(DHT.humidity, 1);
  Serial.print(",t");
  Serial.println(DHT.temperature, 1);

  delay(1000);


    // READ DATA
  Serial.print("DHT21, t");
  chk = DHT.read21(DHT21_PIN);
  switch (chk)
  {
    case DHTLIB_OK:  
		Serial.print("OK,t"); 
		break;
    case DHTLIB_ERROR_CHECKSUM: 
		Serial.print("Checksum error,t"); 
		break;
    case DHTLIB_ERROR_TIMEOUT: 
		Serial.print("Time out error,t"); 
		break;
    default: 
		Serial.print("Unknown error,t"); 
		break;
  }
  // DISPLAY DATA
  Serial.print(DHT.humidity, 1);
  Serial.print(",t");
  Serial.println(DHT.temperature, 1);

  delay(1000);

  // READ DATA
  Serial.print("DHT11, t");
  chk = DHT.read11(DHT11_PIN);
  switch (chk)
  {
    case DHTLIB_OK:  
		Serial.print("OK,t"); 
		break;
    case DHTLIB_ERROR_CHECKSUM: 
		Serial.print("Checksum error,t"); 
		break;
    case DHTLIB_ERROR_TIMEOUT: 
		Serial.print("Time out error,t"); 
		break;
    default: 
		Serial.print("Unknown error,t"); 
		break;
  }
 // DISPLAY DATA
  Serial.print(DHT.humidity,1);
  Serial.print(",t");
  Serial.println(DHT.temperature,1);

  delay(1000);
}
//
// END OF FILE
//

Additional information

Weight10 g

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.