Skip to content

Interface to Bosch Sensortec Environmental Cluster (BSEC)

Notifications You must be signed in to change notification settings

drogue-iot/drogue-bsec

Repository files navigation

Drogue IoT BSEC interface

Matrix

A crate to interface with the Bosch Sensortec Environmental Cluster (BSEC) library:

BSEC library provides higher-level signal processing and fusion for the BME680. The library receives compensated sensor values from the sensor API. In order to fully provide the requested sensor outputs, Bosch Sensortec environmental cluster processes the BME680 signals and combines them with the additional phone sensors.

License

The BSEC library itself is not open source, it comes with a proprietary license and no source code.

So it is not possible to include the library, the source code, the header files, or any derived work from that in this repository. Therefore, it is also not possible to provide a crate, from e.g. crates.io.

However, the BSEC library is distributed by Bosch on GitHub at BoschSensortec/BSEC-Arduino-library. You still need to accept the license terms in order to use it, but this makes it easier to integrate the library into your own project.

This repository references the "BSEC-Arduino-library" repository as a Git submodule. If you check out the repository recursively, you will also check out the "BSEC-Arduino-library":

git clone --recursive https://github.com/drogue-iot/drogue-bsec

You can also define a dependency in your Cargo.toml using Git:

[dependencies]
drogue-bsec = { version = "0.1", git = "https://github.com/drogue-iot/drogue-bsec", branch="main" }

See:

TODOs

  • Provide a way to load and save the internal state
  • Allow providing custom configuration settings

Example

The example can be run with:

cargo +nightly run --release --target --target thumbv7em-none-eabihf --features stm32f4xx,display --example simple

It assumes that:

  • You are running on an STM32F411

    Other chips and boards should be possible, but you need to tweak the configuration for that.

  • Have the BME680 attached to I2C2

  • Have a ssd1351 compatible display attached to SPI1 (if the display feature is used)

    • CS to PC13
    • DC to PC5
    • RST to PC4

If you enabled the display feature, it should look like this:

photo of a device running the example with a display

Build

This crate requires the nightly channel, and the cargo feature host_deps enabled, in order to work properly.

Add the following to the Cargo.toml of you binary project:

[unstable]
features = ["host_dep"]

Then, run cargo with +nightly:

cargo +nightly build

This is required due to issue cargo#5730.

In a nutshell: Most likely you are going to build this crate for a target platform that does not match your host platform, and your target is most likely no_std. However, this crate requires the use of bindgen, at build time (due to the reasons explained above). The dependencies of bindgen however pollute the dependency tree, and make it depend on std.

Using host_dep resolves this issue.

See:

About

Interface to Bosch Sensortec Environmental Cluster (BSEC)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published