Home

Awesome

Instructions for using the BSEC Arduino Library in Arduino 1.8.13

About BSEC

Bosch Sensortec Environmental Cluster (BSEC) Software v1.4.9.2 released on June 13th, 2022

The BSEC fusion library has been conceptualized to provide a higher-level signal processing and fusion for the BME680. The library receives compensated sensor values from the sensor API. It processes the BME680 signals to provide the requested sensor outputs.

Key features

Typical applications

Supported platforms

Available binaries for download:

PlatformCompilerROM (BSEC)ROM (BSEC lite*)RAMTYPE
Cortex-ARMARMCC19-20k12-13k1kCortex-M0, M0+, M3, M4, M4_FPU, M7
Cortex-ARMGCC20-22k12-14k1kCortex-M0, M0+, M3, M4, M4_FPU, M7
Cortex-ARMIAR20k12-13k1kCortex-M0, M0+, M3, M4, M4_FPU, M7
Cortex-A*GCC21k13k1kCortex-A7
AVR_8bitAVR-GCC42k251kMegaAVR, XMEGA
AVR_32bitAVR-GCC24k13k1k32-bit AVR UC3
ESP8266xtensa-lx106-elf-gcc28k17k1kESP8266
ESP32xtensa-esp32-elf-gcc24k14k1kESP32
MSP430msp430-elf-gcc34k20k1kMSP430
Android system-x86gcc39-49k22-26k1kx86, x86_64
Android system-armgcc21-38k13-19k1karm, arm64
Raspberry PI 0 linuxarm-linux-gnueabihf-gcc71k56k1karmv6-32bits
Raspberry PI3 linuxarm-linux-gnueabihf-gcc72k57k1karmv8-a-64bits

The library size information above doesn't include additional dependencies based on the embedded system project & platform.

*The BSEC lite version is an abbreviated version of BSEC with reduced code size & memory requirements. It does not include functions to save the state of BSEC, if the device powers down.

For other platforms, please contact your local Bosch Sensortec representative

Advantages

Software license agreement

The BSEC software is only available for download or use after accepting the software license agreement. By using this library, you have agreed to the terms of the license agreement.

BSEC license agreement

Installation and getting started

1. Install the latest Arduino IDE

As of this publication, the latest Arduino IDE 1.8.13 can be downloaded from this link

2. Install the BSEC library

Either download this library as a zip and import it into the Arduino IDE. Refer to this guide on how to import libraries.

3. Modify the platform.txt file

If you have already used the previous example code and hack guide, remove the linker flag -libalgobsec in the platform.txt file and reference to the compiler.c.elf.extra_flags.

The standard arduino-builder now passes the linker flags under compiler.libraries.ldflags. Most platform.txt files do not already include this new optional variable. You will hence need to declare this variable's default and add it to the end of the combine recipe. It is recommended to declare it in the following section like below,

# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
#compiler.c.elf.extra_flags=-v
compiler.cpp.extra_flags=
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.elf2hex.extra_flags=
compiler.libraries.ldflags=

and add it in the combine recipe like the below examples

ESP8266 community forum's ESP8266 core

Original line 105,

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {build.exception_flags} -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group  "-L{build.path}"

should become

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {build.exception_flags} -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} {compiler.libraries.ldflags} -Wl,--end-group  "-L{build.path}"

Arduino's SAMD core

Original line 96,

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}"  "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" -Wl,--end-group

Should be,

recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}"  "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group

4. Verify and upload the example code

Start or restart the Arduino IDE. Open the example code found under File>Examples>Bsec software library>Basic.

Select your board and COM port. Upload the example. Open the Serial monitor. You should see an output on the terminal.

Note that not all supported cores have been tested. In such cases, the examples can be found under File>Examples>INCOMPATIBLE>Bsec software library>Basic

5. Tested board/core list

The current list of tested boards include,

Core MCUTested boardsArduino core versionArduino core repository
Atmega 2560Arduino MEGA 2560Shipped with Arduino 1.8.13Shipped with Arduino 1.8.13
Cortex-m0+Arduino ZeroUpstream of v1.6.21 SHA-1 hash 86081cbf35fc0df0612a1b2c054877ff6788f9e7https://github.com/arduino/ArduinoCore-samd
Cortex-m3Arduino DueSHA-1 hash 0a4c3b196a02e48e31b752a05d8c8064007874dchttps://github.com/arduino/ArduinoCore-sam
Cortex-m4 with FPUAdafruit BlueFruit NRF52 FeatherUpstream of v0.10.1 SHA-1 hash 11614dae701a35f905d09792c7388d648b125369https://github.com/adafruit/Adafruit_nRF52_Arduino
Esp32Sparkfun ESP32 Thingv1.0.3-rc1https://github.com/espressif/arduino-esp32
Esp8266Adafruit Feather HUZZAHUpstream of v2.5.1 SHA-1 hash 625c3a62c4991347e8298fb5e4021bc6f6df7099https://github.com/esp8266/Arduino

Copyright (C) 2020 Bosch Sensortec GmbH. All rights reserved.