Home Code HDC1008 sensor example

HDC1008 sensor example

by shedboy71

The HDC1000 is a digital humidity sensor with integrated temperature sensor that provides excellent measurement accuracy at very low power. The device measures humidity based on a novel capacitive sensor. The humidity and temperature sensors are factory calibrated.

The sensing element of the HDC1000 is placed on the bottom part of the device, which makes the HDC1000 more robust against dirt, dust, and other environmental contaminants. The HDC1000 is functional within the full –40°C to +125°C temperature range.

Key Features

  • Relative Humidity (RH) Operating Range 0% to 100%
  • 14 Bit Measurement Resolution
  • Relative Humidity Accuracy ±3%
  • Temperature Accuracy ±0.2°C
  • Supply Voltage 3 V to 5 V
  • I2C Interface

Connection information

The easiest way is to purchase some sort of breakout

Connect Vin to 5VDC
Connect GND to ground
Connect SCL to A5 on UNO
Connect SDA to A4 on UNO

 

Code

The good folks at Adafruit have done the hard work and produced a library for this device – https://github.com/adafruit/Adafruit_HDC1000_Library  . If you are using Arduino IDE 1.6.5 or later you can easily import this library by going to Sketch -> Include Library -> Manage Libraries

[codesyntax lang=”cpp”]

#include <Wire.h>
#include "Adafruit_HDC1000.h"


Adafruit_HDC1000 hdc = Adafruit_HDC1000();

void setup() 
{
  Serial.begin(9600);
  Serial.println("HDC100x test");

  if (!hdc.begin()) 
  {
    Serial.println("Couldn't find sensor!");
    while (1);
  }
}


void loop() 
{
  Serial.print("Temp: "); Serial.print(hdc.readTemperature());
  Serial.print("\t\tHum: "); Serial.println(hdc.readHumidity());
  delay(500);
}

[/codesyntax]

 

Links

 

Adafruit HDC1008 Temperature & Humidity Sensor Breakout Board

Share

You may also like