Wemos Mini and HDC2080 humidity and temperature sensor example

In this article we look at yet another humidity and temperature sensor from TI – this time its the HDC2080 which we will connect up to a Wemos Mini

Lets look at some of the technical information and data from TI

HDC2080 Information

The HDC2080 device is an integrated humidity and temperature sensor that provides high accuracy measurements with very low power consumption in a small DFN package. The capacitive-based sensor includes new integrated digital features and a heating element to dissipate condensation and moisture. The HDC2080 digital features include programmable interrupt thresholds to provide alerts and system wake-ups without requiring a microcontroller to be continuously monitoring the system. Combined with programmable sampling intervals, a low power consumption, and a support for a 1.8-V supply voltage, the HDC2080 is designed for battery-operated systems.

The HDC2080 provides high accuracy measurement capability for a wide range of environmental monitoring and Internet of Things (IoT) applications such as smart thermostats and smart home assistants. For designs where printed-circuit board (PCB) area is critical, a smaller CSP package option is available thru the HDC2010 with complete software compatibility with the HDC2080.

For applications with strict power-budget restrictions, Auto Measurement Mode enables the HDC2080 to automatically initiate temperature and humidity measurements. This feature allows users to configure a microcontroller into deep sleep mode because the HDC2080 is no longer dependent upon the microcontroller to initiate a measurement.

Programable temperature and humidity thresholds in the HDC2080 allow the device to send a hardware interrupt to wake up the microcontroller when necessary. In addition, the power consumption of the HDC2080 is significantly reduced, which helps to minimize self-heating and improve measurement accuracy.

The HDC2080 is factory-calibrated to 0.2°C temperature accuracy and 2% relative humidity accuracy.

Features

Relative humidity range: 0% to 100%
Humidity accuracy: ±2% (typical), ±3% (maximum)
Temperature accuracy: ±0.2°C (typical), ±0.4°C (maximum)
Sleep mode current: 50 nA (typical), 100 nA (maximum)
Average supply current (1 measurement/second)
300 nA: RH% only (11 bit)
550 nA: RH% (11 bit) + temperature (11 bit)

Temperature range:
Operating: –40°C to 85°C
Functional: –40°C to 125°C
Supply voltage range: 1.62 V to 3.6 V

 

Parts List

Here are the parts I used

Name Links
Wemos Mini
HDC2080
Connecting cables

 

Schematic/Connection

Wemos mini Sensor
3.3v Vcc
Gnd Gnd
SDA (D2) SDA
SCL (D1) SCL

 

Code Example

I used the library from https://github.com/tinkeringtech/HDC2080_breakout

This is the default example with a few cosmetic changes

 

#include <HDC2080.h>

#define ADDR 0x40
HDC2080 sensor(ADDR);

float temperature = 0, humidity = 0;

void setup() {

  Serial.begin(9600);
  Serial.println("TinkeringTech HDC2080 Test");

  // Initialize I2C communication
  sensor.begin();
    
  // Begin with a device reset
  sensor.reset();
  
  // Set up the comfort zone
  sensor.setHighTemp(48);         // High temperature of 28C
  sensor.setLowTemp(2);          // Low temperature of 22C
  sensor.setHighHumidity(95);     // High humidity of 55%
  sensor.setLowHumidity(10);      // Low humidity of 40%
  
  // Configure Measurements
  sensor.setMeasurementMode(TEMP_AND_HUMID);  // Set measurements to temperature and humidity
  sensor.setRate(ONE_HZ);                     // Set measurement frequency to 1 Hz
  sensor.setTempRes(FOURTEEN_BIT);
  sensor.setHumidRes(FOURTEEN_BIT);
  
  //begin measuring
  sensor.triggerMeasurement();
}

void loop() {

  Serial.print("Temperature (C): "); 
  Serial.print(sensor.readTemp());
  Serial.print("\t\tHumidity (%): "); 
  Serial.println(sensor.readHumidity());
  
  // Wait 1 second for the next reading
  delay(2000);
  
}

 

Output

Open the serial monitor and you should see something like this

Temperature (C): 32.50 Humidity (%): 0.00
Temperature (C): 32.71 Humidity (%): 0.00
Temperature (C): 32.37 Humidity (%): 49.61
Temperature (C): 32.11 Humidity (%): 45.78
Temperature (C): 31.92 Humidity (%): 42.58
Temperature (C): 31.74 Humidity (%): 40.12
Temperature (C): 31.60 Humidity (%): 38.22
Temperature (C): 31.45 Humidity (%): 36.88
Temperature (C): 31.33 Humidity (%): 35.85
Temperature (C): 31.19 Humidity (%): 35.14
Temperature (C): 31.07 Humidity (%): 34.59
Temperature (C): 30.97 Humidity (%): 34.25

 

Links

https://www.ti.com/lit/gpn/hdc2080

LEAVE A REPLY

Please enter your comment!
Please enter your name here