Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use DHT20: Examples, Pinouts, and Specs

Image of DHT20
Cirkit Designer LogoDesign with DHT20 in Cirkit Designer

Introduction

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

Explore Projects Built with DHT20

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino Mega 2560 with Multiple DHT Sensors for Environmental Monitoring
Image of Schematic Diagram: A project utilizing DHT20 in a practical application
This circuit is designed to monitor temperature and humidity using two DHT22 sensors and one DHT11 sensor, all controlled by an Arduino Mega 2560. The sensors are powered by the Arduino and communicate with it through digital pins D2, D3, and D4. The provided code is a template for implementing the sensor data acquisition logic.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Mega 2560-Based Temperature and Humidity Monitor with DHT22 Sensor
Image of karakterisasi dht: A project utilizing DHT20 in a practical application
This circuit uses an Arduino Mega 2560 to read temperature and humidity data from a DHT22 sensor. The sensor is powered by the Arduino's 5V and GND pins, and its data output is connected to the Arduino's digital pin D2. The Arduino is programmed to process and potentially transmit this data.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO R4 WiFi Controlled Temperature and Humidity Sensor with LED Indicator
Image of Z1 P2: A project utilizing DHT20 in a practical application
This circuit features an Arduino UNO R4 WiFi microcontroller connected to a DHT22 sensor for measuring temperature and humidity. The DHT22's data line is connected to digital pin D2 on the Arduino, while its power and ground are supplied by the Arduino's 5V and GND pins, respectively. Additionally, there is a red LED with a series resistor connected to digital pin D3 on the Arduino, which could be used for status indication.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP-8266 Based Environmental Monitoring System
Image of PHD: A project utilizing DHT20 in a practical application
This circuit features an ESP-8266 microcontroller connected to a BMP180 barometric pressure sensor, a BH1750 light intensity sensor, and a DHT22 temperature and humidity sensor. The ESP-8266 uses its I2C interface, with pins D1 and D2 connected to the SCL and SDA lines of both the BMP180 and BH1750, to communicate with the sensors. The DHT22 sensor is connected to a digital pin (D4) for direct signal reading, and all sensors share common power (3V3) and ground (GND) connections with the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with DHT20

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Schematic Diagram: A project utilizing DHT20 in a practical application
Arduino Mega 2560 with Multiple DHT Sensors for Environmental Monitoring
This circuit is designed to monitor temperature and humidity using two DHT22 sensors and one DHT11 sensor, all controlled by an Arduino Mega 2560. The sensors are powered by the Arduino and communicate with it through digital pins D2, D3, and D4. The provided code is a template for implementing the sensor data acquisition logic.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of karakterisasi dht: A project utilizing DHT20 in a practical application
Arduino Mega 2560-Based Temperature and Humidity Monitor with DHT22 Sensor
This circuit uses an Arduino Mega 2560 to read temperature and humidity data from a DHT22 sensor. The sensor is powered by the Arduino's 5V and GND pins, and its data output is connected to the Arduino's digital pin D2. The Arduino is programmed to process and potentially transmit this data.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Z1 P2: A project utilizing DHT20 in a practical application
Arduino UNO R4 WiFi Controlled Temperature and Humidity Sensor with LED Indicator
This circuit features an Arduino UNO R4 WiFi microcontroller connected to a DHT22 sensor for measuring temperature and humidity. The DHT22's data line is connected to digital pin D2 on the Arduino, while its power and ground are supplied by the Arduino's 5V and GND pins, respectively. Additionally, there is a red LED with a series resistor connected to digital pin D3 on the Arduino, which could be used for status indication.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of PHD: A project utilizing DHT20 in a practical application
ESP-8266 Based Environmental Monitoring System
This circuit features an ESP-8266 microcontroller connected to a BMP180 barometric pressure sensor, a BH1750 light intensity sensor, and a DHT22 temperature and humidity sensor. The ESP-8266 uses its I2C interface, with pins D1 and D2 connected to the SCL and SDA lines of both the BMP180 and BH1750, to communicate with the sensors. The DHT22 sensor is connected to a digital pin (D4) for direct signal reading, and all sensors share common power (3V3) and ground (GND) connections with the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Weather monitoring stations
  • HVAC (Heating, Ventilation, and Air Conditioning) systems
  • IoT (Internet of Things) devices
  • Greenhouse monitoring
  • Home automation systems
  • Industrial environmental monitoring

Technical Specifications

The DHT20 sensor is designed for precision and ease of use. Below are its key technical details:

