DHT11 Sensor: Inside Look & Arduino Temp-Humidity Measurement

The DHT11 Temperature & Humidty Sensor

In this tutorial, I will show you what is inside the DHT11 temperature and humidity sensor, and I’ll explain how it works and how to use it with Arduino.

Specifications

  • Temperature Measurement Range: 0–50°C
  • Humidity Measurement Range: 20–90%
  • Operating Voltage: 3–5V
  • Maximum current consumption: 2.5 mA
  • Sampling Rate: 1 Hz (measures the temperature and the humidity every 1 second)

What is Inside a DHT11 Sensor

Inside the blue cover of the DHT11 sensor, there are two main components:
Initially, there is an integrated circuit (IC) that includes a built-in negative temperature coefficient (NTC) sensor, a type of variable resistor that responds to temperature changes.
As the temperature rises, the resistance decreases, and conversely, as the temperature falls, the resistance increases.

Secondly, the humidity sensing component consists of two electrodes placed atop a substrate that retains moisture and is sensitive to humidity levels.
As humidity levels rise, the resistance between the two electrodes falls, and as humidity levels drop, the resistance between them rises.

DHT11 humidity sensing component

Measuring the Temperature and Humidity Using Arduino

The DHT11 sensor comes with an integrated communication protocol that enables data transmission with precise timing. As per the datasheet, to achieve the right communication between the sensor and an Arduino board, we need to develop a code that toggles a digital pin between high and low states for different specified durations. However, downloading the DHT11 library will facilitate our coding and take care of all the given instructions.

After completing the connections as shown above, open your Arduino IDE, navigate to Sketch > Include the Library > Add a ZIP Library, and then choose the ZIP file you have downloaded.
Copy the next sketch and upload it to your Arduino board, and once you open the serial monitor, you should see the readings of your sensor.

#include <dht.h>
#define outPin 2
dht DHT;
void setup() {
  Serial.begin(9600);
}
void loop() {
  int readData = DHT.read11(outPin);
  float t = DHT.temperature;
  float h = DHT.humidity;
  Serial.print("Temperature = ");
  Serial.print(t);
  Serial.println("°C");
  Serial.print("Humidity = ");
  Serial.print(h);
  Serial.println("%");
  Serial.println("");
  delay(2000);
}

Sources

Scroll to Top