Monday, 8 January 2018

Temperature & Humidity measurement using DHT11 sensor & Arduino

Introduction

DHT11 is a cheap & easy option for temperature & humidity measurement for DIY projects & beginner experiments. It is likely suitable for domestic environment control, weather monitoring unit & gardening/farming monitoring stations. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, gives output as digital signal which can be connected to Arduino digital IO pin directly. The only drawback of DHT11 is slow response for updated values. You can download DHT11 datasheet from here.

Technical Specifications

  • Operating Voltage: 3V to 5.5V DC
  • Current consumption: Measurement 0.3mA, standby 60μ A
  • Accuracy: At 25, ± 2 & ± 5% RH
  • Sampling period: more than 2 seconds
  • Measurement Range: 20-95% RH & 0-50
  • Resolution: 8 Bit for temperature & 8 Bit for humidity
  • Response time: 6 to 15 seconds for humidity & 6 to 30 seconds for temperature.

The DHT11 measures relative humidity which means the amount of water vapor in air vs. the saturation point of water vapor in air. At the saturation point, water vapor starts to condense and accumulate on surfaces forming dew. The saturation point changes with air temperature. Cold air can hold less water vapor before it becomes saturated, and hot air can hold more water vapor before it becomes saturated.

Connections

DHT11 module available in market is having 3 pins, actually sensor is having 4 pins but module designed to connect with arduino easily by removing 1 pin which is not required. Connections shown in diagram is as below:

DHT
Arduino
+Ve
Red
3.3V / 5V
Signal
Yellow
Digital Pin 7
GND
Black
GND

(Please connect wires carefully...!!!)

Programming

#include<dht.h>
dht DHT;

#define DHT11_PIN 7

void setup() {
Serial.begin(9600);
}

void loop() {
int chk = DHT.read11(DHT11_PIN);
Serial.print("Humidity: " );
Serial.print(DHT.humidity, 1);
Serial.print(" °%" ,);
Serial.print("Temparature: ");
Serial.println(DHT.temperature, 1);
Serial.println(" °C");
delay(1000);

}

You can download this code here.

As mentioned in code, pin no. 7 is defined as DHT11_PIN variable. In setup loop, baud rate is assigned at 9600 to read DHT11 values on serial monitor available in Arduino IDE software. Next loop is written to move DHT11 values in variable and print on serial monitor. Just copy the code and paste in Arduino IDE, set your Arduino board & COM Port, upload it, here you go with values on serial monitor. So, it is too easy to get temperature & humidity using DHT11 sensor. For further expansion, you can connect monochrome LCDs, OLEDs to display and can send data wirelessly using HC-05 Bluetooth sensor and many more wireless options. I hope this tutorial will be helpful for basic temperature & humidity measurement. In future I will upload more tutorials with LCD and Bluetooth interface with this. Your feedback will be appreciated.

Join on FacebookTwitter & Telegram for more updates.