Monday , 25 September 2023
Breaking News
Home > Tutorials > Arduino Tutorials > How to use the DHT11 Temperature and Humidity Sensor with Arduino!

How to use the DHT11 Temperature and Humidity Sensor with Arduino!

Hello dear friends. Hope you will be fine. Today we will learn that how to use a DHT (DHT11 version) Temperature and Humidity Sensor. In this tutorial, you will see the result in the serial monitor of Arduino but later I will write some more tutorial for getting the result into the database and then generate the dynamic chart to show your sensor’s temperature and humidity. So let’ start our first tutorial of this series.

We need the following hardware for this project:

  1. DHT11, a temperature and humidity sensor.
  2. Wemos d1 mini or UNO arduino
  3. Three cables

Again we will be using a Library specifically designed for these sensors that will make our code short and easy to write.

As you can see we only need 3 connections to the sensor since one of the pin is not used.

The connections are : Voltage, Ground, and Signal which can be connected to any Analog Pin on our UNO.

Note: You can use UNO arduino for this project and set the pin as shown below.

THE CODE

You have to download DHT library for this project that is available for this sensor. I will try to make code very short and simple. Download link for DHT library is given below. Once you have the library, just go ahead and extract it to the Library folder inside your Arduino IDE software folder.

Change pin port on line #define dht_apin D2.

Download

You can download the Library we used here:  DHT_Library.zip

About Muhammad Faryad

Muhammad Faryad is a professional web application developer. He has been working for 5 years in ICE786 Technologies Pvt. Ltd as a Senior Programmer and Developer. You can contact him on facebook at www.facebook.com/tolamangali

2 comments

  1. Arduino: 1.8.10 (Windows 10), Alaplap:”LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200″

    sketch_jan22b:1:17: error: DHT.h: No such file or directory

    #include “DHT.h”

    ^

    compilation terminated.

    exit status 1
    DHT.h: No such file or directory

    Ennek a jelentésnek több információja lehetne
    a “Bővebb kimenet mutatása fordításkor”
    opció engedélyezésével a Fájl -> Beállítások-ban.

Leave a Reply

Ad Test

%d bloggers like this: