DHT11 Temperature and Humidity sensor Interfacing with Arduino Uno

In this tutorial we are going to interface DHT11 Temperature and Humidity sensor with Arduino Uno and check Temperature and Humidity of the surrounding.

Components Required :

DHT11 Temperature and Humidity sensor

DHT11 temperature and humidity sensor | Alpha Electronz
DHT11 temperature and humidity sensor
The DHT11 is a basic, low-cost 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).
Connections are simple, the first pin on the left to 3-5V power, the second pin to your data input pin and the right most pin to ground.

The DHT-11 is a digital-output relative humidity and temperature 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.
In this tutorial you will learn how to use this sensor with Arduino uno. The room temperature & humidity will be printed to serial monitor.

Circuit Diagram

DHT11 temperature and humidity sensor Interfacing with Arduino Uno Circuit Diagram | Alpha Electronz
DHT11 sensor with Arduino Uno Circuit Diagram

The connections are easy, just connect your DHT11 sensor as given in above circuit diagram.

Code

/* DHT11 Temperature and Humidity Sensor Interfacing with Arduino Uno.
   More info: http://alphaelectronz.com */
//Libraries
#include <dht.h>
dht DHT;
//Constants
#define DHT11_PIN 4   
//Variables
float hum;  //Stores humidity value
float temp; //Stores temperature value
void setup()
{
    Serial.begin(9600);
}

void loop()
{
    int chk = DHT.read11(DHT11_PIN);
    //Read data and store it to variables hum and temp
    hum = DHT.humidity;
    temp= DHT.temperature;
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");
    delay(2000); //Delay 2 sec.
}

To Download the DHT11 Library Click here

Leave a Reply

Your e-mail address will not be published. Required fields are marked *