Interface DHT11 with Arduino
Arduino

DHT11


Description

The DHT11 is a digital temperature and humidity sensor module widely used in various electronics and IoT projects. It consists of a capacitive humidity sensor and a thermistor to measure temperature.


Sensor Details

Tech Specs for the DHT11 temperature and humidity sensor:

  • Operating Voltage: 3.3V to 5V
  • Current Consumption: 1.5mA
  • Temperature Measurement Range: 32ºF to 122ºF( 0ºC to 50ºC)
  • Temperature Measurement Accuracy: ±2ºC
  • Temperature Measurement Resolution: 1ºC
  • Humidity Measurement Range: 20% to 90% RH
  • Humidity Measurement Resolution: ±5% RH
  • Digital Out Signal Transmission Range:
  • Dimensions: .75in X 1.77in (2cm x 4.5cm)

Wiring Details
  • DHT11 Sensor GND to Arduino GND
  • DHT11 Sensor Vcc+ to Arduino +5V
  • DHT11 Sensor Signal to Arduino PIN 2

Circuit Image
Circuit Code
                                        
                                            

 

#include "DHT.h"
  
#define DHTPIN 2 // we're using pin 2
#define DHTTYPE DHT11 // we're using the DHT11
  
// define our DHT object using the pin and type from above
DHT dht(DHTPIN, DHTTYPE);
  
void setup() {
Serial.begin(9600);
}
  
void loop() {
  
// create a float and read the temperature sensor

float myTemperature = dht.readTemperature(true);


// print the temperature on the screen in Celsius

Serial.print(myTemperature);
Serial.print((char)223);            // degree symbol
Serial.println("C");
delay(3000);    // wait 3 seconds before updating again
}