DHT11 Temperature and Humidity Sensor with Arduino
DHT11 Humidity and Temperature Sensor, How to Use DHT11 with Arduino, DIY Projects, Read Values of Temperature and Humidty
Adding humidity and temperature data to your do-it-yourself electronics projects is a breeze with the DHT11 humidity and temperature sensor. It is ideal for farm or garden monitoring systems, home environmental management systems, and distant weather stations.
Relative humidity is measured via the DHT11. The difference between the amount of water vapor in the air and its saturation point is known as relative humidity. Water vapor begins to condense at the saturation point and gather on surfaces to form dew.
By detecting the electrical resistance between two electrodes, the DHT11 is able to detect water vapor. A moisture-holding substrate with electrodes attached to its surface serves as the humidity sensor component. A surface-mounted NTC temperature sensor (thermistor) integrated inside the DHT11 allows it to sense temperature.
Please find the dht11 sensor’s datasheet at this link for detailed information.
For data transmission to the Arduino, the DHT11 just needs one signal line. Separate 5V and ground wires supply power. To ensure that the signal level remains high by default, a 5K Ohm pull-up resistor must be placed between the signal line and the 5V line.
The DHT11 is available in two variants that you may encounter. Two varieties are available: one with four pins and the other installed on a tiny PCB with three pins. A surface mounted 5K Ohm pull up resistor for the signal line is included in the PCB mounted version, which makes it pleasant.

We are going to use 3 pin version which has mounted resistor.
DHT11 Sensor Wiring Diagram of Arduino


Code for Example DHT11 Sensor Use
Before start , don’t forget to download dht11 library for your Arduino board.
#include <dht11.h> //adding library of dht11
#define DHT11PIN 2 //setting up the digital pin 2 of Arduino
dht11 DHT11;
void setup()
{
Serial.begin(9600);
//starting serial communication to monitor outputs on Arduino IDE
}
void loop()
{
Serial.println();
int Chk = DHT11.read(DHT11PIN);
Serial.print("Humidity (%): ");
Serial.println((float)DHT11.humidity, 2);
Serial.print("Temperature (C): ");
Serial.println((float)DHT11.temperature, 2);
delay(3000);
}
Output of DHT11 Sensor on Serial Monitor

