What is a HTU21D sensor ?
The HTU21D is a digital relative humidity and temperature sensor with a calibrated and compensated I²C output.
It is often compared to the SHT21 from Sensirion, with which it shares a nearly identical design and protocol.
It is a reliable, stable, and cost-effective sensor, ideal for IoT, weather, home automation, or HVAC applications.
Operating principle
The sensor combines:
- a polymer capacitive cell sensitive to humidity,
- an integrated temperature sensor (for RH compensation),
- a 14-bit ADC converter, and a calibration EEPROM.
The measurements are compensated and converted into physical values from the raw data using standardized formulas:
RH(%) = −6 + 125 × (S_RH / 65536)
T(°C) = −46,85 + 175,72 × (S_T / 65536)
Temperature / Humidity Curve (examples)
| Raw measurement (hex) | Temperature (°C) | Humidity (%) |
| 0x0000 | −46,8 | 0,0 |
| 0x8000 | +41,0 | 62,5 |
| 0xFFFF | +128,9 | 119,0 |
💡 The formulas are linear and factory calibrated.
Principle diagram (I2C connection)
+3.3V │ [HTU21D] │ SDA ─────────┐ │ SCL ─────────┤── [I²C Microcontroller │ GND
💡 Fixed I²C address: 0x40.
Application areas
🌦️ Weather stations and IoT sensors
🏠 Home automation and HVAC
🧠 Low-power embedded applications
🧪 Surface temperature/humidity measurement
🕹️ DIY environmental sensors (Arduino, ESP32, Raspberry Pi)