Skip to content

Pressure value wrong #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robert-hh opened this issue Nov 22, 2018 · 3 comments
Closed

Pressure value wrong #13

robert-hh opened this issue Nov 22, 2018 · 3 comments

Comments

@robert-hh
Copy link
Contributor

robert-hh commented Nov 22, 2018

The pressure values are slightly wrong. They are about 10hPa too high, compared against calibrated device and other implementations. The reason is a wrong code. Lines 192-194 should be:

        var1 = (((((var1 / 4) * (var1 / 4)) / 8192) *
                (self._pressure_calibration[2] * 32) / 8) +
                ((self._pressure_calibration[1] * var1) / 2))

Compared against the Bosch reference code. After the change, the result matches the reference pressure value substantially better and also matches other implementations.
P.S.: I should note that the humidity reading of my Adafruit sensor are completely wrong, 83.3% instead of 75.5% over a saturated NaCl solution, and that with every driver I tried. I had that with a BME280 too. After re-conditioning, the situation improved.

@caternuson
Copy link
Contributor

Bosch API for ref:
https://github.com/BoschSensortec/BME680_driver/blob/e6b9bbade923d792d9ccd822ab5fada99bf40501/bme680.c#L908

Looks like the problem is due to splitting the computation into two lines.
https://github.com/adafruit/Adafruit_CircuitPython_BME680/blob/master/adafruit_bme680.py#L192
which will use an updated var1 for the second part of the computation.

What is the "re-conditioning" you mention for the humidity reading?

@robert-hh
Copy link
Contributor Author

Yes, this updated var1 was the problem.
Reconditioning is documented by Bosch as:

  1. Dry-baking at 125 °C and <5% r.H. for 6 hours
  2. Re-hydration at 25 °C and 80% r.H. for 24 hours
  3. Rest period for one hour at room temperature
    or alternatively
  4. Do not perform Dry-Baking
  5. Ambient Re-Hydration: 25 °C at >50% rH for >5d
    See also: https://ae-bst.resource.bosch.com/media/_tech/media/application_notes/BST-BME680-HS000-05.pdf, Section 5. The alternative method never worked for me. The first one can easily achieved with an electric kitchen oven (no gas) for step 1 and the air above a saturated sodium chloride solution for step 2, which gives 75.5%, if you take stuff right at hand. If you need exactly 80%, look here: https://nvlpubs.nist.gov/nistpubs/jres/81A/jresv81An1p89_A1b.pdf

@robert-hh
Copy link
Contributor Author

robert-hh commented Nov 26, 2018

For convenience, I made a PR for that. #14
P.S.: The re-conditioning worked. Humidity readings are now withing the specs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants