Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By metalphreak
#43201 BME280 has a humidity absolute tolerance of +/-3%. The HTU21D has a humidity absolute tolerance of +/-2%. Without knowing the actual real RH value, they could in theory read 5% different values and still be within specification.

Humidity is always going to be a measurement without a great deal of accuracy, especially in low cost sensors.

For temp, BME280 is +/- 0.5C @ 25C and upto +/- 1.0C over the full range of temps. HTU21D is +/- 0.3C.

The HTU21D is a more accurate sensor, but doesn't do atmospheric pressure.

Given that the devices are physically in different locations in free air, there is a good possibility that the temperature *is* actually different by half a degree. It doesn't take much to change the temp by a small amount. All of your readings appear to be within tolerance given the circumstances.
User avatar
By RKieboom
#43256 I agree, the current values are within spec.

The issue is that I had extreme values before, like others in this thread.
I don't have these extremes anymore and don't know why.

I would ask the others to update the software, add 2K2 pull-ups and see if that changes anything. For me, the problems are gone, but I have a nagging feeling I don't know why...

Happy making!
User avatar
By metalphreak
#43330 In the Adafruit code, if you replace:

Code: Select all  float h = (v_x1_u32r>>12);
  return  h / 1024.0;


with

Code: Select allreturn (float)((v_x1_u32r>>12) >> 10);


does it work?

Seems to be the only real difference between the Sparkfun and Adafruit libraries. The adafruit library uses signed int32_t while Sparkfun uses unsigned uint32_t. Might be some weirdness going on in the casting to a float???

The other way to test, use a print statement to dump the calibration values it gets from the BME280 during initialisation. Dump them from both libraries and see if they match. Also dump the raw value read from the device (adc_h). If they all match up, then its the bit of code that calculates the resulting % value that's the issue.

There was mention in the sparkfun code "config will only be writeable in sleep mode, so first insure that." followed by some code to put it in sleep mode. The adafruit code doesn't seem to do this. Might cause issues if you restart the ESP8266 without powering down the sensor as well? I'm not familiar with the BME280 datasheet yet (my breakout board is still on its way).
User avatar
By RKieboom
#43434 Good idea and thanks!

But no, it doesn't help. I have to add that my humidity error is somewhat in range, the problem is still my temperature that is one degree off (as so many people reported on the combination of ESP and BME, not only on this forum). The strange thing is that combined with the Uno it is dead on...

My current measurements:
HTU21: Temp=21.48 Hum=33.58
SHT31: Temp=21.71 Hum=32.78
BME280: Temp=22.65 Hum=34.89 Pres=102844.33
BME280/2: Temp=22.62 Hum=34.75 Pres=102810.24
HDC1008: Temp=21.79 Hum=26.31
MCP9808: Temp=21.69

The BME's are approx. 1 degree off. Humidity seems within limits, pressure too. The measurements shown here are after starting up, so pre-heating of the sensor doesn't seem to be the problem...
I have tried changing the clockspeed of I2C, pull-up resistors, different libraries, other power supply, capacitors on the power rail...