I have just completed building and programming my environment sensor using BME680 and HM3301 sensors with output to OLED 128*128 display. I am tracking down bugs right now.
Concerning BME680 readings for Pressure, I see that it reports 1009 mBAR (BAR reading values are divided by 1000). mBAR == hPA
Atmospheric pressure at Sea Level is typically 1013 mBAR, so this reading is obviously incorrect. In fact Government Weather Bureau today says Barometric Pressure is 1020 mBar/hPA. The Weather Bureau will email me details on how I can calibrate a Barometer.
I am trying to understand where the error can be coming from.
On DFRobot I find their version of the Library supports extra function calls to force calibration of the Pressure Sensor, including adjustment for Elevation, but those function calls are not supported in the Seeed library.
My elevation is 96.00 Metres, Latitude 35.09 South…
Please can someone lend me some guidance on apparent inaccuracy of the pressure sensor and how I can make adjustment to make it match the weather report.
Yes. I heard somewhere that the BME280/680 Need a long time to burn in (of the order weeks of time). But access to library functions that force recalibration would help I think make it less time.
Currently the error in pressure is ~ -11.43 mBAR.
I have ordered a battery, when it arrives I can take the unit to other places and check if the error is consistent. Thanks for your help.
Cheers
OK. I have run the system for over 24 hours. Pressure readings show consistently ~ 20 hPa less than published readings from weather bureau. The pressure readings go up and down over time as might be expected from weather changes. This would indicate the device is operating as designed. Its not faulty. The problem is library code. My own code just reads the values provided by the library.
I think that you need to
(a) confirm that BME680 Library seeed distribution is using the latest API available from Bosch. Maybe they fixed a bug.
(b) provide additional function calls in the Seeed_BME680 Library to allow adjustment/compensation/recalibration of readings to allow for Altitude, latitude and temperature. Your current library today just pretends this is not necessary. That is incorrect. If I wanted readings approximate I would have purchased one of the less accurate sensors. (!!)
I have checked various forums concerning this issue and found that its not the first time it has occurred.
Bosch have issued various versions visible on github, the latest being 3.5.10 dated 1/2020
Version 3.5.3, 3.5.6, 3.5.7, 3.5.8 and 3.5.9 all included changes to calc_pressure.
Current version 3.5.10 also has seen several commits that change calc_pressure too.
Your distributed version of this library says its based on 3.5.5 so its old old old.
It seems evident that the very complex calc_pressure function has provided more than its fair share of problems over time.
So, like I said in earlier post, please update the library to latest stable version 3.5.9, let’s see if its more stable and gives a more accurate result.
I also suggest to include new function calls in Seeed_bme680 to provide for altitude compensation, calculate altitude and initiate recalibration.
I notice, when I went to install the library into Arduino IDE, I already have the same version appearing on the list, but not yet installed. I might try that first.
OK. I downloaded the bsec library.
I installed it then looked into the files.
The first thing to notice is that bsec have wrapped the bme680 files within their own bsec file. It provides an API for the bme680 device.
Seeed studio have something similar called seeed_bme680 which calls bme680 directly, not using the bsec api.
Comparing seeed bme680 with bsec bme680 I find very few substantial differences. Just 3 functions have different coding which are :
calc_pressure, calc_gas_resistance, calc_heater_resistance
calc_pressure is the main item of interest for me and it is only different under condition of an overflow BME_MAX_OVERFLOW_VAL which is a macro. It replaces a hard coded comparison.
Surrounding code is also different in the maths but I find it difficult to understand its functioning.
I would have to try it out.
In order to use the bsec library I have to decide whether to use the seeed wrapper or the bsec api. The latter would entail a rewrite of my own code, but it would allow later modification to permit recalibration. Use of the seeed front end will still require me to devise code to perform the recalibration. Of course its possible for me to look at the dfrobot code and use it as an example.
I will first try to see if the bsec bme680 files can be just dropped in to replace the earlier version provided by seeed. Its potentially the simplest approach, but its not “purist” because it does not use the bsec api.
You can see that all except IAQ are working. That’s likely to be some issue with initialisation/Configuration I guess.There remains a difference of 110 Pa between Sea Level Pressure measured using BME680 and data published by Weather Bureau (1018 hPA). I am guessing that perhaps the reading needs further compensation adjustment for Latitude or temperature. Its a small error however and maybe not worth the effort for my purpose.
There is also an obvious error when it calculates Altitude from Pressure (79.81 M Instead of 96.0 M), possibly caused through the myriad of calculations. Altitude and Calibrated Altitude should be the same value methinks.
Seeed could do worse than simply adopting or recommending this library to users.
I have not attempted to drop the updated BME680 files into the Seed)BME680 library, and do not intend to as I am satisfied with the DFROBOT code.
I will be modifying my own sketch code to use the DFRobot library function calls.
I would not use the BSEC front end in a blind fit, its not at all user friendly, so I suggest that you reconsider redirecting users to the BSEC library.
FYI I am not out of the woods just yet.
When I modified my own sketch to use the Dfrobot library I ran into problems with the linker.
Although the dfrobot example sketch works OK the linker fails to find certain key function definitions and fails. Those function definitions are coded within bsec’s proprietary library archive.
It looks like bsec’s library archive is not being found by the linker.
I have reached put for support to both Bosch and Arduino CC forums. I’ll let you know if/when a solution is found.
OK. FYI ultimately Bosch BTEC came up with the answer as to how to make the arduino Cc linker find their proprietary precompiled archive library.
The solution involves:
(1) remove arduino cc version 1.8.12 (broken)
(2) install version 1.8.10 instead.
(3) modify $arduino/hardware/arduino/avr/platform.txt
In 2 places.
With arduino not running…
Add a line :
compiler.libraries.ldflags=
to the section that refers to flags that can be overridden in platform.local.txt
Add to the line that begins recipe.c.combine.pattern…
Before the text “-L{build.path}”
This text ( note not quoted)
{compiler.libraries.ldflags}
Of course this solution will only work with avr platforms. But it could be altered slightly for others.
This will cause the linker to recognise the line
ldflags=-lalgobsec
Within the file library.properties in the BSEC_software_library folder within
/Arduino/libraries
When I made those changes I found I could successfully build both bsec example sketches and dfrobot examples and have all of them work.
I now have two versions of my own sketch using the dfrobot and the bsec libraries.
The bsec library provides access to readings not accessed by dfrobot for example CO2 AND VOC levels separately…, but it does not apply altitude compensation to the barometric pressure readings as provided by dfrobot.
Encouraged by this success I might try to get all that working at once.
I am now able to observe that inclusion of the full bsec library set chews through an extra 3KBytes of RAM compared to the original SEED library. I am just guessing but this might be the reason Seeed originally provided the simplified library, their goal may have been to get the BME680 working on Uno and other 2K ram MCU’s for simple applications.
I think that’s a poor choice. If someone has a simple need for temp, rh and pressure reading they can use the BME280 sensor. If there is need for a more complete set of readings then BME680 is the way to go, but they will need to use an MCU with more RAM, such as Mega 2560 or a Pi. Perhaps the compatibility list ought to be changed to tell that to customers, instead of having them waste time trying to get it working when ultimately it will not meet expectations.
This would clear the way for Seeed to distribute a library with expanded functionality based on the BSEC distribution.