portfolio

What is a DHT22 sensor?

Course Content
Session 1: Introduction to ESP32
Objective: Get familiar with the ESP32 microcontroller and set up the development environment.
0/5
Session 2: Interfacing with Sensors and Displays
Learn how to connect a DHT22 sensor and an OLED display to the ESP32.
0/4
Session 4: Programming the OLED Display
Objective: Write code to display information on the OLED display.
0/4
Session 5: Integrating Sensor Data with OLED Display
Objective: Combine sensor readings with OLED display functionality.
0/1
Session 6: Setup WIFI Capability
0/1
Session 7: Adding a Webserver
0/1
Session 8: Wrap-up
0/1
ESP32 Basics
About Lesson

The DHT22 (also known as the AM2302) is a digital sensor used to measure temperature and humidity. It is widely used in electronics projects, especially with microcontrollers like Arduino, Raspberry Pi, and ESP8266, due to its ease of use and affordability. Here’s a breakdown of its features and functionality:

Key Features:

  1. Temperature Measurement:
    • Range: -40°C to +80°C
    • Accuracy: ±0.5°C
  2. Humidity Measurement:
    • Range: 0 to 100% Relative Humidity (RH)
    • Accuracy: ±2% RH
  3. Output: Digital data is sent to a microcontroller via a single-wire protocol.
  4. Power Supply: Operates on 3.3V to 5.5V, making it compatible with most microcontrollers.
  5. Response Time: Typically around 2 seconds (can vary slightly depending on conditions).
  6. Size: Compact form factor, making it easy to integrate into small projects.

How It Works:

The DHT22 sensor contains two components:

  • Thermistor: Measures temperature.
  • Capacitive Humidity Sensor: Measures relative humidity.

It reads environmental temperature and humidity data, then converts these analog readings into a digital signal. The sensor communicates this data to the microcontroller through a simple, single-wire communication protocol, where the microcontroller can interpret and use the readings.

Applications:

  • Weather stations
  • Home automation (monitoring room conditions)
  • HVAC (heating, ventilation, air conditioning) systems
  • Agricultural or greenhouse monitoring
  • Data logging systems for temperature and humidity tracking

Overall, the DHT22 is a reliable and accurate sensor used in a wide variety of environmental monitoring projects.

The DHT22 comes in both a 3 pin and a 4 pin variant. 

3-Pin DHT22:

  1. Pin 1: VCC – Power supply (3.3V to 5V).
  2. Pin 2: DATA – Data signal (communicates with the microcontroller).
  3. Pin 3: GND – Ground (connected to the common ground of the circuit).
  • Internal Pull-up Resistor: In the 3-pin version, the pull-up resistor for the data line is usually built into the sensor, meaning you don’t need an external one to pull the data pin to a high state.

4-Pin DHT22:

  1. Pin 1: VCC – Power supply (3.3V to 5V).
  2. Pin 2: DATA – Data signal (communicates with the microcontroller).
  3. Pin 3: NC (No Connection) – This pin is not used.
  4. Pin 4: GND – Ground (connected to the common ground of the circuit).
  • External Pull-up Resistor: The 4-pin version generally requires an external pull-up resistor (typically 4.7kΩ to 10kΩ) between the data pin and the VCC to ensure stable data transmission.

Key Differences:

  • The 3-pin DHT22 has the pull-up resistor integrated, which simplifies wiring.
  • The 4-pin DHT22 requires an external pull-up resistor for the data pin, and one of the pins is unused.

In most cases, functionality and performance are the same, but the wiring configuration differs slightly based on whether the pull-up resistor is internal or external.