How to use 4 Pin DHT11 Temperature/Humidity Sensor with Arduino | Tutorial

DHT11 Temperature and Humidity Sensor - This sensor is an easy way to detect humidity and temperature around you. In this experiment, we will see how to interface a 4 pin DHT11 sensor with the Arduino board. In this, we will not use any external display instead we will be using the in-built serial monitor to see our output. It is also important to note that we have to import a DHT11 library in order to use the DHT11  temperature and humidity sensor.

Apparatus Required: DHT11 temperature/humidity sensor, several, connecting wires, breadboard.

Procedure:

  1. First of all download and install the DHT11 library file.
  2. Install the library on your Arduino IDE.
  3. For installation, open Arduino IDE then click on sketch and select add zip.library then select the location where you have downloaded the zip file. 
  4. Connect the DHT11 sensor with the breadboard. 
  5. Connect the first pin of the DHT11 to 5V of the Arduino board. 
  6. Now connect the second pin of the DHT11 to analog pin (a0). 
  7. We are not using the third pin of the DHT11 sensor. 
  8. Now connect the last pin of the DHT11 to the GND of the Arduino. 

Download File

Arduino Sketch:


#include "dht.h"
#define dhtpin A0 
dht DHT; 
void setup()
{ 
  Serial.begin(9600);
  delay(500);
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000); 
} 
void loop()
{ 
    DHT.read11(dhtpin);    
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");    
    delay(2000); 




Thank You!

Post a Comment

0 Comments