How to Interface DHT 11 Temperature and Humidity Sensor With Arduino

by MissionCritical in Circuits > Arduino

8361 Views, 7 Favorites, 0 Comments

How to Interface DHT 11 Temperature and Humidity Sensor With Arduino

thmbnl.jpg

Hello there! fellow Electronic enthusiast and hobbyists, in this creative Arduino Tutorial, we are gonna learn about DHT11 Temperature and Humidity Sensor Module and we will use it with our Arduino Board, which might be used for some future project, so let’s get started!

Watch the Video

Gather the Material

1.jpg
DSC00324-1.jpg
DSC00323-1.jpg

What Is DHT11 Sesnor?

DSC00303.jpg

DHT11 module is a Temperature and humidity sensing module, which uses Digital Signal Acquisition, which converts the Temperature and Humidity to a digital Reading, which can be easily read by a Microcontroller. Operating range of DHT11 is 0 to 50 degree Celsius which is quite sufficient for Home or Hobby purposes. And as we can guess by its cost and nature of use, this sensor module is not exactly accurate, but it works just fine for few simple Arduino projects. it works on Negative Temperature Coefficient, so it will basically change its resistance depending on the temperature.

for more details

http://wiki.sunfounder.cc/index.php?title=Humiture...

Wiring

vlcsnap-00001.jpg
vlcsnap-00002.jpg
vlcsnap-00003.jpg
vlcsnap-00005.jpg
vlcsnap-00006.jpg
vlcsnap-00007.jpg

The module that we have here has DHT11sensor, few complimentary 10kohm resistors and an LED light on board, so you use the sensor standalone and also use the exact same module that we are using here in tutorial.

This module has 3 pins that are Vcc, Data and Ground pins, which are straight forward connections for Arduino.

Connections:

Vcc - 5V

Ground - GND

Data - D2

Coding

vlcsnap-00004.jpg
vlcsnap-000021.jpg
vlcsnap-000011.jpg
vlcsnap-000031.jpg

For code, we will use the DHT library

steps:

  1. Download the DHT sensor library.
  2. Install the DHT Library.
  3. open Examples or download the .ino file attcahed in this step.
  4. comment the Line which says #define DHTTYPE DHT22.
  5. uncomment the Line which says #define DHTTYPE DHT11.
  6. upload the code
  7. open your Serial Monitor.

Optional Steps (if you get an Message like “failed to read sensor data”)

  1. check wiring connections,
  2. check selected DHT sensor type.

(optional) LCD Example

vlcsnap-00001111.jpg
vlcsnap-0000111.jpg

let’s try to get the temperature and humidity readings on the LCD screen, if you don’t know how to use LCD with Arduino, make sure you check out my Previous video on How to interface LCD with Arduino and How to create a custom Character.

Starting the code by adding the libraries, defining the DHT data pin, DHT module type, lcd setup, and then we will define a custom character for Degree Celsius symbol, next in void setup, we will do the basic LCD configurations and in the Main loop, we will define two variables for temperature and Humidity which will store the value from dht sensor, the Syntax here is dht.readHumidity and dht.readTemperature where dht is the name that we assigned to this sensor in initialization steps. And next we simply print those values on LCD.

Follow Mission Critifcal on Social Media!

DSC00300.jpg