In this example we will connect an HDC1008 to an Intel galileo
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
Features
- Relative Humidity (RH) Operating Range 0% to
100% - 14 Bit Measurement Resolution
- Relative Humidity Accuracy ±4%
- Temperature Accuracy ±0.2 °C
- 200 nA Sleep Mode Current
- Average Supply Current:
- 820 nA @ 1sps, 11 bit RH Measurement
- 1.2 µA @ 1sps, 11 bit RH and Temperature
Measurement
- Supply Voltage 3 V to 5 V
- Tiny 2 mm × 1.6 mm Device Footprint
- I2C Interface
Parts List
Label | Part Type |
---|---|
Part1 | Intel Galileo Gen2 |
Part2 | Adafruit HDC1008 Temperature Humidity Sensor |
Layout
An I2C device so easy to connect to the Galileo
Code
This example needs the adafruit library from https://github.com/adafruit/Adafruit_HDC1000_Library
[codesyntax lang=”cpp”]
#include <Wire.h> #include "Adafruit_HDC1000.h" // Connect Vin to 3-5VDC // Connect GND to ground // Connect SCL to I2C clock pin (A5 on UNO) // Connect SDA to I2C data pin (A4 on UNO) 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]
Testing
Open the serial monitor and you should something like this
Temp: 24.00 Hum: 25.82
Temp: 24.00 Hum: 25.82
Temp: 23.98 Hum: 25.82
Temp: 23.98 Hum: 25.82
Temp: 23.95 Hum: 25.92
Temp: 23.94 Hum: 25.92
Temp: 23.94 Hum: 25.92
Temp: 23.94 Hum: 25.92
Temp: 24.24 Hum: 26.32
Temp: 28.13 Hum: 27.82
Temp: 28.97 Hum: 28.82
Temp: 29.52 Hum: 29.82
Links