SBOA631 August 2025 HDC1010 , HDC1080 , HDC2010 , HDC2021 , HDC2022 , HDC2080 , HDC3020 , HDC3020-Q1 , HDC3021 , HDC3021-Q1 , HDC3022 , HDC3022-Q1 , HDC3120 , HDC3120-Q1
In this example, an HDC2010 sensor is configured for Trigger-On Demand (One-Shot) mode, with Auto Measurement Mode (AMM) disabled. The procedure begins by writing to the Configuration Register (0x0E) to set the device in Trigger-On Demand mode. An illustration of the Configuration Register setup is provided in Figure 2-3.
| BIT | FIELD | TYPE | RESET | DESCRIPTION |
|---|---|---|---|---|
| 7 | SOFT_RES | R/W | 0 | 0 = Normal Operation mode, this bit is self-clear 1 = Soft Reset EEPROM value reload and registers reset |
| [6:4] | AMM[2:0] | R/W | 000 | Auto Measurement Mode (AMM) 000 = Disabled. Initiate measurement via I2C 001 = 1/120Hz (1 samples every 2 minutes) 010 = 1/60Hz (1 samples every minute) 011 = 0.1Hz (1 samples every 10 seconds) 100 = 0.2Hz (1 samples every 5 second) 101 = 1Hz (1 samples every second) 110 = 2Hz (2 samples every second) 111 = 5Hz (5 samples every second) |
| 3 | HEAT_EN | R/W | 0 | 0 = Heater off 1 = Heater on |
| 2 | DRDY/INT_EN | R/W | 0 | DRDY/INT_EN pin configuration 0 = High Z 1 = Enable |
| 1 | INT_POL | R/W | 0 | Interrupt polarity 0 = Active Low 1 = Active High |
| 0 | INT_MODE | R/W | 0 | Interrupt mode 0 = Level sensitive 1 = Comparator mode |
Wire.beginTransmission(0x40); // initiate communication with HDC2x sensor
Wire.write(0x0E); // write to Config Register
Wire.write(0x00); // configure device to Trigger-On Demand
Wire.endTransmission();Next, configure the Measurement Configuration Register (0x0F) as shown in Figure 2-4.
The Measurement Configuration Register defines the following:
| BIT | FIELD | TYPE | RESET | DESCRIPTION |
|---|---|---|---|---|
| 7:6 | TRES[1:0] | R/W | 00 | Temperature resolution 00: 14 bit 01: 11 bit 10: 9 bit 11: NA |
| 5:4 | HRES[1:0] | R/W | 00 | Humidity resolution 00: 14 bit 01: 11 bit 10: 9 bit 11: NA |
| 3 | RES | R/W | 0 | Reserved |
| 2:1 | MEAS_CONF[1:0] | R/W | 00 | Measurement configuration 00: Humidity + Temperature 01: Temperature only 10: NA 11: NA |
| 0 | MEAS_TRIG | R/W | 0 | Measurement trigger 0: no action 1: Start measurement Self-clearing bit when measurement completed |
Figure 2-4 provides an illustration of the Measurement Configuration Register.
Wire.beginTransmission(0x40); // initiate communication with HDC2x sensor
Wire.write(0x0F); // write to Measurement Config Register
Wire.write(0x01); // set output to 14-bit temperature/humidity data
// and trigger measurements
Wire.endTransmission();In Trigger-On Demand mode, this sequence can be placed inside a loop for periodic polling, depending on the system’s needs.
To read the temperature and humidity measurements for the HDC2x, users can choose between two possible methods. The first method is to read/store the temperature and humidity bytes separately using the TEMP_LOW/HUM_LOW and TEMP_HIGH/HUM_HIGH and combine the MSB and LSB bits into one 16-bit value, or burst read multiple bytes in one communication frame as illustrated in the following code for humidity data acquisition:
Reading Measurement Data
The HDC2x stores measurement results across two 8-bit registers:
One approach is to read each byte separately and combine them:
uint16_t getHum() {
// RH LSB Acquisition
Wire.beginTransmission(0x40); // start communication with HDC2x
Wire.write(0x02); // set a pointer for Humidity Low register (0x02)
Wire.requestFrom(0x02, 2); // request 2 bytes from HDC2x
uint8_t humLow = Wire.read(); // store Humidity LSB data
Wire.endTransmission();
// RH MSB Acquisition
Wire.beginTransmission(0x40); // start communication with HDC2x
Wire.write(0x03); // set a pointer for Humidity High register (0x03)
Wire.requestFrom(0x40, 2); // request 2 bytes from HDC2x
uint8_t humHigh = Wire.read(); // store Humidity MSB data
Wire.endTransmission();
// combine MSB and LSB into 16-bit integer and return value
return ((uint16_t) humHigh << 8) | humLow;
}However, a more efficient method reads both bytes in a burst from the LSB registers:
uint16_t getHum2() {
Wire.beginTransmission(0x40); // start communication with HDC2x
Wire.write(0x02); // set a pointer for Humidity Low register (0x02)
Wire.endTransmission(false);
Wire.requestFrom(0x40, 2); // request 2 bytes from HDC2x
uint8_t lsb = Wire.read(); // read and store LSB
uint8_t msb = Wire.read(); // read and store MSB
// adds MSB of data to an empty 16-bit variable
// shifts 8 bits left, then "or" with LSB for final value
return ((uint16_t) msb << 8) | lsb;
}This approach leverages the HDC2x’s internal pointer behavior: after reading the LSB from the HUMIDITY_LOW register, the pointer auto-increments to the HUMIDITY_HIGH register for the MSB. The same mechanism applies for reading temperature.
Visit the following link to view the full sample code for the HDC2x in Trigger-On Demand Mode.