Wemos HDC1008 sensor example

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.

hdc1008
hdc1008

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

The easiest way is to purchase some sort of breakout

Connect Vin to Wemos 3v3
Connect GND to ground
Connect SCL to Wemos D1
Connect SDA to Wemos D2

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]

Output

Open the serial monitor and you should see something like this

hdc1008 output
hdc1008 output

Links

Adafruit HDC1008 Temperature & Humidity Sensor Breakout Board

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here