Parameter Value
Supply Voltage (VDD) 2.2V to 5.5V
Operating Current 0.4 mA (average)
Standby Current ≤ 0.5 µA
Humidity Range 0% to 100% RH
Humidity Accuracy ±3% RH (typical)
Temperature Range -40°C to 80°C
Temperature Accuracy ±0.5°C (typical)
Communication Interface I²C
I²C Address 0x38
Response Time ≤ 1 second
Dimensions 10mm x 10mm x 3.2mm

Pin Configuration and Descriptions

The DHT20 has four pins, as described in the table below:

Pin Number Pin Name Description
1 VDD Power supply (2.2V to 5.5V)
2 SDA Serial Data Line for I²C communication
3 GND Ground
4 SCL Serial Clock Line for I²C communication

Usage Instructions

How to Use the DHT20 in a Circuit

  1. Power Supply: Connect the VDD pin to a 3.3V or 5V power source and the GND pin to ground.
  2. I²C Communication: Connect the SDA and SCL pins to the corresponding I²C pins on your microcontroller. Use pull-up resistors (typically 4.7kΩ) on both SDA and SCL lines if not already present on your board.
  3. Initialization: Ensure your microcontroller initializes the I²C bus and communicates with the DHT20 using its default address (0x38).
  4. Data Reading: Send the appropriate I²C commands to read temperature and humidity data from the sensor.

Important Considerations and Best Practices

  • Power Stability: Ensure a stable power supply to avoid inaccurate readings.
  • Placement: Avoid placing the sensor near heat sources or in direct sunlight, as this may affect temperature readings.
  • Pull-Up Resistors: Verify that pull-up resistors are present on the SDA and SCL lines for proper I²C communication.
  • Startup Time: Allow the sensor to stabilize for at least 2 seconds after power-up before taking readings.
  • Data Polling: Avoid polling the sensor too frequently; a 1-second interval is recommended.

Example Code for Arduino UNO

Below is an example of how to use the DHT20 with an Arduino UNO:

#include <Wire.h> // Include the Wire library for I²C communication

#define DHT20_I2C_ADDRESS 0x38 // Default I²C address of the DHT20

void setup() {
  Serial.begin(9600); // Initialize serial communication for debugging
  Wire.begin();       // Initialize I²C communication
  delay(2000);        // Allow the sensor to stabilize after power-up
}

void loop() {
  // Request data from the DHT20
  Wire.beginTransmission(DHT20_I2C_ADDRESS);
  Wire.write(0xAC); // Command to trigger a measurement
  Wire.write(0x33); // Fixed command byte
  Wire.write(0x00); // Fixed command byte
  Wire.endTransmission();
  delay(80); // Wait for the measurement to complete

  // Read 7 bytes of data from the DHT20
  Wire.requestFrom(DHT20_I2C_ADDRESS, 7);
  if (Wire.available() == 7) {
    uint8_t data[7];
    for (int i = 0; i < 7; i++) {
      data[i] = Wire.read();
    }

    // Extract temperature and humidity data
    uint32_t rawHumidity = ((uint32_t)data[1] << 12) | ((uint32_t)data[2] << 4) |
                           ((data[3] & 0xF0) >> 4);
    uint32_t rawTemperature = (((uint32_t)data[3] & 0x0F) << 16) |
                              ((uint32_t)data[4] << 8) | data[5];

    float humidity = rawHumidity / 1048576.0 * 100.0; // Convert to %RH
    float temperature = rawTemperature / 1048576.0 * 200.0 - 50.0; // Convert to °C

    // Print the results
    Serial.print("Humidity: ");
    Serial.print(humidity);
    Serial.println(" %RH");
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.println(" °C");
  } else {
    Serial.println("Failed to read data from DHT20");
  }

  delay(1000); // Wait 1 second before the next reading
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Data from the Sensor:

    • Ensure the sensor is powered correctly and the I²C connections (SDA, SCL) are secure.
    • Verify that the correct I²C address (0x38) is being used in your code.
    • Check for the presence of pull-up resistors on the SDA and SCL lines.
  2. Inaccurate Readings:

    • Ensure the sensor is not exposed to extreme environmental conditions (e.g., direct sunlight, high humidity).
    • Allow the sensor to stabilize for at least 2 seconds after power-up.
  3. I²C Communication Errors:

    • Check the I²C bus speed; the DHT20 supports standard (100 kHz) and fast (400 kHz) modes.
    • Ensure there are no conflicting devices on the I²C bus.

FAQs

Q: Can the DHT20 be used with a 5V microcontroller?
A: Yes, the DHT20 supports a supply voltage range of 2.2V to 5.5V, making it compatible with both 3.3V and 5V systems.

Q: How often can I read data from the DHT20?
A: It is recommended to read data no more frequently than once per second to ensure accurate measurements.

Q: Do I need to calibrate the DHT20?
A: No, the DHT20 is factory-calibrated and does not require additional calibration.