meta data for this page
LamaPLC: HTU TE Connectivity temperature/humidity sensors with I²C communication
The HTUs are highly accurate, digital relative humidity and temperature sensors known for their low power consumption, I²C interface, and factory calibration.
Key Features
- High Accuracy:
- Humidity: Typical accuracy of ±2% RH within the optimized range of 5% to 95% RH.
- Temperature: Typical accuracy of ±0.3°C over an operating range of 0°C to 70°C.
- Digital I²C Interface: Uses the common I²C protocol for easy integration with most microcontrollers (e.g., Arduino, ESP32, Raspberry Pi), requiring only two data lines (SDA and SCL) in addition to power.
- Low Power Consumption: Designed for battery-powered and power-sensitive applications, with current consumption as low as 0.14µA in sleep mode.
- Wide Operating Range:
- Humidity: 0% to 100% RH range.
- Temperature: -40°C to 125°C range.
- Selectable Resolution: The resolution can be configured by the user, ranging from 8/12 bits for RH/T to a maximum of 12/14 bits for RH/T, allowing a trade-off between measurement speed and precision.
- Fast Response Time: Offers a typical humidity response time of 5 seconds.
- Factory Calibrated & Linearized: Each sensor is individually calibrated and provides a linearized digital signal, eliminating the need for complex calibration routines in the host device.
- Integrated Fault Detection: Includes a checksum (CRC) feature to improve communication reliability and an electronic identification code stored on the chip for traceability.
- Protective Filter Option: The HTU21D(F) variant includes an optional hydrophobic PTFE filter that protects the sensor from dust and water immersion, preserving performance in demanding environments.
- Full Interchangeability: No calibration is required when swapping sensors under standard conditions.
If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.
Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.
Difference between HTU31D, HTU21D and HTU20D
The primary difference among the HTU20D, HTU21D, and HTU31D is an incremental improvement in accuracy, supply-voltage range, and power consumption as the model number increases. The sensors are largely interchangeable and use the same I²C communication protocol.
¹: The SHT20, HTU20, Si702, GY-20 are different manufacturers' versions of essentially the same I²C digital humidity and temperature sensor chip, designed to be hardware- and software-compatible. The GY-20 is a generic breakout board that uses one of these chips.
²: The SHT21, HTU21, Si7021, GY-21, GY-213V, HDC1080 are very similar digital humidity and temperature sensor chips from different manufacturers (Sensirion, Measurement Specialties, and Silicon Labs, respectively), while the GY-21 is a generic breakout board that uses one of these chips. They are largely interchangeable in hardware and software for most general-purpose applications.
³: The SHT31, HTU31, Si7031, and GY-31 are high-accuracy digital temperature and humidity sensor chips from different manufacturers (Sensirion, TE Connectivity, and Silicon Labs, respectively) that are designed to be largely interchangeable. The GY-31 is a generic name for a breakout board that typically uses the SHT31 chip.
Arduino & HTU31D
To read the HTU31D, the most reliable method is to use the Adafruit HTU31D Library. Compared to the older HTU21D, this sensor handles a wider voltage range (3V–5.5V) and offers even better precision.
Wiring (I²C)
- VIN: 3.3V or 5V
- GND: Ground
- SCL: Pin A5 (on Uno/Nano)
- SDA: Pin A4 (on Uno/Nano)
- ADR Pin: Leave disconnected for default address 0x40. Connect to VIN for 0x41.
Arduino Example Code
Install the Adafruit HTU31D and Adafruit BusIO libraries via the Arduino Library Manager.
#include <Wire.h> #include "Adafruit_HTU31D.h" Adafruit_HTU31D htu = Adafruit_HTU31D(); void setup() { Serial.begin(115200); while (!Serial) delay(10); Serial.println("HTU31D test"); if (!htu.begin(0x40)) { // Use 0x41 if ADR pin is tied to High Serial.println("Couldn't find sensor!"); while (1); } } void loop() { sensors_event_t humidity, temp; // Get both temperature and humidity at once htu.getEvent(&humidity, &temp); Serial.print("Temp: "); Serial.print(temp.temperature); Serial.print(" C \t"); Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println(" %"); delay(1000); }
Advanced Features
The HTU31D includes a built-in heater to dry the sensor if it accumulates condensation. You can toggle it in your code:
- htu.enableHeater(true); Turn on heater
- htu.enableHeater(false); Turn off heater
Resolution Settings
You can optimize for speed or precision using htu.setResolutions(temp_res, hum_res).
- Temperature: 0.012°C to 0.04°C resolution.
- Humidity: 0.01% to 0.02% resolution.
I²C topics on lamaPLC
This page has been accessed for: Today: 2, Until now: 4


