Shares

Complete Guide for DHT11/DHT22 Humidity and Temperature Sensor With Arduino

Shares

This post aims to be a complete guide for the popular DHT11/DHT22. I’ll explain how it works, show some features and share an Arduino Project example that you can take and apply to your own projects.

I have more complete guides for other popular sensors, check them below:

Description

These DHTXX sensors are very popular among the Arduino Tinkerers. The DHT sensors are relative cheap sensors for measuring temperature and humidity.

These sensors inside contain a chip that does analog to digital conversion and spits out a digital signal with the temperature and humidity.

With any microcontroller(MCU) these signals are easy to ready.

humidity sensor

Specifications DHT11 vs DHT22

You have to two versions of the DHT sensor.

DHT11

  • Range: 20-90%
  • Absolute accuracy: ±5%
  • Repeatability: ±1%
  • Long term stability: ±1% per yea
  • Price: $1 to $5

DHT22

  • Range: 0-100%
  • Absolute accuracy: ±2%
  • Repeatability: ±1%
  • Long term stability: ±0.5% per year
  • Price: $4 to $10

As you can see from the specs above, the DHT22 is a little more accurate.

Where to buy?

You can purchase these modules from eBay for just a few dollars:

rsz_dht-11

Arduino with DHT11 Temperature and Humidity Sensor

You need the following components to make this circuit:

  • Arduino (eBay)
  • DHT11 (eBay)
  • Breadboard (eBay)
  • 10K Resistor

Here’s how to connect the DHT11 to an Arduino:

humidity_schematics

Pins:

  • VCC (3V to 5V)
  • Data OUT
  • Don’t connect
  • GND

Source code

Here’s the code you need for this project:

  1. Download the DHT11 library here
  2. Unzip the DHT library
  3. Rename the extracted folder and remove the “-“. Otherwise your Arduino IDE won’t recognize your library
  4. Install the DHT11 in your Arduino IDE
  5. Restart your Arduino IDE
  6. Go to Files / Examples / DHT_SENSOR_LIB / DHT Tester
  7. Upload the code

Demonstration

In this project the Arduino is measuring the temperature and humidity. Those two measures are being displayed in the serial monitor. Here’s what you should see in your Arduino IDE serial monitor.

serial_monitor

I hope you found this guide useful.

Share this post with a friend that also likes electronics!

You can contact me by leaving a comment. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.

Thanks for reading,

-Rui Santos

Leave a Comment:

Add Your Reply

Download Home Automation Using ESP8266 (2nd Edition) and Save 30%
Sale Ends January 21

x