The DHT12 is a digital temperature and humidity sensor by Aosong Electronics — the same manufacturer behind the DHT11. It measures both environmental parameters and outputs calibrated digital data, but adds something the DHT11 never had: an I2C interface alongside the original single-wire protocol. That dual-interface design makes it a more flexible drop-in for projects where I2C is already in use and adding another single-wire device would complicate the firmware.
What is DHT12?

The DHT12 is an upgraded version of the DHT11, supporting both I2C and 1-wire interfaces while measuring and reporting relative humidity and temperature with a checksum for data validity.
The I2C communication uses the standard protocol sequence, allowing the sensor to be connected directly to an existing I2C bus with no additional wiring. The communication mode is selected automatically at power-on based on the state of the SCL pin — held low for single-wire mode, held high for I2C mode — so no firmware configuration is needed to switch between them.
DHT12 overview
| Parameter | Value |
|---|---|
| Sensor Type | Digital Temperature & Humidity Sensor |
| Operating Voltage | 2.7V – 5.5V |
| Current Consumption | 800µA (during measurement) |
| Temperature Range | −20°C to +60°C |
| Humidity Range | 20% to 95% RH |
| Output Type | Digital (I2C or 1-Wire) |
| Temperature Accuracy | ±0.5°C |
| Humidity Accuracy | ±5% RH |
| I2C Address | 0x5C (fixed) |
| Communication | I2C / Single-Wire (1-Wire compatible) |
| Mounting Type | Through Hole (SIP-4) |
| Compatible Boards | Arduino Uno, ESP32, Raspberry Pi |
Pinout

| Pin Name | Type | Description |
|---|---|---|
| VDD | Power | Supplies power to the sensor (2.7V – 5.5V) |
| SDA | Data | I2C data line / Single-wire data line |
| GND | Power | Ground connection |
| SCL | Clock | I2C clock line; connect to GND for 1-wire mode |
Note: SDA and SCL require pull-up resistors of 5kΩ to 10kΩ connected to VDD for I2C operation. To switch to 1-wire mode, connect SCL directly to GND — the sensor detects this at power-on and switches protocols automatically.
Working Principle
The DHT12 uses a capacitive humidity sensing element and an NTC thermistor internally, with an onboard microcontroller that converts both readings into digital values and transmits them over the selected interface.
When read over I2C, the sensor returns five bytes in the following format: relative humidity integer value, relative humidity decimal value, temperature integer value, temperature decimal value, and a checksum calculated as the sum of the first four bytes.
For example, a response of 0x32 0x00 0x17 0x04 0x4D decodes as:
- Humidity: 50.0% RH
- Temperature: 23.4°C
- Checksum: 0x4D
The sensor mode is determined at power-on by the SCL line state — when SCL is held low at startup, the sensor enters single-wire mode fully compatible with the DHT11 protocol; when SCL is held high, it enters I2C mode. This means existing DHT11 code and wiring can be reused directly, with the I2C path available as an upgrade when needed.
DHT12 Hardware Overview
The DHT12 packs several functional blocks into its compact SIP-4 package.
1. Capacitive Humidity Sensor A hygroscopic dielectric material sandwiched between two electrodes forms a small capacitor. As moisture is absorbed, the capacitance changes in proportion to relative humidity, which the internal MCU measures and converts to a percentage value.
2. NTC Thermistor A negative temperature coefficient resistor whose resistance decreases predictably with rising temperature. The internal MCU reads this resistance and converts it to degrees Celsius.
3. Internal 8-bit Microcontroller Reads both sensing elements, performs the conversion, packages the result into the 5-byte response format, and manages both communication protocols.
4. Dual Interface Logic A protocol selection circuit that monitors the SCL pin state at power-on to determine whether to operate in I2C or single-wire mode, with no external switching components required.
5. Calibration OTP Memory Factory-written one-time programmable memory storing calibration coefficients for both temperature and humidity, eliminating the need for field calibration.
Specifications
Here are the key detailed specifications below.
| Parameter | Value |
|---|---|
| Supply Voltage | 2.7V – 5.5V |
| Supply Current | 800µA (measurement), standby µA range |
| Temperature Range | −20°C to +60°C |
| Humidity Range | 20% to 95% RH |
| Temperature Accuracy | ±0.5°C (at 25°C, 5V, non-condensing) |
| Humidity Accuracy | ±5% RH |
| Temperature Resolution | 0.1°C |
| Humidity Resolution | 0.1% RH |
| Sampling Rate | Max once every 2 seconds |
| Communication | I2C (fixed address 0x5C) / 1-Wire |
| 1-Wire Compatibility | Fully compatible with DHT11 protocol |
| Pull-up Resistor | 5kΩ – 10kΩ (SDA and SCL for I2C) |
| Data Format | 5 bytes (2 humidity + 2 temperature + checksum) |
| Package | SIP-4 (2.54mm pin spacing) |
| Dimensions | 12.3mm × 7.5mm × 4.7mm |
| Operating Temperature | −20°C to +60°C |
| Storage Temperature | −40°C to +70°C |
Helpful resources
- Download the datasheet: PDF here
- DHT12 with Arduino
- DHT12 with ESP32