How to Interface DHT11 Sensor with Arduino Board

In this tutorial, we will learn how to interface Digital Temperature Sensor with the Arduino Uno board. To build this project, we can use Arduino board, DHT11 Temperature/Humidity sensor and display the Arduino IDE Serial Monitor.

How to Interface DHT11 Sensor with Arduino Board

Before starting the project, we will first take a little background on Humidity and how to measure humidity with DHT11. Then we will connect DHT11 to the Arduino board and create an example code, you can use DHT11 in your logic on your projects.

What is Humidity?

“Humidity” refers to the presence of water vapor in the atmosphere. Relative humidity is a measure of how close to saturation the air is with water vapor. If there is a lot of water vapor in the air, the humidity will be high.

Relative humidity (RH) is the ratio between the actual amount of water vapor present in the air and the maximum amount of water vapor that the air can hold at a given temperature.it is expressed as a percentage. At 100% RH, condensation occurs, and at 0% RH, the air is completely dry.

DHT11 Temperature Sensor

DHT11(Datasheet) measures relative humidity. Relative humidity is the amount of water vapor in the air versus water vapors in the air. DHT11 detects water vapor by measuring electrical resistance between two electrodes. The humidity sensing component is the moisture holding substrate with electrodes applied to the surface. For more information about DHT11 Sensor, refer the topic Digital Temperature Sensor.

How to Interface DHT11 Sensor with Arduino Board

features DHT11:

3 to 5V power and I/O

2.5mA max current use during conversion (while requesting data)

Good for 20-80% humidity readings with 5% accuracy

Good for 0-50°C temperature readings ±2°C accuracy

No more than 1 Hz sampling rate (once every second)

Body size 15.5mm x 12mm x 5.5mm

4 pins with 0.1″ spacing.

Components Required:

  • Arduino Uno (Any “Uno” will work)
  • DHT11 Temperature/Humidity Sensor
  • Jumper Wires
  • Breadboard
  • Cable (USB 2.0)

Connection Required:

Connect the signal pin of DHT11(s) to arduino analog pin A0.

Connect power pin of DHT11 (+) to Arduino’s 5V.

Connect ground pin of DHT11(–) to Arduino’s GND.

Note: If you use a 4 pin DHT sensor, drag 10K ohm resistor through a digital pin into the power pin of the Arduino.

How to Interface DHT11 Sensor with Arduino Board

Program:

Before starting program on Arduino with DHT11, we need to install
the DHTLib library.

It’s easy to install, just download the DHTLib.zip file below and open up the Arduino IDE. Then go to SketchInclude LibraryAdd .ZIP Library and select the DHTLib.zip file. When you click the ‘Add .ZIP library’, Add the DHT_Library.zip.

How to Interface DHT11 Sensor with Arduino Board

Then upload the following example code to your Arduino using the Arduino IDE.

How to Interface DHT11 Sensor with Arduino Board

Result:

After uploading the program, open the serial monitor, and the sensor’s data will display itself and update every 2 seconds. You should see the following output in serial monitor (CRL + Shift + M).


Источник: microdigisoft.com