Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to provide a detailed discussion on DHT11 Arduino Interfacing. I have shared a detailed article on DHT11 Humidity & Temperature Sensor in Pakistan, in my previous article. DHT11 is basically a temperature as well as humidity sensor. It is made up of two different parts i.e. capacitive humidity sensor and a thermistor. DHT11 is a slow sensor but is quite efficient for the applications where we need to do some basic analog data exchange. There is a small chip inside this sensor which performs the function of analog to digital to analog conversion and gives the results for temperature as well as for humidity in digital form. This digital signal can be read easily through any micro-controller.
LM335 is another temperature sensor and to understand today’s post more properly, you should also go through Introduction to LM335. DHT11 is a low cost sensor and is easily available in the market now a days. This property makes it more popular among the similar type of sensors. It provide precise results with the higher efficiency. It has a small size and low power consumption. It can transmit the signal up to 20 meters. It has four pins whose detail will be explained later. DHT11 has a lot of features including low cost, long term stability, fast response time, excellent quality, long distance signal transmission and many more. In real life DHT11 can be used at several different places e.g. home appliances, weather stations, consumer goods etc. the further detail about DHT11 Arduino Interfacing will be given later in this tutorial.
DHT11 Arduino Interfacing
DHT11 is an electronic device which is used to measure the temperature and humidity in real environment. It consists of two part capacitive humidity sensor and thermistor. It is a low cost device but provides excellent and precise results. It has an internal small chip used for analog to digital conversions and to provide digital output. We can read this digital output easily through any of the micro-controller. In this tutorial I am using Arduino UNO as a micro-controller. It can be used in home appliances, weather stations, medical humidity control, data loggers, HVAC and at several different places. DHT11 along with its pin names is shown in the figure given below.
1. DHT11 Pins
- DHT11 temperature sensor has total four pins, each of them has different tasks to perform.
- All of the four pins are given in the table shown in the figure given below.
2. DHT11 Pins Description
- Before using any electronic device we must know about the functions of its all pins.
- DHT11 pins functions are provided in the table given in the figure shown below.
3. DHT11 Working Principle
- As we know DHT11 can measure both temperature and humidity.
- In order to measure temperature DHT11 uses a thermistor also known as NTC (Negative Temperature Coeficient) temperature sensor.
- Thermistor is basically a variable resistors, which changes its resistance with respect to the temperature.
- Thermistor is made up of sintering of semiconductors in order to provide large change in its resistance with the small changes in temperature.
- NTC means the resistance decrease with the increase in temperature.
- I have provided a visual for temperature measuring using DHT11 sensor as shown in the figure given below.
- For humidity sensing DHT11 uses capacitive humidity sensor.
- Humidity part consists of two electrodes having moisture holding substrate in between them.
- As the humidity level changes, the resistance between both of the electrodes or conductivity also changes correspondingly.
- This change is conductivity or resistance is estimated and processed by an internal IC.
- And hence a micro-controller becomes able to read this value and provides us the precise value.
- I have also provided the visual description of humidity sensing using DHT11 sensor, as given in the figure shown below.
I have also made some LabVIEW simulations for temperature measuring and conversion, their links are shared below.
4. Apparatus Required for DHT11 Arduino Interfacing
- DHT11 Sensor (Temperature and humidity sensor)
- Arduino UNO (Micro-controller
- Jumper wires
- DHT11 library (You can download from the button below)
5. DHT11 & Arduino Pin Connections
- The connections between Arduino and DHT11 pins are shown in the figure given below.
- The animated wiring diagram is also provided in the below section.
- Before hardware interfacing we must interface the entire circuit on Proteus for the verification of results.
- I have shared Interfacing of LM35 with Arduino in Proteus ISIS in my previous tutorial.
- 18B20 is another temperature sensor available in both water proof and non-water proof structures.
- I have also shared a complete detailed article about How to use 18B20 in Proteus ISIS.
6. DHT11 Interfacing with Arduino Wiring Diagram
- In my previous tutorial, I have shared Interfacing of LM35 with PIC Microcontroller, so you should first need to go through this article.
- I have also written detailed tutorial on Interfacing of Temperature Sensor 18B20 with Arduino, so you should have a look at this article.
- You can also design a complete project on interfacing of more than one temperature sensors by taking help from Interfacing of Multiple DS18B20 Arduino.
- I have provided the completely labeled wiring diagram for DHT11 Arduino Interfacing.
- You can test your results by making the similar wiring diagram.
- Wiring diagram for DHT11 Arduino Interfacing is given in the figure shown below.
7. DHT11 Interfacing with Arduino Source Code & Description
- If you have not written Arduino code before, you must have a look at How to Write Arduino Code.
- You just need to copy and paste the source code given below in your Arduino software.
- After that just upload the code into your Arduino board to test the results.
#include<dht.h>// DHT11 humidity sensor library
dht DHT; //Creating sensor object
#define DHT11_PIN 2 // Sensor is connected to Arduino pin 2
Serial.begin(9600); //setting baud rate
Serial.println(" || Welcome to Temperarue and Humidity Detector ||");
void loop()//method used to run the code repeatedly
int chk = DHT.read11(DHT11_PIN); //Reading data from sensor
Serial.print(" Humidity = ");//prints on the serial monitor
Serial.print(DHT.humidity);// prints obtained humidity on serial port
Serial.print(" \tTemperature = ");//prints on the serial monitor
Serial.print(DHT.temperature, 1);//prints obtained temperature on serial port
delay(2000);//adding the delay of 2 seconds
- First of all I have defined the library for DHT11 sensor.
- After that I have read humidity and temperatures values from Arduino in digital form.
- Then I have printed the digital values of both humidity and temperature on the Arduino Serial Monitor.
- We can print the values obtained from the sensor on serial monitor using Serial Communication.
- So that was the brief description about DHT11 interfacing with Arduino.
- You can download DHT11 library, wiring diagram and complete Arduino source code here by clicking on the button below.
8. Temperature & Humidity Results on Serial Monitor
- I have printed the digital values obtained from DHT11 sensors.
- Both temperature and humidity digital values are given in the figure shown below.
9. DHT11 Temperature Sensing Characteristics
- The temperature sensing characteristics of DHT11 sensor is listed in the table given in the figure shown below.
10. DHT11 Humidity Sensing Characteristics
- The humidity sensing characteristics of DHT11 sensor is listed in the table given in the figure shown below.
11. DHT11 Sensor Interfacing with Arduino Actual Circuit Diagram
- I have provided an actual circuit diagram for DHT11 sensor interfacing with Arduino.
- Actual circuit diagram is given in the figure shown below.
12. DHT11 Sensor Ratings
- To estimate the amount of power, voltage and other specifications of any device we must take help through its ratings.
- DHT11 ratings are provided in the table given in the figure shown below.
13. DHT11 Sensor Features
- The features are such parameters depending upon which a device can be flopped as well as features can make a device more popular due to their uniqueness.
- DHT11 major features are provided in the table given in the figure shown below.
14. DHT11 Sensor Applications
- Most of the devices are usually known by their range of applications.
- DHT11 sensor applications are given in the table shown in the figure below.
That is all from today’s tutorial. If you have any problem you can ask me in comments any time you want. Till my next tutorial bye 🙂