BME280 humidity bug

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
FluffyChicken
Normal user
Posts: 11
Joined: 22 Dec 2019, 17:57

BME280 humidity bug

#1 Post by FluffyChicken » 22 Dec 2019, 18:07

Help, I updated my ESP to this months (Nov or December version) and my BME280 is reporting wrong Humidity, for a start it's now returning >100%

Looking at the logs, it's not the sensor but some humidity correction based on temperature.
Now I have set a temperature correction (as is normal) but this *should not* alter the pressure and humidity as that is based on internal die measurements, not the temperature measurement reported (see BOSCH forum).
At least as far as I know and Bosch are saying, I think.
I can see no way to disable this feature.
For a start is should never adjust it to >100% !
At the very least it should be user selectable to adjust humidity.

Code: Select all

BME280: Apply temp offset -6.60C humidity 38.21% => 46.91% temperature 25.28C => 18.68C dew point 7.05C
I want the temp offset but not the offending humidity incorrect correction.
Unfortunately I don't have it showing 110% at the moment.


Build version 2019-12-22 17:09:29
BME280 on NodeMCU V2
(and SDS011 sending via one long JSON string over mqtt)

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: BME280 humidity bug

#2 Post by ThomasB » 22 Dec 2019, 19:46

Now I have set a temperature correction (as is normal) but this *should not* alter the pressure and humidity as that is based on internal die measurements, not the temperature measurement reported (see BOSCH forum).
I don't have a solution for the humidity problem you are experiencing, but I can offer an explanation for how the temperature correction affects humidity. See @TD-er's summary posted here:
viewtopic.php?f=4&t=5707&p=41412&hilit=humidity#p41412

TLDR;
The sensor itself is quite small, so it heats up rather quickly.
This means you have to make sure it is well isolated from the rest of the circuitry and also do not use thick wires to connect it to the main board as even those may transfer heat.
Also if it is really humid, the sensor may sometimes "flip" its address selectors so make sure you have those set firmly by not leaving them floating.

If the sensor heats up, the reported humidity is also off (as it should be), so I added a temp offset in the BME280 plugin, which also corrects the humidity accordingly.
The idea behind it is, if it has an offset, then it must be in an enclosure heated up by the ESP and/or power regulator, so the added heat is rather constant.
Thus you can subtract some fixed offset in temperature (within some range of course)
- Thomas

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: BME280 humidity bug

#3 Post by TD-er » 22 Dec 2019, 21:01

Yep, the BME280 plugin does compute the dew point temperature based on the measured temperature and humidity.
Then it adds the set offset to the temperature and uses this new temp & the dew point temperature to calculate the new humidity.

The problem is that if the sensor is too warm, the reported relative temperature is also off.

FluffyChicken
Normal user
Posts: 11
Joined: 22 Dec 2019, 17:57

Re: BME280 humidity bug

#4 Post by FluffyChicken » 24 Dec 2019, 10:46

I understand how it works, hence what I alter temperature, but the current 'must also do humidity' forces the problem of also giving readings of >100% humidity. (That's an impossible situation, so a bug).

I want to disable the humidity correction part (as that is relative anyway) only.

According to info on Bosch's forum, the humidity shouldn't be altered with our temperature offset correction. The BME280 temperature is only really to give the humidity reading, it only gives an appropriate ambient temperature, hence why we need to alter that depending on situation. https://community.bosch-sensortec.com/t ... r/m-p/8760

For something more accurate, I would go bme680, but as far as I last looked at it we couldn't use the BSEC to do it properly with espeasy/NodeMCU


Also found out this forum doesn't notify me by default :-(

FluffyChicken
Normal user
Posts: 11
Joined: 22 Dec 2019, 17:57

Re: BME280 humidity bug

#5 Post by FluffyChicken » 24 Dec 2019, 11:11

*unless the Bosch forum is refering to the bme280 api's ability to use the internal registers to self compensate?
https://github.com/BoschSensortec/BME28 ... r/bme280.c

Perhaps some sanity checking needs adding (like in the Bosch API) for spec range on temp, and humidity_max etc.
Though I can't quite read the code to understand exactly what it's doing, I get a general idea)
https://github.com/letscontrolit/ESPEas ... BME280.ino


P.S. it's been really nice to see people respond to a question :-).impressed.
I really like espeasy, a few changes I would make (like have and use ISO time formats and a simple mqtt as I only publish a JSON string in rules). BUT I can sort of get around that, other than get local time offset from UTC to create an iso time stamp)

Sensors are working nicely and it so easy to use compared to say Tasmota.

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: BME280 humidity bug

#6 Post by TD-er » 25 Dec 2019, 14:29

You can also use the formula option per output value of a task, then you will only adjust that single value and you know for sure there is nothing else being changed.

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: BME280 humidity bug

#7 Post by TD-er » 25 Dec 2019, 14:32

FluffyChicken wrote: 24 Dec 2019, 11:11 *unless the Bosch forum is refering to the bme280 api's ability to use the internal registers to self compensate?
https://github.com/BoschSensortec/BME28 ... r/bme280.c

Perhaps some sanity checking needs adding (like in the Bosch API) for spec range on temp, and humidity_max etc.
Though I can't quite read the code to understand exactly what it's doing, I get a general idea)
https://github.com/letscontrolit/ESPEas ... BME280.ino


P.S. it's been really nice to see people respond to a question :-).impressed.
I really like espeasy, a few changes I would make (like have and use ISO time formats and a simple mqtt as I only publish a JSON string in rules). BUT I can sort of get around that, other than get local time offset from UTC to create an iso time stamp)
We don't use the Bosch library, I only implemented the code suggested in the datasheet.
About the ISO time format. Please add a feature request for it on the Github issue tracker.
That also helps me finding them later.

ISO format would also be great to handle for parsing as the time format we use in rules is sometimes a bit ambiguous.
So a single format as a "will always be unambiguous" would be nice.

FluffyChicken
Normal user
Posts: 11
Joined: 22 Dec 2019, 17:57

Re: BME280 humidity bug

#8 Post by FluffyChicken » 25 Dec 2019, 14:47

Do it in the rules, that's a obvious answer I hadn't thought of :oops:, excellent.

In the new year I'll get an iso date/time/offset format idea up. I'll see what we use in some code we use for something else.
It's normally implemented the same as the main web rfc time format.

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: BME280 humidity bug

#9 Post by TD-er » 25 Dec 2019, 14:57

FluffyChicken wrote: 25 Dec 2019, 14:47 Do it in the rules, that's a obvious answer I hadn't thought of :oops:, excellent.
You can do it in the rules, but we also have a formula field for every task value.
Use something like this:

Code: Select all

%value%+10

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests