robert-hh / BME280

Micropython driver for the BME280 sensor, target platform Pycom devices
Other
103 stars 27 forks source link

Interesting humidity calculation from Bosch #9

Open DG12 opened 1 year ago

DG12 commented 1 year ago

I suppose you are aware of the final "adjustments" in the Bosch humidity calculation:

    h = 0 if h < 0 else h
    h = 419430400 if h > 419430400 else h

I.e. if calculation produced a A)negative humidity well just make out ZERO B) over 100% just make it be 100%

I have had some really bad experiences with this (mostly in the greater than 100% area) and am planning replace those 2 lines with:

    static int_t h_last_good = 209715200;  # initialize to 50%

    if ( h <0  || h > 419430400 )  h=h_last_good ; 
    else h_last_good = h;
robert-hh commented 1 year ago

I made a lot of tests with the BME280 and other sensors, and never got just one of them in one test to > 100%. The test results showed got reproducibility for temperature between all devices, but quite some variation between the sensors. The only one which was quite good was a simple low cost DHT22. If the sensor is new, just put it aside for a few weeks. That works similar to the re-conditioning procedure from the data sheet.

test results