[otw_is sidebar=otw-sidebar-1]Arduino interface with DHT11 sensor,Arduino DHT11 sensor and lcd,
In this post I will discuss about the DHT11 sensor and its interfacing with Arduino. In the previous posts I have discussed about the working of important sensors and actuators and their simulation in Proteus. This post will be oriented around the discussion on the DHT11 sensor only.
After reading this post the reader will be able to learn about the DHT11 sensor and its interfacing with Arduino. The discussion in this post about the interfacing of the DHT11 sensor and Arduino is general so that the text can help to hook up any sensor with the Arduino microcontroller. So sit back, keep reading and enjoy learning.

How to Simulate Arduino in Proteus

[otw_is sidebar=otw-sidebar-2]

DHT11 Sensor:

Before diving deep into the discussion on the interfacing of the Arduino microcontroller development board and DHT11 sensor let us first what the DHT11 sensor is? DHT11 sensor is used to measure the temperature and humidity of the surroundings in which it is installed. It is important to note here that this sensor measures both the temperature and humidity simultaneously that is on each request for data from the microcontroller the DHT11 sensor generates the data packets containing the information about both the temperature and humidity. The DHT11 sensor is digital that is provides data in digital form it is opposite to thermistor whose values for temperature measurement are analog in nature. The DHT11 temperature and humidity sensor measures temperature using NTC (Negative temperature measurement co-efficient) temperature measurement component and on the other measures humidity using resistive-type humidity measurement component. The data that is the reading of the temperature and humidity is provided over the single terminal called the Data bus. The detailed discussion on the data transmission from the DHT11 sensor to the microcontroller will be done in the following section. The DHT11 sensor looks like the one in the following image:

[otw_is sidebar=otw-sidebar-3]

dht11 pinout,dht11 data sheet

DHT11  pinout:

As shown in the above figure that the DHT11 sensor has total four pins. Two pins are for power supply, one is used for data communication and the last is left not connected. The DHT11 sensor can work from voltage of 3 volts to 5.5 volts. Let us now see how the DHT11 transfer data from its single terminal.



dht11 pinout,dht11 data sheet





DHT11 sensor data Acquisition:


[otw_is sidebar=otw-sidebar-2]

In this we will see how the DHT11 sensor transfers its data to the microcontroller. As we learned in the previous section that the DHT11 temperature and humidity sensor is the digital sensor which means that this sensor provides the data at its output terminal in the digital format. It is important to note here that the DHT11 sensor provides the digital data following a particular protocol. This format in which the DHT11 temperature and humidity sensor transfers the data is called the 1-wire format or single data bus format. Data provided by the DHT11 sensor consists of two parts 1) Decimal part and 2) Integral part. The complete data consists of total eighty bits and the DHT11 sensor is programmed to deliver HIGHER bit first.
The microcontroller which is connected to the DHT11 sensor sends the start signal to the DHT11 sensor which activates the sensor. After being activated the DHT11 sensor responds to the start signal in the form of the forty bit data which contains the information about the relative humidity and the temperature. It is important to note here that the DHT11 sensor will not deliver the data unless the microcontroller sends the start signal to the sensor. The microcontroller sends the start signal by setting the single data bus low from high for at least 18 millisecond so that DHT11 can ensure detection then pull up the voltage and wait for 20-40 microsecond for the DHT11 sensor response. This is depicted in the following figure:


DHT11 sensor data Acquisition



Technical Specifications:

Let us have the brief review of the technical specifications of the DHT11 sensor as shown in following table:


dht 11 Technical Specifications


Let us now have a look at the detailed specifications of the DHT11 sensor:


Arduino DHT11 Temperature and Humidity Sensor Interface:


After we have learned about the basics of the DHT11 sensor let us now see how to interface the DHT11 sensor with Arduino. As we have seen in the pin description of the DHT11 sensor that the sensor has total four pins two out of these four are power pins, one is the data pin and the other pins is NULL (not connected). So the power pins that is Vcc and GND are connected to the 3V3 and GND of the Arduino respectively. Note here that the DHT11 sensor can operate from 3 volts to 5.5 volts. The data pin of the DHT11 sensor is connected to the digital Input / Output pin of the Arduino. The generalized diagram for the DHT11 sensor interface with the microcontroller is shown in the following figure:

The DHT11 sensor is hooked up with the Arduino as shown in the following figure:

Arduino DHT11  Circuit:

[otw_is sidebar=otw-sidebar-3]

As can be seen in the figure that the circuit is quite straightforward. Let us now see the coding of the Arduino in order to work with the DHT11 sensor.

Arduino DHT11 Code:

#include<dht.h>// DHT11 humidity sensor library
dht DHT; //Creating sensor object
#define DHT11_PIN 2 // Sensor is connected to Arduino pin 2
void setup()
  Serial.begin(9600); //setting baud rate
  Serial.println("   =====================================================");
  Serial.println("   ||   Welcome to Temperarue and Humidity Detector   ||");
  Serial.println("   =====================================================");
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(" g/m^3");
  Serial.print("    \tTemperature = ");//prints on the serial monitor
  Serial.print(DHT.temperature, 1);//prints obtained temperature on serial port
  Serial.println(" degrees");
  delay(2000);//adding the delay of 2 seconds



Dht11 Simulation in Proteus

here is the simulation of dht11 in Proteus

dht11 sensor in proteus




click here  for download simulation files


Multiple DHT11 Interfacing with Arduino

here is the Multiple DHT11 Interfacing with Arduino







lm35 temperature sensor


That is all for now I hope this post will be helpful for you. In the next post I will come up with more interesting topics. Till then stay connected, keep reading and enjoy learning.