Zanduino / BME680

Arduino Library to access the Bosch BME680 - temperature, pressure, humidity and gas sensor
GNU General Public License v3.0
37 stars 10 forks source link

Temperature readings are too high #5

Closed chmasi closed 4 years ago

chmasi commented 4 years ago

Hi after dealing a while with the BME680 I had the feeling that the Temprature out of the readings seems to be to high. After doing some research I found this from Bosch

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)

Do you have a parameter that this mentioned compensation can be added to the initialisation? If not is there a plan to integrate it?

Thanks Martin

SV-Zanshin commented 4 years ago

I don't have anything like that in the library yet. The idea of adding a compensation value to the class initialization is a possibility, as is a separate call which might also allow for a "calibration" to be done if the actual temperature outside the enclosure is known; assuming that the delta between inside and outside remains identical across the expected temperature range.

SV-Zanshin commented 4 years ago

I'd forgotten this issue until now, when I'm reviewing the library. I will look into how to implement an "offset" to the raw temperature readings - this will be done either at initialization or through an additional function, i.e. "adjustTemperature()" which will apply an adjustment value to all temperature readings.

SV-Zanshin commented 4 years ago

I initially added 4 functions, "offsetTemperature()", "offsetHumidity()", "offsetPressure()" and "offsetGas()" to the library and then changed my mind. I decided that any adjustment of the raw values is application-dependent and not really a matter for the library to handle. So the library will continue to deliver raw measurements and the user program should adjust those values accordingly instead of making the library more complicated than it needs to be by handling it there.

Hence I'll close this issue - but I remain open to suggestions if you feel that this should be implemented in the library after all.

chmasi commented 4 years ago

If you look at the port from Bosch itself ( https://github.com/BoschSensortec/BSEC-Arduino-library ), even the original library from Bosch has a functionality to set a temperature offset, this setting is also affecting the calculation of humidity, so no need for the others in my opinion. Maybe you think again, and hopefully change your mind again.

Freundliche Grüsse Martin Sickel


Oberdorfstr. 28 78337 Öhningen +49 7735 3551 martin@die-sickels.de

Am So., 10. Mai 2020 um 08:08 Uhr schrieb Arnd notifications@github.com:

I initially added 4 functions, "offsetTemperature()", "offsetHumidity()", "offsetPressure()" and "offsetGas()" to the library and then changed my mind. I decided that any adjustment of the raw values is application-dependent and not really a matter for the library to handle. So the library will continue to deliver raw measurements and the user program should adjust those values accordingly instead of making the library more complicated than it needs to be by handling it there.

Hence I'll close this issue - but I remain open to suggestions if you feel that this should be implemented in the library after all.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SV-Zanshin/BME680/issues/5#issuecomment-626279133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGER4CNFXAEQ4JIXHN3JUQTRQZAD7ANCNFSM4IUXBXPQ .

SV-Zanshin commented 4 years ago

I am looking at the documentation again from Bosch for the BME680 (I see that they have a newer version than what I originally used). The computations in the library for the temperature actually return the compensated values rather than the raw values. Compare the formula used at lines 345-350 in the Zanshin_BME680.cpp library with that on page 17 of the https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf datasheet.

SV-Zanshin commented 4 years ago

The BST-BME680-Integration-Guide references an offset in the initialization code for "bsec_iot_init", which is unfortunately not implemented in their Arduino version and the corresponding "begin()" method has no such parameter for compensation. I will have to see if I can find the source code in the BSEC software where they apply that offset and how they change the relative humidity reading; if I can find that code then it could be added to the library - but at the moment I am uncertain of how it would be applied.

SV-Zanshin commented 4 years ago

OK, I've downloaded the main BSEC software and am looking into it. The compensation formula is not directly visible to me.

SV-Zanshin commented 4 years ago

It looks to me as if the compensation already done by the library is what Bosch is referring to, and that the only difference is that a fixed temperature offset can be set in BSEC.