Skip to content

Faulty readings, not sure why (but theres a pattern) #3

@MickTheMechanic

Description

@MickTheMechanic

Subject of the issue

When using the library I notice that the readings are jumpy, the value jumps between the actual reading and one of a number of predictable values. These are 0.00, 16.0625, 32.125, 48.1875, 64.25, and so on. There is a clear pattern. If these values are omitted using an if statement I get a super smooth clean reading. If they are not ommited then the values will always jump back and forth between the actual value and the nearest of the pattern values. Not sure if its a hardware problem or a software problem, but Its worth investigating.

Your workbench

  • What development board or microcontroller are you using? ESP32
  • What version of hardware or breakout board are you using? CJMCU-96
  • How is the breakout board wired to your microcontroller? normal I2C, there is also a DS1307 RTC on the bus
  • How is everything being powered? USB
  • Are there any additional details that may help us help you? I have removed additional pullups, so there is only one pair of 10k pullups on the BUS. When other breakouts are connected to the BUS they work normally.

Expected behavior

The readings should be smooth and not jumpy. At the very least, if these problems are not limited to me, these values should be somehow discarded behind the scenes inside the library.

Actual behavior

Explained above.

Additional info

  • The bug is also present in readings from the ambient sensor inside the chip
  • I can only speculate at this point, but maybe this is related in some manner to Example3 SetFilterCoeffecients occasionally produces bad output #1
  • I would assume a hardware problem or interference if there was no pattern, there is however a very precise pattern, which makes me think software issue
  • Here is my code showing how I eliminate the faulty readings

void GetTemperature () {
  if (tempSensor.available()) {
    probeTemp = tempSensor.getThermocoupleTemp();
    if (probeTemp != 0.0 &&
        probeTemp != 16.0625 &&
        probeTemp != 32.125 &&
        probeTemp != 48.1875 &&
        probeTemp != 64.25 &&
        probeTemp != 80.3125 &&
        probeTemp != 96.375) {
      Serial.println(probeTemp, 10);
      snprintf(tempBuf, MAX_STR, "%.2f'C", probeTemp);
      gaugeVal = probeTemp;
    }
  }
  else {
    snprintf(tempBuf, 8, "---.--");
    gaugeVal = 0;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions