ESPurna ESP8266 Automation Firmware Gets Support for BME680 Sensor’s Precise Indoor Air Quality Measurements

Bosch BME680 is a 4-in-1 air quality sensor measuring relative humidity, barometric pressure, ambient temperature, and gas (VOC) levels. It’s found in boards such as STM32 based Metriful Sense or Nordic Thingy:91, and Bosch Sensortec published an Arduino library based on “Bosch Sensortec Environmental Cluster (BSEC) Software” to provide precise calculations temperature, humidity, pressure, and indoor air quality (IAQ).

BSEC proprietary algorithms can provide indoor air quality data as good as more expensive CO2 sensors according to a recent presentation by the company. Max Prokhorov, lead ESPurna maintainer, and Rui Marinho noticed none of the popular open-source ESP8266 automation firmware including ESPurna, Tasmota, and Esphome supported BME680 sensor just yet.

BME680 air quality sensor
A Close-up on BME680 Sensor without lid

So they decided to work together to add BME680 sensor support via BSEC library to ESPurna firmware, and now it’s very easy to use as you just need to define BME680_SUPPORT=1 before compiling the firmware. You’ll find the now-merged pull request here.

The feature was previously discussed in Tasmota, but they did not go ahead as due to a license issue:

My first reaction would be if Bosch wants to sell these sensors AND have users using it then they shouldn’t use such a restricting license.

As said before many users use pre-compiled binaries and I won’t add any interface to satisfy any license.

In short, they have the wrong license for Tasmota. Pity Bosch.

It must be because of this part in Bosch Arduino repository:

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.

It’s not a standard license, and the license is 6-page long. Having said that, Rui has a different understanding of the license agreement:

Since there is now an open repository for Arduino directly from Bosch Sensortec on GitHub which includes the proprietary lib compiled for the BME680, in my understanding, as long as we don’t deliberately remove any copyright notice (which 3-Clause BSD requires), then there should be no reason not to include it here. manages this dependency, so the copyright notice is always downloaded and carried around alongside the compiled library.

Optical CO2 Sensor vs BME680 VOC Sensor
Optical CO2 Sensor (~50 Euros) vs BME680 VOC Sensor (15 to 20 Euros)

Typical applications for BME680 sensor and BSEC software include health monitoring (e.g. warning regarding dehydration/heat stroke), home automation control, gaming applications like flying toys, IoT applications, enhancement of GPS navigation (e.g., time-to-first-fix improvement, dead-reckoning, slope detection), indoor navigation (floor detection, elevator detection), health care applications (e.g. Spirometry), vertical velocity indication (e.g. rise/sink speed) and more.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

4 Replies to “ESPurna ESP8266 Automation Firmware Gets Support for BME680 Sensor’s Precise Indoor Air Quality Measurements”

  1. That’s some super helpful code to look at. I love how well-wrapped up the whole thing is, even including some platformIO-specific python utilities to handle fixing the linker script for placement of the library on ESP8266s. And the comment in the pull request about the 3 seconds (Low Power) / 300 seconds (Ultra Low Power) is an absolute max for requiring a poll of the sensor else the BSEC library will never calibrate itself might explain some problems I’ve been running into playing with it myself (via ESPHome as a custom_component). Nice!

    About the license, I think they’re both right?

    As long as ESPurna is very careful to never distribute a pre-compiled version with the support enabled / linked with the BSEC library, they don’t need to worry about the license of BSEC, that’s only the problem of any end user who downloads (via pio’s library auto-download support) and compiles a custom build themselves. And an argument can’t even be made about them needing to follow the license just because they’re using the API of the library since they’re targeting a BSD-licensed arduino wrapper library.

    And, OTOH, Tasmota are also correct that it’s illegal to distribute a pre-compiled binary with BSEC included, as the BSEC object code isn’t covered under that BSD license (from the repository’s LICENSE file: “The binaries and includes for the core BSEC library in this repository are licensed under the Software license agreement described in the link”): only the Arduino interface/wrapper to the library is (again, from the LICENSE file: “The Arduino wrapper and BME680 Sensor API are licensed under the following license”, followed by a BSD-3-CLAUSE).

    And Tasmota are also probably right that not many people will ever make use of BME680+BSEC support without a pre-compiled binary and that alone seems like enough that it’s not worth the effort of implementing it.

    1. Maybe Rui will comment here and confirm, but I understand the news is about integration of BSEC library for support for precise indoor air quality measurements.

    2. The BME680 seems to be a fairly raw, general-purpose hotplate gas sensor (plus a temperature-humidity-pressure sensor like a BME280). You just set a profile of up to 10 temperature and duration setpoints for the heater and then cycle through them reading a resistance value from the gas sensor for each temperature setpoint. This is the extent of what the esphome driver implements (though I think it only supports a single temperature+duration).

      Bosch also offer a binary-blob blackbox library named BSEC that sits itself between you and the sensor, loads the sensor’s hotplate settings with its own set of profiles, and uses the readings to calculate Indoor Air Quality, breath-VOC, estimated CO2, etc. It also provides compensated temperature and humidity readings and even tries to estimate the ambient temperature outside of any sort of device housing the sensor might be inside. That library is what the new ESPurna code uses.

      You could use esphome to measure the resistances at specific temperatures and then calculate the presence of various gases, but you’ll have to come up with the formulas + code yourself because there isn’t really much out there around the BME680 aside from BSEC. The datasheet doesn’t even seem to really detail the gas sensor’s responses/sensitivities/whatever-it’s-called at all — it’s almost all just about how wonderful BSEC is — so you’d probably have to do a bunch of characterization of the sensor before starting on any formulas and code.

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC