Git Product home page Git Product logo

Comments (5)

Gadgetoid avatar Gadgetoid commented on September 24, 2024 2

Humidity uses t_fine to as part of the compensation formula, which is the partially compensated temperature value before it's converted to human-readable degrees C.

BOSCH's own open-source BME680_driver does not demonstrate the method needed to alter or compensate this value during temperature compensation of other measurements.

While their BSEC software might, as far as I'm aware it's distributed only as binary blobs and is closed-source, so we can't extract the logic used from it.

If anyone can demonstrate a method of compensating temperature such that the degrees C and humidity results are accurate, then I would gladly integrate it into this library.

Looking at how t_fine is converted to degrees C:

https://github.com/BoschSensortec/BME680_driver/blob/e6b9bbade923d792d9ccd822ab5fada99bf40501/bme680.c#L887-L888

Suggests that a compensation amount given in degrees C (since we can't expect the end user to know what units t_fine is expressed in) could be converted to an offset against t_fine using the following formula:

offset_in_t_fine = ((offset_in_c << 8) - 128) / 5

Which gives you a t_fine offset of 179 for 4.0C.

To see if this corrects your results, you can subtract this value from the stored t_fine calibration value here:

https://github.com/pimoroni/bme680/blob/master/library/bme680/__init__.py#L296

Let me know how it goes!

from bme680-python.

David-Hari avatar David-Hari commented on September 24, 2024 1

The bme280 suffers from the same problem.

Looking at the code for each, I see they are quite different in how they calculate things. I can see the bme280 is doing some sort of compensation, but it does not allow me to plug in a corrected temperature value (or offset).

@Gadgetoid , can we get a similar offset function in the bme280?

from bme680-python.

ferazambuja avatar ferazambuja commented on September 24, 2024

That's normal. The sensor is not factory calibrate for temperature. You need to add a temperature offset.
Not sure if the library supports.

Looking at a reference thermometer, we can see that our temperature is indeed a few degrees to high. Does that mean the temperature sensor inside the BME680 is inaccurate?
Actually no, it very accurately measures the temperature exactly where it is located on the board. But there also is the issue: our board as most devices contains some heat sources (e.g., MCU, WiFi chip, display, …). This means the temperature on our board is actually higher than the ambient temperature. Since the absolute amount of water in the air is approximately constant, this also causes the relative humidity to be lower on our board than elsewhere in the room.
As BSEC cannot know in which kind of device the sensor is integrated, we have provide some information to the algorithm to enable it to compensate this offset. In the simplest case, we have to deal with an embedded device with a constant workload and approximately constant self-heating. In such a case, we can simply supply a temperature offset to BSEC which will be subtracted from the temperature and will be used to correct the humidity reading as well.

from the Integration Guide - Bosch Software Environmental Cluster (BSEC)

from bme680-python.

ferazambuja avatar ferazambuja commented on September 24, 2024

Yes, it looks like only the BSEC does. I wish they had a more open platform.

To achieve this, we simply provide a non-zero temperature offset as the second argument to bsec_iot_init() as shown below. Here, we subtract a 5 degrees offset, for example.

/* Call to the function which initializes the BSEC library /* Switch on ultra-low-power mode and subtract a 5 degrees temperature offset */

ret = bsec_iot_init(BSEC_SAMPLE_RATE_ULP, 5.0f, bus_write, bus_read, sleep, state_load, config_load);

from bme680-python.

ayeks avatar ayeks commented on September 24, 2024

Thanks a lot guys!

To convert the offset_in_c to offset_in_t_fine you have to multiply it also by 100. Source

The function is: self.offset_temp_in_t_fine = int((((offset_in_c * 100) << 8) - 128) / 5)

SET offset 0
27.88 C,982.67 hPa,46.236 %RH
SET offset 4
23.89 C,976.18 hPa,45.770 %RH
SET offset 10
17.89 C,966.54 hPa,45.071 %RH
SET offset 20
7.90 C,950.56 hPa,44.036 %RH

I will commit a merge request later.

from bme680-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.