Overview
The HTU21D (and HTU21DF variant with PTFE filter membrane) is a digital relative humidity and temperature sensor manufactured by TE Connectivity (formerly Measurement Specialties). Housed in a tiny 6-pin DFN package, it is widely used in weather stations, home automation HVAC controllers, and medical equipment.
Delivering typical accuracies of and , user-programmable resolution (12-bit RH / 14-bit Temp down to 8-bit / 11-bit), CRC-8 checksum verification, an onboard heating element, and an interface (0x40), the HTU21D draws an ultra-low standby current of .
Quick reference
Operating voltage (VCC) | 3.3 V to 5.0 V DC (breakout includes 3.3V LDO regulator) |
IC supply voltage (VDD) | 1.5 V to 3.6 V DC (3.3 V nominal) |
| Interface | Fast-Mode (up to 400 kHz) |
| Fixed address | 0x40 |
| Humidity range & accuracy | ( typical) |
| Temperature range & accuracy | ( typical) |
| Resolution options | 12-bit RH / 14-bit Temp (Default) or 8-bit RH / 11-bit Temp |
| Internal heater | Onboard programmable heater for sensor diagnostic & de-fogging |
| Standby current | typical at |
Pinout
Breakout module 4-pin header:
| Pin | Name | Type | Description |
|---|---|---|---|
| 1 | VIN | Power | Supply power input (+3.3 V to +5.0 V DC) |
| 2 | GND | Power | Ground reference (0 V) |
| 3 | SCL | Digital Input | Serial Clock |
| 4 | SDA | Digital Input / Output | Serial Data |
Specifications
| Parameter | Symbol | Min | Typ | Max | Unit | Conditions |
|---|---|---|---|---|---|---|
| Supply Voltage (Module) | 3.3 | 3.3 / 5.0 | 5.5 | V | Power rail with LDO | |
| Active Current | — | 450 | 500 | µA | Active conversion state | |
| Standby Current | — | 0.14 | 0.5 | µA | Sleep mode | |
| RH Accuracy () | -2.0 | +2.0 | % RH | At | ||
| Temp Accuracy () | -0.3 | +0.3 | °C | At | ||
| Measuring Time (14-bit Temp) | — | 44 | 50 | ms | Max resolution | |
| Measuring Time (12-bit RH) | — | 14 | 16 | ms | Max resolution |
Command Opcodes & Math
- Trigger Temperature Measure (Hold Master):
0xE3 - Trigger Humidity Measure (Hold Master):
0xE5 - Trigger Temperature Measure (No Hold):
0xF3 - Trigger Humidity Measure (No Hold):
0xF5
Temperature Calculation ()
Humidity Calculation ()
Wiring
| HTU21D Pin | → | Arduino / MCU | ESP32 | Notes |
|---|---|---|---|---|
VIN | 5V / 3.3V | 3.3V | Power rail | |
GND | GND | GND | System ground | |
SCL | A5 | GPIO 22 | Clock | |
SDA | A4 | GPIO 21 | Data |
Example (Adafruit_HTU21DF Library)
cpp
#include <Wire.h>
#include "Adafruit_HTU21DF.h"
Adafruit_HTU21DF htu = Adafruit_HTU21DF();
void setup() {
Serial.begin(115200);
Serial.println("Adafruit HTU21D-F Humidity & Temp Test");
if (!htu.begin()) {
Serial.println("Couldn't find HTU21D-F sensor! Check I2C wiring.");
while (1);
}
}
void loop() {
float temp = htu.readTemperature();
float rel_hum = htu.readHumidity();
Serial.print("Temp: "); Serial.print(temp); Serial.print(" °C | ");
Serial.print("Humidity: "); Serial.print(rel_hum); Serial.println(" % RH");
delay(1000);
}
Common mistakes
- Holding finger near sensor element: Human skin radiates moisture () and thermal heat. Keep hands clear of the small white PTFE sensor filter while taking ambient room measurements.
- Forgetting I2C bus address collision: HTU21D uses fixed address
0x40, which collides with HDC1080 and Si7021 sensors if placed on the same bus.
Notes
- HTU21D vs Si7021 vs SHT31: HTU21D is fully command-compatible with the Si7021; SHT31 offers higher accuracy () and configurable addresses (
0x44/0x45).
Assets & downloads
- datasheetdatasheet
- product-pagereference