HDC1080 Humidity/Temperature Sensor Breakout Board

2 min read
HDC1080 Breakout

HDC1080 Humidity/Temperature Sensor Breakout Board

2 min read

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.

HDC1080It includes pullup resistors for the data and clock lines as well as a small bypass capacitor. I’ve uploaded the Eagle design files to GitHub.

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);
}

 

1 Comment

  • KevinReinc March 15, 2024 at 9:44 am

    EuronewsTop stands while a premier location for music fans seeking comprehensive insurance of the BRITISH music scene. Through iconic British artists to up-and-coming artists, the website offers some sort of wealth of content articles, reviews, and features that cater to be able to diverse musical preferences. Dive into exhaustive interviews with famous musicians, explore the particular latest album lets out, and stay up-to-date on upcoming concert events and festivals around the United Kingdom. Whether you’re enthusiastic about rock, put, electronic, or classical music, Euronewstop supplies a platform to discover new sounds, review classics, and participate with fellow tunes lovers through energetic discussions and group forums. Having its dedication to delivering superior quality content and promoting a vibrant tunes community, Euronewstop. corp. uk is typically the go-to destination regarding all things music in the BRITISH. https://euronewstop.co.uk/category/music/jazz

  • Leave a Reply

    I accept the Privacy Policy

    ×