HDC1080 only returning maximum temp value - 125degrees

I would like to know if there is something wrong with our code. It used to work and returned the actual temp values before but all of a sudden it now only returns 125 degrees.

#include <ClosedCube_HDC1080.h>

const int relay = 7;  
const int flamePIN = 9;
int Flame = HIGH;

ClosedCube_HDC1080 hdc1080;

void setup() {
  pinMode(relay, OUTPUT);
  pinMode(flamePIN, INPUT);
  hdc1080.begin(0x40);
  Serial.begin(9600);
}

void loop() {

  Flame = digitalRead(flamePIN);
  Serial.println(hdc1080.readTemperature());

  digitalWrite(relay, LOW);

  if (Flame == LOW)
  {
    Serial.println("Fire!!!");
    digitalWrite(relay, HIGH);
  }
  else
  {
    Serial.println("No fire!");
    digitalWrite(relay, LOW);
  }

  delay(500);
}

I would check the wiring. If you look at the code, reading the 16 bit register as all 1s (65536) will result in a temperature of 125.

Most likely, the chip is not properly connected. You can run the i2c scanner program to see if it is present.

Unfortunately, the library never returns any status values so you can not tell if any transmissions were successful or not which is a very poor design.

1 Like

If you are going to build several of these consider a PCB (Printed Circuit Board).

here's the wiring of the hdc180:

image
image
image

It looks like that sensor is a 3.3V device but you are using an Uno which is a 5V device. Even if you connect it to the 3.3V pin on the Uno, the SCL and SDA lines run at 5V

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.