Home LED projects HDC1008 and OLED project

HDC1008 and OLED project

by shedboy71

In this example we will connect a HDC1008 sensor to our ARduino and display the output on a 128 x 32 I2C OLED LCD display, you could use a different type of LCD or a bigger OLED variety but that is what we had at hand here

The HDC1008 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 innovative WLCSP (Wafer Level Chip Scale Package) simplifies board design with the use of an ultra-compact package. The sensing element of the HDC1008 is placed on the bottom part of the device, which makes the HDC1008 more robust against dirt, dust, and other environmental contaminants. The HDC1008 is functional within the full –40°C to +125°C temperature range

I used a module for HDC1008, see the links at the bottom but here is a picture of a typical one



You connect the HDC1008 to your Arduino as follows

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




This example requires a couple of libraries, which make development a little easier. Both are from Adafruit and are the HDC1008 and SSD1306 libraries, using newer Arduino IDEs you can search for these but here are the links if you need to download them and manually import them

HDC1008 library

SSD1306 library

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <stdint.h>
#include "Adafruit_HDC1000.h"
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
Adafruit_HDC1000 hdc = Adafruit_HDC1000();
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
void setup() 
 if (!hdc.begin()) 
 Serial.println("Couldn't find sensor!");
 while (1);
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
void loop() 
 // Clear the buffer.
 // text display tests
 display.print("Temperature: ");
 display.print(" c");
 display.print("Humidity: ");
 display.print(" c");


Now all going well you should see something like this on your OLED display

HDC1008 output

HDC1008 output



The sensor module costs about $12.50
Adafruit HDC1008 Temperature & Humidity Sensor Breakout Board

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More