I've already successfully got the temperature, humidity, pressure and resistance values thanks to Adafruit libraries of BME680. To get the IAQ index (in ppm), it is said to use BSEC library from Bosch, which is available from GitHub as well (BSEC library). However I got the following error after modifying the platform.txt file (found in C:\Program Files (x86)\Arduino\hardware\arduino\avr) as instructed in the link.
WARNING: library bsec claims to run on (samd, sam, esp8266) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s).
GetFileAttributesEx C:\Users\LBM\Documents\Arduino\libraries\bsec\src\atmega328p: The system cannot find the file specified.
Error compiling for board Arduino/Genuino Uno.
It seems BSEC library does not support Atmega328p? Could anyone tell me how to use this library? And if could not, does anyone know how to calculate the IAQ index based on the gas resistance values, which are the register values? Thank you very much for your time.
It seems BSEC library does not support Atmega328p?
It does support the ATmega2560 which might be similar enough to get results. But as this library is binary-only I would not use it at all. Any small change to the Arduino IDE might quit support for this library. If Bosch is unable to provide an open source library boycott them.
I dont think its appropriate to abuse BSEC for their BME680 Library. It is what it is. You could try asking BSEC about the issue on their forum, as I have done.
Other developers have managed to develop their own Libraries to wrap or extend or simplify the BSEC Library, such as Seeed, DFRobot, Adafruit and others.
There is a problem with the Arduino CC (I have tried versions 1.8.9 thru 1.8.12) in that it does not include compilation/linkage of the core precompiled archive containing BSEC proprietary code for the sensor. this would be the file named libalgobsec.a which is located in a folder named for the target board. The result is that certain key functions necessary to configure the sensor and read the extended result set cannot be found.
There appears not to be a version that suits the AT328P processor used by various Arduino Uno boards. The Uno and its clones are not mentioned in the Readme.md file in the part that expressly defines which processors/boards are supported. So that answers an earlier question on this thread.
The reason for this is not stated, however it seems likely that the 328P processor lacks sufficient memory to hold all the variable structure (in RAM) needed to access all functionality of the sensor. 2K Bytes just isnt enough. In my case I found it necessary to upgrade to a Mega2560 board to get enough ram to operate the BME680 along with a Real Time Clock, OLED Display, SD Card and Dust Sensor.
However basic functionality for the BME680 can be used without accessing the library, even with a Uno. You can read temperature, RH and Pressure and Gas Resistance. If you find that you need additional functionality however you will need that library. IMO, BSEC need to address the compilation issue, along with Arduino addressing the compiler issue.
brynparrott:
There is a problem with the Arduino CC (I have tried versions 1.8.9 thru 1.8.12) in that it does not include compilation/linkage of the core precompiled archive containing BSEC proprietary code for the sensor.
pylon:
Any small change to the Arduino IDE might quit support for this library. If Bosch is unable to provide an open source library boycott them.
Yeah well seems like that might have happened already. Bosch say that Arduino CC version 1.8.12 has broken something, and recommend using versions 1.8.9 thru 11. I tried that and it still does not compile correctly.
Yes, its frustrating that BSEC have not chosen to support every single platform, but it seems that they wish to safeguard their intellectual property, and their reputation, because should someone choose to modify the code and there is some consequence, Bosch could be sued. It would be a commercial decision on their part to limit commercial risk to those platforms they can resource to test and guarantee results.
Boycotting them would be like stamping on your own foot. You can choose to use their sensor and get the value it provides, or you can choose someone elses product. Better to try to persuade them there is value for them in continuing to support a wide range of Arduino and SBC platforms.
Well, I reached out to Bosch via the BSEC forum and got a good result.
It turns out the reason the compiler does not include linkage of precompiled archive element (libalgobsec.a) in the linkage script is that there is a missing element in :
/hardware/avr/platform.text
(Note this example is for avr platform)
The file needs to have an additional line added into the section
Labelled for platform.local.txt.
The extra line is:
compiler.libraries.ldflags=
to the section that refers to flags that can be overridden in platform.local.txt
Also need to add text to the line that begins: recipe.c.combine.pattern…
Before the text “-L{build.path}”
Insert this text ( note not quoted)
{compiler.libraries.ldflags}
These changes allow the linker to find the required library on the path
/libraries/bsec_bme680/SRC/
eg
documents/arduino/libraries/bsec_bme680/src/atmega2560
The linker looks at the line:
Ldflags=-lalgobsec found in library.properties in the base of the library folder.
I found this works with arduino cc 1.8.10
I found that I was able to get the dfrobot and bsec example sketches to compile and link.
Also Note I had to perform extensive surgery on the dfrobot library to upgrade its version of bsec to the latest distribution But the bsec library examples worked without changes. (For both I had to make changes to my own sketch of course, the libraries have a completely different set of public methods)
Bsec say that arduino 1.8.12 is broken, which may refer to other issue mentioned above.
As a further note: Do not expect to be able to run this Bme680 sensor library on a board with 2k of ram. You will need a mega with 8k to run it properly and get full functionality. Using the bsec library added over 2.5k to my sketches ram usage.
hopefully this issue will reach the developers, seems pretty simple to fix it.
minhlb:
It seems BSEC library does not support Atmega328p?
OK The avr 328 boards have only 2k of ram, but the bsec library will use over 2.5 k, so in that sense its not compatible.
You could use a cut down library like Seeds version, but then you will not have access to the full functionality and accuracy provided by the sensor.
That is because Bosch BSEC in their wisdom chose to lock up a lot of the more sophisticated functionality in a proprietary archive library, which chews through a lot of ram in data strictures needed to store the necessary information coming out if the sensor and configuration info.
Refer to my other posts on this thread for more info.