From the datasheet:
The HDC1080 is a digital humidity sensor with integrated temperature sensor that provides excellent measurement accuracy at very low power. The HDC1080 operates over a wide supply range, and is a low cost, low power alternative to competitive solutions in a wide range of common applications. The humidity and temperature sensors are factory calibrated.
It’s very small with a 3mm x 3mm footprint. The I2C interface makes it easy to interface with something like an Arduino or Raspberry Pi. A breadboard-friendly breakout board is helpful for prototyping. Below is a schematic for one.
Here is some sample code for the Particle Photon that reads the temperature and humidity every three seconds and publishes it to the cloud. There are also some lines commented out that will print the data to the serial port. Since Particle uses the same Wiring programming language as Arduino, you can port this code with only minor changes.
const uint8_t setupCommand[] = {0x02, 0x10, 0x00}; const uint8_t HDC1080_ADDRESS = 0x40; // The I2C address of the HDC1080 is 1000000 void setup() { Wire.begin(); // Defaults to 100kHz Serial.begin(9600); } void loop() { // Program to measure temp and humidity with 14 bit resolution Wire.beginTransmission(HDC1080_ADDRESS); Wire.write(setupCommand, 3); Wire.endTransmission(); // Trigger humidity/temp measurement Wire.beginTransmission(HDC1080_ADDRESS); Wire.write(0x00); Wire.endTransmission(); // Allow the conversion to complete delay(20); Wire.requestFrom(HDC1080_ADDRESS, 4); float celsius, fahrenheit, humidity; if (Wire.available()) { // Temp int rawTemp = Wire.read() << 8; rawTemp = rawTemp | Wire.read(); // (rawTemp / 2^16) * 165 - 40 celsius = ((float)rawTemp / (2 << 15)) * 165 - 40; fahrenheit = 1.8 * celsius + 32; // Serial.printlnf("temp: %.1f", temp); } if (Wire.available()) { int rawHumidity = Wire.read() << 8; rawHumidity = rawHumidity | Wire.read(); // rawHumidity / 2^16 humidity = ((float)rawHumidity / (2 << 15)) * 100; // Serial.printlnf("humidity: %.2f", humidity); } String data = String::format("%.2f°C, %.2f°F, Humidity: %.2f%%", celsius, fahrenheit, humidity); Particle.publish("temperature", data); delay(3000); }