BME680 Api Observations

I have recently purchased a BME680 for evaluation and noticed that there are some errors in the description of pressure measurement (section 3.3.2) on the datasheet. In the floating point part there are undefined variables var1_p, var2_p and var3_p which comparing with the actual api code should be simply var1, var2 and var3. There are also some worrying mathematical errors:- (1) In initialising var1, the constant 64000.0 is used in the floating calc and the same effective value 64000 used in the integer calc. This cannot be correct because the integer calc is scaled by a factor of 100. Surely, one of these constants is incorrectly scaled? (2) Again comparing the update to var1 (line 5 in each case), the floating point and the integer versions are not mathematically equivalent. (3) Both the above issues are replicated in the driver library.

It looks like the compensation formulae in the data sheet have been reverse engineered from the code. It would be helpful and much clearer if the formula were expressed mathematically for all the compensation calculations and leave the programmer to implement them appropriately. For example the temperature compensation appears to be a simple hyperbolic function: t_comp = (x - a)(b + (x-a)c)/d . Some of the manipulations documented are obscure and I suspect have been programmed to avoid register overflow. This makes it tricky to implement the formula in other languages such as java.

Best reply by Inactive Member

Thank-you for your comments and suggestions. The undefined variables have been reported internally. Unfortunately we can only share the compensation formulas as part of the Sensor API/datasheet as done today. If supported by your platform, we recommend using the floating point integration when possible, while the integer implementation offers an alternative on more restricted devices. In case you are any issue facing with your outputs using either implementation in the Sensor API please let us know.

View original
4 replies
Resolved