Arduino 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 an Arduino Uno

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.


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 Required

I connected a sensor shield to an Arduino and then the sensor via connecting wire

Arduino UnoUNO R3 CH340G/ATmega328P, compatible for Arduino UNO
HDC2080HDC2080 Temperature and Humidity Low Power Digital I2C Sensor
Connecting wireFree shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire
sensor shieldExpansion IO Board Sensor Shield


This is a 3.3v rated sensor even though the pin says Vcc

arduino and hdc2080 breadboard

arduino and hdc2080_bb

Code Example

I used the library from

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.println("TinkeringTech HDC2080 Test");
  // Initialize I2C communication
  // Begin with a device 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
  //begin measuring
void loop() {
  Serial.print("Temperature (C): ");
  Serial.print("\t\tHumidity (%): ");
  // Wait 1 second for the next reading



Open the serial monitor and you should see something like this

Temperature (C): 25.14 Humidity (%): 52.86
Temperature (C): 25.12 Humidity (%): 52.89
Temperature (C): 25.11 Humidity (%): 52.95
Temperature (C): 25.10 Humidity (%): 52.96
Temperature (C): 25.17 Humidity (%): 53.18

I do get some erratic readings at times, values like the following. I haven’t investigated this fully – I did try and increase and decrease the delay between readings with no luck.

Temperature (C): -40.00 Humidity (%): 0.00





A nice little sensor but at just over $8 there are cheaper sensors available which have the same functionality, the library and code may need some work to work more reliably.


AM2320 temperature and humidity sensor and Arduino example

Temperature and humidity combined sensor AM2320 digital temperature and humidity sensor is a digital signal output has been calibrated. Using special temperature and humidity acquisition technology, ensure that the product has a very high reliability and excellent long-term stability. Sensor consists of a capacitive moisture element and an integrated high-precision temperature measurement devices, and connected with a high-performance microprocessor .

AM2320 communication using a single bus, two communication modes standard I2C. Standard single-bus interface, the system integration becomes easy and quick. Ultra-small size, low power consumption, signal transmission distance up to 20 meters, making all kinds of applications and even the most demanding applications the best choice. I2C communication using standard communication sequence, the user can directly linked to the I2C communication bus without additional wiring, simple to use. Two communication modes are used as humidity, temperature, and other digital information directly CRC checksum temperature-compensated output, users do not need to calculate the secondary digital output, and no need for temperature compensation of the humidity, temperature and humidity can be accurately information. Two communication modes are free to switch, the user can freely choose, easy to use, wide range of applications.



• Operating Voltage: 3.1 VDC to 5.5 VDC
• Operating Temperature Range: -40 ° C to + 80 ° C
• Humidity Range: 0 to 99.9% RH
• Accuracy ( 25 ° C environment)
Temperature: ± 0.5 ° C
Humidity: ± 3%
• RH (10 … 90% RH)
Resolution: Temperature: 0.1 ° C
Resolution: Humidity: 0.1% RH
• Attenuation values
Temperature: <0.1 ℃ / Year
Humidity: <1% RH / Year
• Response time: Temperature: 5s
• Response Time: Humidity: 5s 1 / e (63%)
• Output signal: single bus / IIC signal
• Housing material: PC plastic



I couldn’t find a fritzing part but as you can see being a simple I2C sensor with a 3.1 to 5.5v range its straightforward to connect this device to an Arduino Uno


arduino and am2302

arduino and am2302



You will need to install the folllowing library from

This is the default example


#include <Wire.h>
#include <AM2320.h>
AM2320 th;
void setup() {
void loop() {
Serial.println("Chip = AM2320");
switch(th.Read()) {
case 2:
Serial.println(" CRC failed");
case 1:
Serial.println(" Sensor offline");
case 0:
Serial.print(" Humidity = ");
Serial.print(" Temperature = ");





Open the serial monitor

Chip = AM2320
Humidity = 47.10%
Temperature = 24.80*C

Chip = AM2320
Humidity = 48.70%
Temperature = 25.10*C

Chip = AM2320
Humidity = 53.60%
Temperature = 25.40*C

Chip = AM2320
Humidity = 55.80%
Temperature = 25.80*C

Chip = AM2320
Humidity = 59.80%
Temperature = 26.20*C



AM2320 Digital Temperature and Humidity Sensor Replace AM2302 SHT10


DHT12 temperature sensor and Arduino example

The DHt12 is an upgraded version of the classic DHT11 humidity temperature sensor, it is fully downward compatible, more precise and adds an I2C interface.


compact size
low power consumption
low voltage operation
Standard I2C and 1-wire interface.

Sensing range
Temperature: -20 ~ +60 C
Humidity: 20-95 RH
Resolution: 0.1%RH
Repeat: -+ 1%RH
Precision 25C @ -+5RH
Resolution: 0.1C
Repeat: -+0.2C
Precision: 25C @ -+0.5C
Power: DC 2.7-5.5V
Normal current 1mA
Standby current 60uA
Sample cycle: > 2 seconds

Pin interface: 1. VDD 2. SDA 3. GND 4. SCL (connect to GND when use as 1-wire)





This shows how to connect the DHT12 to an Arduino Uno

arduino and dht12

arduino and dht12




This is from


#include "Arduino.h"
#include <DHT12.h>
// Set dht12 i2c comunication on default Wire pin
DHT12 dht12;
void setup()
// Start sensor handshake
int timeSinceLastRead = 0;
void loop()
// Report every 2 seconds.
if(timeSinceLastRead > 2000) {
// Reading temperature or humidity takes about 250 milliseconds!
// Read temperature as Celsius (the default)
float t12 = dht12.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f12 = dht12.readTemperature(true);
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h12 = dht12.readHumidity();
bool dht12Read = true;
// Check if any reads failed and exit early (to try again).
if (isnan(h12) || isnan(t12) || isnan(f12)) {
Serial.println("Failed to read from DHT12 sensor!");
dht12Read = false;
if (dht12Read){
// Compute heat index in Fahrenheit (the default)
float hif12 = dht12.computeHeatIndex(f12, h12);
// Compute heat index in Celsius (isFahreheit = false)
float hic12 = dht12.computeHeatIndex(t12, h12, false);
// Compute dew point in Fahrenheit (the default)
float dpf12 = dht12.dewPoint(f12, h12);
// Compute dew point in Celsius (isFahreheit = false)
float dpc12 = dht12.dewPoint(t12, h12, false);
Serial.print("DHT12=> Humidity: ");
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(" *C ");
Serial.print(" *F\t");
Serial.print(" Heat index: ");
Serial.print(" *C ");
Serial.print(" *F");
Serial.print(" Dew point: ");
Serial.print(" *C ");
Serial.println(" *F");
timeSinceLastRead = 0;
timeSinceLastRead += 100;





DHT12=> Humidity: 33.70 % Temperature: 20.20 *C 68.36 *F Heat index: 19.16 *C 66.48 *F Dew point: 3.60 *C 38.48 *F
DHT12=> Humidity: 39.70 % Temperature: 20.60 *C 69.08 *F Heat index: 19.75 *C 67.55 *F Dew point: 6.34 *C 43.41 *F
DHT12=> Humidity: 44.60 % Temperature: 21.20 *C 70.16 *F Heat index: 20.54 *C 68.97 *F Dew point: 8.64 *C 47.55 *F
DHT12=> Humidity: 47.80 % Temperature: 21.80 *C 71.24 *F Heat index: 21.28 *C 70.31 *F Dew point: 10.25 *C 50.45 *F
DHT12=> Humidity: 48.90 % Temperature: 22.40 *C 72.32 *F Heat index: 21.97 *C 71.55 *F Dew point: 11.16 *C 52.08 *F
DHT12=> Humidity: 53.90 % Temperature: 22.90 *C 73.22 *F Heat index: 22.65 *C 72.78 *F Dew point: 13.14 *C 55.66 *F
DHT12=> Humidity: 55.10 % Temperature: 23.60 *C 74.48 *F Heat index: 23.45 *C 74.22 *F Dew point: 14.15 *C 57.46 *F
DHT12=> Humidity: 54.90 % Temperature: 23.90 *C 75.02 *F Heat index: 23.78 *C 74.80 *F Dew point: 14.37 *C 57.86 *F
DHT12=> Humidity: 45.30 % Temperature: 24.40 *C 75.92 *F Heat index: 24.08 *C 75.34 *F Dew point: 11.80 *C 53.24 *F
DHT12=> Humidity: 40.60 % Temperature: 24.60 *C 76.28 *F Heat index: 24.18 *C 75.52 *F Dew point: 10.28 *C 50.50 *F
DHT12=> Humidity: 37.10 % Temperature: 24.80 *C 76.64 *F Heat index: 24.30 *C 75.75 *F Dew point: 9.09 *C 48.35 *F




Under $1 for one of these sensors

1pcs DHT-12 DHT12 sensor Digital output Temperature and Humidity Sensor high quality


Arduino and SI7021 Humidity and Temperature Sensor example

The Si7021 I2C Humidity and Temperature Sensor is a monolithic CMOS IC integrating humidity and temperature sensor elements, an analog-to-digital converter, signal processing, calibration data, and an I2C Interface. The patented use of industry-standard, low-K polymeric dielectrics for sensing humidity enables the construction of low-power, monolithic CMOS Sensor ICs with low drift and hysteresis, and excellent long term stability, it would be a great sensor to have on the roller. It would be able to measure everything before I go out for a ride around town.


  • Relative Humidity Sensor:
    • Si7013/21: ± 3% RH (maximum) @ 0-80% RH
    • Si7020: ± 4% RH (maximum) @ 0-80% RH
    • Si7006: ± 5% RH (maximum) @ 0-80% RH
  • Temperature Sensor:
    • Si7013/20/21: ±0.4°C accuracy (maximum) @ -10 to +85°C
    • Si7006: ±1.0°C accuracy (maximum) @ -10 to +85°C
  • 0 to 100% RH operating range
  • Up to -40 to +125°C operating range
  • Wide operating voltage range (1.9 to 3.6V)
  • Low Power Consumption: 2.2µW average power at 3.3V and 1 sample per second
  • I2C host interface
  • Integrated on-chip heater
  • 3mm x 3mm QFN package
  • Excellent long term stability
  • Factory calibrated
  • Optional factory-installed filter/cover
    • Lifetime protection during reflow and in operation
    • Protects against contamination from dust, dirt, household chemicals and other liquids
    • AEC-Q100 automotive qualified (Si7013/20/21)


Must use 3v3 for Vin

Arduino PinsModule Pins
 3v3 Vin
 Gnd Gnd


#include <Wire.h>
const int ADDR =0x40;
int X0,X1,Y0,Y1,Y2,Y3;
double X,Y,X_out,Y_out1,Y_out2;
void setup()
void loop()
  /**Send command of initiating temperature measurement**/
  /**Read data of temperature**/
    X0 =;
    X1 =;
    X0 = X0<<8;
    X_out = X0+X1;
  /**Calculate and display temperature**/
  /**Send command of initiating relative humidity measurement**/
  /**Read data of relative humidity**/
    Y0 =;
    Y1 =;
    Y_out1 = Y2*25600;
    Y_out2 = Y0*256+Y1;
  /**Calculate and display relative humidity**/
  Y_out1 = (125*Y_out1)/65536;
  Y_out2 = (125*Y_out2)/65536;
  Y = Y_out1+Y_out2;


Open the serial monitor, you should see something like this

Temp    Humidity
23.12C    52.83%

Temp    Humidity
24.04C    53.13%

Temp    Humidity
26.28C    53.83%

Temp    Humidity
27.42C    54.57%

Temp    Humidity
28.27C    55.32%

Temp    Humidity
27.94C    56.11%

Humidity Temperature Sensor Breakout Barometric Pressure SI7021 for Arduino GY-21