Interface DHT11/DHT22 Temperature and Humidity sensor with Arduino

About DHT11/DHT22 Temperature and Humidity Sensor:

DHT11/DHT22 are used for measuring the temperature and humidity of the surrounding. It consists of a capacitive type humidity sensor for measuring humidity and a thermistor for measuring temperature. The values from both the sensors are fed to a chip present inside on the circuit board which converts analog data to digital data. The data can be further used for other applications. 

Pinout of DHT11/DHT22

Features of DHT11

  • Low cost
  • Voltage: 3-5 volts
  • Current: 2.5mA
  • Humidity: 20-80%
  • Temperature: 0-50 degree Celsius

Features of DHT22

  • Low cost but expensive than DHT11
  • Voltage: 3-5 volts
  • Current: 2.5mA
  • Humidity: 0-100%
  • Temperature: -40-80 degree Celsius

Components Needed

  • DHT11 or DHT22
  • Arduino UNO
  • Jumper Wires

Pin Connection of DHT11/DHT22 with Arduino

  • Pin VCC: 5v
  • Pin GND: GND
  • Pin OUT: Pin2

Circuit Diagram of DHT11/DHT22 with Arduino

Arduino code of DHT11/DHT22 with Arduino

#include"DHT.h"

#define DHTPIN 2

#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup(){

  Serial.begin(9600);

  dht.begin();

}

void loop(){

 int hum = dht.readHumidity();

 int temp = dht.readTemperature();

    Serial.print("Humidity: ");

    Serial.println(hum);

    Serial.print("Temperature: ");

    Serial.print(temp);

    Serial.println(" *C");

  }

}

Leave a Reply

Your email address will not be published. Required fields are marked *