

The DHT20 is a digital temperature and humidity sensor that provides accurate readings of environmental conditions. It integrates a capacitive humidity sensor and a thermistor to measure relative humidity and temperature, respectively. The DHT20 communicates via an I²C digital signal, making it easy to interface with microcontrollers and other digital systems. Its compact size and low power consumption make it ideal for a wide range of applications.








The DHT20 sensor is designed for precision and reliability. Below are its key technical details:
| Parameter | Value |
|---|---|
| Operating Voltage | 2.2V to 5.5V |
| Operating Current | 0.5mA (average) |
| Temperature Range | -40°C to 80°C |
| Temperature Accuracy | ±0.5°C |
| Humidity Range | 0% to 100% RH |
| Humidity Accuracy | ±3% RH (typical) |
| Communication Protocol | I²C |
| I²C Address | 0x38 |
| Sampling Period | Minimum 1 second |
| Dimensions | 10mm x 10mm x 3.2mm |
The DHT20 has four pins, as described in the table below:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin (2.2V to 5.5V) |
| 2 | SDA | I²C data line for communication |
| 3 | GND | Ground connection |
| 4 | SCL | I²C clock line for communication |
The DHT20 is straightforward to use in a circuit, especially with microcontrollers like the Arduino UNO. Below are the steps to integrate and use the DHT20:
Below is an example Arduino sketch to read temperature and humidity data from the DHT20:
#include <Wire.h> // Include the Wire library for I²C communication
#include "DHT20.h" // Include the DHT20 library (install via Arduino Library Manager)
DHT20 dht20; // Create a DHT20 object
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
Wire.begin(); // Initialize I²C communication
dht20.begin(); // Initialize the DHT20 sensor
Serial.println("DHT20 Sensor Initialized");
}
void loop() {
// Read temperature and humidity from the DHT20
float temperature = dht20.readTemperature(); // Get temperature in Celsius
float humidity = dht20.readHumidity(); // Get relative humidity in %
// Check if the readings are valid
if (dht20.getStatus() == 0) {
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
} else {
Serial.println("Error reading from DHT20 sensor");
}
delay(2000); // Wait for 2 seconds before the next reading
}
No data or incorrect readings from the sensor:
Error messages in the Arduino serial monitor:
Slow or inconsistent readings:
Q: Can the DHT20 measure negative temperatures?
A: Yes, the DHT20 can measure temperatures as low as -40°C.
Q: Is the DHT20 waterproof?
A: No, the DHT20 is not waterproof. For outdoor or high-humidity environments, use a protective enclosure.
Q: Can I use the DHT20 with a 3.3V microcontroller?
A: Yes, the DHT20 operates within a voltage range of 2.2V to 5.5V, making it compatible with 3.3V systems.
Q: How accurate is the DHT20 compared to other sensors?
A: The DHT20 offers a typical humidity accuracy of ±3% RH and temperature accuracy of ±0.5°C, which is suitable for most applications requiring moderate precision.
By following this documentation, you can effectively integrate and use the DHT20 sensor in your projects.