If you are looking at a DHT11 sensor diagram for the first time, the three-pin module looks deceptively simple. However, beneath that blue plastic grid lies a strict, timing-dependent digital protocol that frequently trips up beginners who assume it outputs a simple analog voltage. The DHT11 is a rite of passage for embedded hobbyists, but understanding its exact electrical behavior—and knowing exactly when to throw it in the parts bin in favor of a better sensor—is what separates a working prototype from a reliable build.
This guide gives you the exact wiring parameters, the raw-to-unit bit math, the physical failure modes you will encounter on the bench, and a final decision matrix to ensure you are using the right tool for the job.
The DHT11 Sensor Diagram and Pinout
Whether you are using the bare 4-pin component or the more common 3-pin breakout module (which includes the pull-up resistor and decoupling capacitor on the PCB), the interface relies on a single data line. The DHT11 operates on a wide supply range, making it compatible with both 5V Arduino boards and 3.3V ESP32/Raspberry Pi Pico microcontrollers.
| Pin | Function | Connection Details & Constraints |
|---|---|---|
| VCC (Pin 1) | Power Supply | 3.3V to 5.5V DC. Do not exceed 5.5V or the internal NTC will drift permanently. |
| DATA (Pin 2) | Serial I/O | Requires a 4.7kΩ to 10kΩ pull-up resistor to VCC. (Usually included on 3-pin modules). |
| NC (Pin 3) | No Connect | Internally unconnected on the bare component. Ignore on 3-pin modules. |
| GND (Pin 4) | Ground | Common ground with the microcontroller. Essential for logic level reference. |
Inside the Blue Box: Sensing Principle and Digital Output
The DHT11 measures humidity using a capacitive sensing element. A polymer dielectric material is sandwiched between two conductive electrodes; as ambient moisture increases, the dielectric constant changes, altering the capacitance. Temperature is measured simultaneously via a surface-mounted NTC (Negative Temperature Coefficient) thermistor. As the temperature rises, the resistance of the thermistor drops predictably.
Critically, the output is strictly digital, not analog. An internal 8-bit microcontroller samples the analog capacitance and resistance, applies factory-programmed calibration coefficients stored in its OTP (One-Time Programmable) memory, and outputs a serialized 40-bit data frame. No user calibration or analog scaling math is required. The sensor handles the ADC conversion internally. You cannot read this sensor with an ADC pin or a standard multimeter; it requires a GPIO pin toggling via a strict single-bus timing protocol.
Decoding the 40-Bit Protocol: Raw Reading to Physical Units
Because the DHT11 uses a proprietary single-bus protocol (not I2C or SPI), the microcontroller must pull the data line LOW for at least 18ms to wake the sensor, then release it. The sensor responds by pushing 40 bits of data out serially, where a logical '0' is a 50µs LOW followed by a 26µs HIGH, and a logical '1' is a 50µs LOW followed by a 70µs HIGH.
Here is the exact structure of the 40-bit payload:
- Byte 0: Relative Humidity Integral (8 bits)
- Byte 1: Relative Humidity Decimal (8 bits)
- Byte 2: Temperature Integral (8 bits)
- Byte 3: Temperature Decimal (8 bits)
- Byte 4: Checksum (8 bits)
Raw-to-Unit Math Worked Example
Let us assume your logic analyzer or microcontroller buffer captures the following 5 raw bytes in hexadecimal: 0x2D, 0x00, 0x1C, 0x00, 0x49.
Step 1: Verify the Checksum
The checksum is the sum of the first four bytes, masked to 8 bits.
0x2D (45) + 0x00 (0) + 0x1C (28) + 0x00 (0) = 0x49 (73).
Since 73 matches the 5th byte, the data frame is valid. If it does not match, discard the reading and retry.
Step 2: Extract Physical Units
Humidity: Byte 0 + (Byte 1 * 0.1) = 45 + (0 * 0.1) = 45.0% RH
Temperature: Byte 2 + (Byte 3 * 0.1) = 28 + (0 * 0.1) = 28.0°C
0x00. The decimal bits are primarily utilized by the higher-resolution DHT22 (AM2302) sensor, which shares the exact same protocol.
Common Interference Sources and Wiring Mistakes
If your serial monitor is spitting out NaN or failing checksums, you are likely falling victim to one of these physical layer issues:
- Parasitic Wire Capacitance: The single-bus protocol relies on microsecond-level timing edges. If your jumper wires exceed 1 meter (approx. 3 feet), the parasitic capacitance of the wire will round off the sharp digital edges, causing the microcontroller to misread '1's as '0's. Keep wires under 50cm for reliable operation.
- Polling Rate Violations: The DHT11 requires a minimum of 1 second between read commands to perform its internal sampling cycle. If your
loop()polls the sensor every 200ms, the sensor will lock up or return stale cached data. Implement a strict non-blocking timer (e.g.,millis()check) to enforce a 2000ms polling interval. - Thermal Bleed: The DHT11's NTC thermistor is highly susceptible to localized heat. Mounting the sensor directly above an ESP32's voltage regulator or a breadboard power rail will artificially inflate your temperature readings by 2°C to 4°C.
- Interrupt Collisions: Because the protocol requires bit-banging with precise microsecond delays, background interrupts (like WiFi stack operations on an ESP8266 or Servo library timers on an Arduino Uno) can pause the CPU mid-read, destroying the timing. Disable interrupts during the 40-bit read sequence if using bare-metal code.
Decision Tree: DHT11 vs. DHT22 vs. BME280
The DHT11 is cheap, but it is fundamentally a toy-grade sensor. Its humidity accuracy is ±5% (in a limited 20-80% range), and its temperature accuracy is ±2°C. Before you solder it into a permanent enclosure, run your project requirements through this decision matrix to ensure you are not building on a flawed foundation.
| Project Requirement | DHT11 | DHT22 (AM2302) | Bosch BME280 |
|---|---|---|---|
| Communication Protocol | Proprietary Single-Bus | Proprietary Single-Bus | Standard I2C / SPI |
| Temp Range & Accuracy | 0 to 50°C (±2.0°C) | -40 to 80°C (±0.5°C) | -40 to 85°C (±1.0°C) |
| Humidity Range & Accuracy | 20 to 80% (±5%) | 0 to 100% (±2%) | 0 to 100% (±3%) |
| Max Polling Rate | 1 Hz (1 sec) | 0.5 Hz (2 sec) | Fast (I2C bus speed) |
| Approx. Module Cost (2026) | $1.00 - $1.50 | $4.00 - $6.00 | $5.00 - $9.00 |
The Final Verdict and Concrete Pick
If you are building a weekend learning project just to understand how to bit-bang a protocol and read a datasheet timing diagram, use the DHT11. It is the ultimate educational tool for learning microsecond timing.
If you are building a functional smart home node, greenhouse monitor, or weather station, stop using the DHT family entirely. The single-bus protocol is fragile, blocks the CPU, and fails over long wire runs.
For deeper protocol analysis and alternative library implementations, refer to the Adafruit DHT Sensor Library documentation and the official Bosch Sensortec BME280 datasheet.






