Online Shipping | GrabExpress & Lalamove instant delivery for Penang Islandsupport@icontech.com.my | 017-481 1886
← Back to Articles
How to use CJMCU2080 HDC2080

How to use CJMCU2080 HDC2080

6 September 2026


The HDC2080 is a low-power digital humidity and temperature sensor from Texas Instruments. On a CJMCU2080 breakout board, it is one of the easiest ways to add accurate environmental readings to an ESP32 project — greenhouse monitoring, room comfort checks, or a simple data logger. In this guide we wire the module to an ESP32, install the HDC2080-Arduino library by lime-labs, and stream live readings to the Serial Monitor at 1 Hz, with optional high/low temperature and humidity alerts.

Components for This Project

ComponentShop
ESP32 DEVKITView Product
CJMCU2080 / HDC2080 breakout moduleView Product

What Is the HDC2080?

The HDC2080 measures:

MeasurementTypical use
Temperature°C (also useful for compensating humidity)
Relative humidity% RH — air moisture content
Communication is I2C only — just 4 wires (VCC, GND, SDA, SCL). Default I2C address is
textcode
10x40
.
The CJMCU2080 module is a small purple/blue PCB with the HDC2080 chip, pull-up resistors, and pin headers. It works well with ESP32, Arduino Uno, and other 3.3 V / 5 V boards (the module is usually 3.3 V logic friendly).

HDC2080 vs DHT11/DHT22: I2C sensors like the HDC2080 are often more stable and faster than one-wire DHT sensors, and they share the bus with other I2C devices (OLED, RTC, etc.) on the same two data pins.


What You Will Need

ItemNotes
ESP32 development boardAny 30/36-pin DEVKIT
CJMCU2080 (HDC2080) moduleI2C humidity + temperature sensor
Breadboard + jumper wiresMale-to-male or male-to-female
USB data cableFor upload and Serial Monitor

Wiring — CJMCU2080 to ESP32

The HDC2080 uses I2C. On most ESP32 DEVKIT boards, the default I2C pins are:

CJMCU2080 PinESP32 Pin
VCC3.3V
GNDGND
SDAGPIO 21
SCLGPIO 22

Power: Use 3.3V on the ESP32. Do not connect VCC to 5V unless your specific module datasheet says it is 5 V tolerant — most CJMCU2080 boards expect 3.3 V. Keep wires short and tidy. If readings are noisy, add a 100 nF capacitor between VCC and GND near the sensor module.

CJMCU2080 wired to ESP32 over I2C
CJMCU2080 wired to ESP32 over I2C


Install the Arduino Library

This project uses the community library from lime-labs (fork of the original TI/tinkeringtech HDC2080 code, with fixes for newer ESP32 Arduino cores): GitHub: github.com/lime-labs/HDC2080-Arduino

Option A — Install from ZIP (easiest)

  1. Open the repo → Code → Download ZIP
  2. In Arduino IDE: Sketch → Include Library → Add .ZIP Library…
  3. Select the downloaded ZIP file
  4. Restart Arduino IDE if prompted

Option B — Manual install

  1. Extract the ZIP folder and rename it to
    textcode
    1HDC2080
    if needed
  2. Copy it into your Arduino libraries folder:
    • Windows:
      textcode
      1Documents\Arduino\libraries\
    • Mac:
      textcode
      1~/Documents/Arduino/libraries/
  3. Restart Arduino IDE You should see File → Examples → Custom Libraries → HDC2080 (or similar) after a successful install.

Arduino IDE Setup for ESP32

If you have not set up ESP32 before, see our ESP32 getting started guide — summary:

  1. Add board URL in File → Preferences
  2. Install esp32 by Espressif Systems in Boards Manager
  3. Select DOIT ESP32 DEVKIT V1 (or your board)
  4. Set Serial Monitor to 115200 baud

The Sketch

Create a new sketch and paste the code below. It:

  • Initializes the sensor at I2C address
    textcode
    10x40
  • Resets and configures a comfort zone (temp 22–36 °C, humidity 40–55 %)
  • Sets 14-bit resolution and 1 Hz measurement rate
  • Prints temperature and humidity every second
  • Checks interrupt status flags for threshold breaches
cppcode
1#include <HDC2080.h>
2#define ADDR 0x40
3HDC2080 sensor(ADDR);
4void setup() {
5  Serial.begin(115200);
6  while (!Serial);   // Remove this line if upload hangs on ESP32 without USB serial
7  // Initialize I2C communication
8  sensor.begin();
9  // Begin with a device reset
10  sensor.reset();
11  // Set up the comfort zone
12  sensor.setHighTemp(36);         // High temperature of 36°C
13  sensor.setLowTemp(22);          // Low temperature of 22°C
14  sensor.setHighHumidity(55);     // High humidity of 55%
15  sensor.setLowHumidity(40);      // Low humidity of 40%
16  // Configure measurements
17  sensor.setMeasurementMode(TEMP_AND_HUMID);
18  sensor.setRate(ONE_HZ);
19  sensor.setTempRes(FOURTEEN_BIT);
20  sensor.setHumidRes(FOURTEEN_BIT);
21  // Begin measuring
22  sensor.triggerMeasurement();
23}
24void loop() {
25  Serial.print("Temperature (C): ");
26  Serial.print(sensor.readTemp());
27  Serial.print("\t\tHumidity (%): ");
28  Serial.println(sensor.readHumidity());
29  uint8_t status = sensor.readInterruptStatus();
30  if (status & 0x40) {
31    Serial.println("High Temperature threshold breached!");
32  }
33  if (status & 0x20) {
34    Serial.println("Low Temperature threshold breached!");
35  }
36  if (status & 0x10) {
37    Serial.println("High Humidity threshold breached!");
38  }
39  if (status & 0x08) {
40    Serial.println("Low Humidity threshold breached!");
41  }
42  delay(1000);
43}