Component guide · Intermediate · 3 min read
HDC1080, HDC3021, HTU31 and CHT8305 I2C Humidity Sensors

Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The HDC1080 (TI), HDC3021 (TI), HTU31 (TE) and CHT8305 are small I2C humidity and temperature sensors. The HDC1080 and CHT8305 are low-cost 14-bit parts at address 0x40. The HDC3021 adds a removable protective tape and 0.5 percent RH class accuracy, and the HTU31 adds a built-in heater and a choice of two addresses.
Key specs at a glance
- Supply
- About 2.7 to 5.5 V (HDC1080), 1.6 to 5.5 V (HDC3021), 3 to 5.5 V (HTU31)
- Interface
- I2C
- Address
- 0x40 (HDC1080, CHT8305), 0x44 to 0x47 (HDC3021), 0x40 or 0x41 (HTU31)
- Humidity accuracy
- About plus or minus 2% (HDC1080, HTU31), plus or minus 1.5% (HDC3021)
- Temperature accuracy
- About plus or minus 0.2 to 0.3 degrees C
- Heater
- Built in on all, for drying after condensation
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1GY-213V-HDC1080 Temperature and Humidity Sensor Module (Unwelded) – I2C Interface₹329
Option 2Adafruit HDC3021 Precision Temperature & Humidity Sensor – STEMMA QT / Qwiic₹1,369
Option 3TE Connectivity HTU31V Temperature and Humidity Sensor, 0 to 100% RH, -40°C to 125°C, Analog Output, DFN-6 Package₹629
Option 4CHT8305 MINI Digital Temperature & Humidity Sensor Module₹240
What the HDC1080, HDC3021 and HTU31 sensors is
The TI HDC1080, HDC3021 and TE HTU31 are small I2C humidity and temperature sensors with good accuracy and low power, used in weather stations and indoor monitors.
Use the built-in heater only to dry the sensor after fog or condensation; readings are wrong while it is on.
The HDC3021 ships with a polyimide tape over the opening to keep it clean during soldering. Peel it off before use.
HDC1080, HDC3021 and HTU31 sensors pinout
The pins on the HDC1080, HDC3021 and HTU31 sensors and what each one does.
| Pin | Function |
|---|---|
| VCC | Supply |
| GND | Ground |
| SDA | I2C data |
| SCL | I2C clock |
- VCC
- Supply
- GND
- Ground
- SDA
- I2C data
- SCL
- I2C clock
Wiring the HDC1080, HDC3021 and HTU31 sensors
The GY-213V HDC1080 board ships unsoldered; solder the header before testing.
| HDC1080, HDC3021 and HTU31 sensors pin | Arduino Uno | ESP32 |
|---|---|---|
| VCC | 3.3 V (or 5 V on 5 V-tolerant modules) | 3.3 V |
| GND | GND | GND |
| SDA | A4 | GPIO 21 |
| SCL | A5 | GPIO 22 |
- VCC
- Arduino Uno:
- 3.3 V (or 5 V on 5 V-tolerant modules)
- ESP32:
- 3.3 V
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- SDA
- Arduino Uno:
- A4
- ESP32:
- GPIO 21
- SCL
- Arduino Uno:
- A5
- ESP32:
- GPIO 22
Example code
For the HDC3021 and HTU31 use the Adafruit HDC302x and HTU31D libraries.
#include <Wire.h>
const uint8_t ADDR = 0x40;
uint16_t read16(uint8_t reg) {
Wire.beginTransmission(ADDR); Wire.write(reg); Wire.endTransmission();
delay(20); // conversion time
Wire.requestFrom(ADDR, (uint8_t)2);
return (Wire.read() << 8) | Wire.read();
}
void setup() { Serial.begin(115200); Wire.begin(); }
void loop() {
float t = read16(0x00) / 65536.0 * 165.0 - 40.0;
float h = read16(0x01) / 65536.0 * 100.0;
Serial.print(t, 1); Serial.print(" C "); Serial.print(h, 1); Serial.println(" %RH");
delay(2000);
}Setup and tuning
VCC to 3.3 V, GND, SDA and SCL; many breakouts have pull-ups and a regulator.
use the Adafruit or ClosedCube libraries for the HDC1080, and the Adafruit HTU31D library for the HTU31.
HDC1080 is fixed at 0x40; HDC3021 and HTU31 can change address with a pin.
keep the sensor away from the board's regulator and the microcontroller, which warm it.
use the built-in heater on HDC3021 or HTU31 to dry the sensor after high humidity.
What you need
Shop this list7 of 8 found in our store · ₹3,128
GY-213V-HDC1080 Temperature and Humidity Sensor Module (Unwelded) – I2C Interface: the part this guide coversGY-213V-HDC1080 Temperature and Humidity Sensor Module (Unwelded) – I2C Interface₹329
Adafruit HDC3021 Precision Temperature & Humidity Sensor – STEMMA QT / Qwiic: another version this guide coversAdafruit HDC3021 Precision Temperature & Humidity Sensor – STEMMA QT / Qwiic₹1,369
TE Connectivity HTU31V Temperature and Humidity Sensor, 0 to 100% RH, -40°C to 125°C, Analog Output, DFN-6 Package: another version this guide coversTE Connectivity HTU31V Temperature and Humidity Sensor, 0 to 100% RH, -40°C to 125°C, Analog Output, DFN-6 Package₹629
CHT8305 MINI Digital Temperature & Humidity Sensor Module: another version this guide coversCHT8305 MINI Digital Temperature & Humidity Sensor Module₹240- Uno R3 development board: the controller used in the wiring tableFind this part
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
Resistor assortment kit (30 values): pull-up and divider resistorsResistor Assortment Kit (30 Values)₹33
0.96 inch OLED display 128x64: to show readings without a computer0.96" OLED Display 128x64₹139Closest match, check the specs
Alternatives and when to choose them
- SHT3x sensors: similar accuracy, very common.
- Si7021 sensor: also at 0x40, similar use.
- AHT30 and DHT20: lower cost.
Common mistakes to avoid
- Mounting the sensor next to a hot regulator.
- Leaving the heater on during normal readings.
- Using two fixed-address sensors on one bus.
- Sealing the sensor in a box with no air flow.
Frequently asked questions
Which is most accurate: HDC1080, HDC3021 or HTU31?
The HDC3021 and HTU31 reach about ±2 % RH; the HDC1080 is about ±2 to 3 % RH.
Why is my temperature reading too high?
The sensor is warmed by the board; move it away on wires or add slots in the PCB.
Can I use two HDC1080 on one I2C bus?
No, its address is fixed; use an I2C multiplexer or a sensor with an address pin.
What is the heater for?
It warms the sensor to drive off condensation and check that it still responds.
Do these sensors work at 5 V?
Many breakouts accept 5 V through a regulator; the bare chips are 3.3 V or lower.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

