Sunday , 25 August 2019
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

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Ad Test