BSEC library for BME68x on pico enviro+

Has anybody integrated Bosch’s “AI” BSEC library on a pico?

This library supposedly converts the raw gas resistance and temp/humidity from the BME688 into more meaningful air quality index, CO2 and VOC readings. It’s closed source, see here:

I’m working on a C++ proof of concept which produces sensible values from the BSEC library but from what I’ve read it needs a 4-day run-in period to calibrate properly, and I haven’t left it this long.

Ideally I want to implement this in micropython, but I’m finding building the custom micropython to be tricky (e.g. v. sensitive to compiler version) and not sure how I go about making an independent custom C++ module that is itself dependent on other (pimoroni-pico) custom C++ modules, so progress is rather slow.

Happy to share this when it’s in a reasonable state (as much as I can given the closed source component) but wondered if I’m going to a lot of effort reinventing a wheel?

Have a look at Integrating the BSEC in CircuitPython (A work in progress) - This is not MicroPython, but CircuitPython is similar regarding linking own modules (it is a fork afterall).

I did a lot of testing with the BME688 and have a number of repos for integration of the open-source drivers into pico C++ code.

My overall verdict is very negative, I don’t think this sensor is useful for anything but detecting VOC (e.g. decaying fruits or smelling cheese). So if this is your target, that is fine. But for anything else like “air quality” this is a waste of time. And the closed source software might have some internal magic that spits out numbers, but I don’t believe this is anything near what other sensors give you.

Some examples: the temp-sensor is severely biased by the internal heat-plate used for VOC detection. That again is highly correlated with ambient temperature. I put the sensor next to my 3D printer that was printing for hours and the sensor did not detect anything (PLA and PETG seem to be no VOC). I spent hours in a closed room to see if the sensor would react to rising CO2 values: negative.

Sorry for this negative input, but I do believe the BME688 is not for us makers at home.

I got the bsec micropython module working and preliminary results look broadly promising. I’ve yet to give it a full calibration run but IAQ, CO2 and bVOC seem to be in the right ballpark. Temperature is bang-on (though I’m setting the bias to 3.9C)

Relative humidity is way off (over 10% too low), although this is also the case for direct readings from the BME68x, even after compensating for temperature bias.

The BSEC library provides different configurations for sample rate, calibration period, and supply voltage to the BME68x. I’m assuming 3.3V for the latter, but 1.8V is the other option. Can anyone confirm what the enviro+ board supplies to it? Not sure what difference this will make TBH.

My code is currently in a fork of pimoroni-pico here GitHub - virgesmith/pimoroni-pico: Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython., but it doesn’t really belong here so when I muster the motivation (cmake fills me with apathy) I’ll to move it to a standalone repo at some point. Need to work out how I resolve deps with pimoroni micropython modules from an external repo…


How can you call something “bang-on” if you need to set a bias of almost four degrees??

A simple linear adjustment gives agreement to +/- 0.1C over a reasonable temperature range?