Skip to content

add support for BSEC2 library features #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

bstbud
Copy link
Contributor

@bstbud bstbud commented Mar 24, 2023

Description

  • add support for BSEC2 gas scanning sensors: sensor id (116) for data collection to be used with BME AI Studio, sensor id(117) for gas type classification

  • add the API to set board temperature offset relative to ambient air temperature for temperature and relative humidity compensation

  • add WebBLE parser support for sensor 116 and 117.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[x] Functionality change
[ ] Breaking change

@github-actions
Copy link

Memory usage change @ ada8ca0

Board flash % RAM for global variables %
arduino:mbed_nicla:nicla_sense ❔ -2180 - +152 -0.41 - +0.03 💚 -8 - 0 -0.01 - 0.0
arduino:samd:mkrgsm1400 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrnb1500 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1310 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board Arduino_BHY2/examples/App
flash
% Arduino_BHY2/examples/App
RAM for global variables
% Arduino_BHY2/examples/AppLowDelay
flash
% Arduino_BHY2/examples/AppLowDelay
RAM for global variables
% Arduino_BHY2/examples/BHYFirmwareUpdate
flash
% Arduino_BHY2/examples/BHYFirmwareUpdate
RAM for global variables
% Arduino_BHY2/examples/BSEC2GasScannerClassify
flash
% Arduino_BHY2/examples/BSEC2GasScannerClassify
RAM for global variables
% Arduino_BHY2/examples/BSEC2GasScannerCollectData
flash
% Arduino_BHY2/examples/BSEC2GasScannerCollectData
RAM for global variables
% Arduino_BHY2/examples/DataHarvester
flash
% Arduino_BHY2/examples/DataHarvester
RAM for global variables
% Arduino_BHY2/examples/Fail_Safe_flasher
flash
% Arduino_BHY2/examples/Fail_Safe_flasher
RAM for global variables
% Arduino_BHY2/examples/ReadSensorConfiguration
flash
% Arduino_BHY2/examples/ReadSensorConfiguration
RAM for global variables
% Arduino_BHY2/examples/ShowSensorList
flash
% Arduino_BHY2/examples/ShowSensorList
RAM for global variables
% Arduino_BHY2/examples/Standalone
flash
% Arduino_BHY2/examples/Standalone
RAM for global variables
% Arduino_BHY2/examples/StandaloneFlashStorage
flash
% Arduino_BHY2/examples/StandaloneFlashStorage
RAM for global variables
% Arduino_BHY2Host/examples/Accelerometer
flash
% Arduino_BHY2Host/examples/Accelerometer
RAM for global variables
% Arduino_BHY2Host/examples/Orientation
flash
% Arduino_BHY2Host/examples/Orientation
RAM for global variables
% Arduino_BHY2Host/examples/Temperature
flash
% Arduino_BHY2Host/examples/Temperature
RAM for global variables
% Arduino_BHY2Host/examples/Nicla_IoT_Bridge
flash
% Arduino_BHY2Host/examples/Nicla_IoT_Bridge
RAM for global variables
%
arduino:mbed_nicla:nicla_sense 128 0.02 -8 -0.01 128 0.02 -8 -0.01 -2180 -0.41 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A 128 0.02 -8 -0.01 0 0.0 0 0.0 152 0.03 -8 -0.01 128 0.02 -8 -0.01 88 0.02 -8 -0.01 152 0.03 -8 -0.01
arduino:samd:mkrgsm1400 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrnb1500 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwan1310 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwifi1010 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrzero 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,Arduino_BHY2/examples/App<br>flash,%,Arduino_BHY2/examples/App<br>RAM for global variables,%,Arduino_BHY2/examples/AppLowDelay<br>flash,%,Arduino_BHY2/examples/AppLowDelay<br>RAM for global variables,%,Arduino_BHY2/examples/BHYFirmwareUpdate<br>flash,%,Arduino_BHY2/examples/BHYFirmwareUpdate<br>RAM for global variables,%,Arduino_BHY2/examples/BSEC2GasScannerClassify<br>flash,%,Arduino_BHY2/examples/BSEC2GasScannerClassify<br>RAM for global variables,%,Arduino_BHY2/examples/BSEC2GasScannerCollectData<br>flash,%,Arduino_BHY2/examples/BSEC2GasScannerCollectData<br>RAM for global variables,%,Arduino_BHY2/examples/DataHarvester<br>flash,%,Arduino_BHY2/examples/DataHarvester<br>RAM for global variables,%,Arduino_BHY2/examples/Fail_Safe_flasher<br>flash,%,Arduino_BHY2/examples/Fail_Safe_flasher<br>RAM for global variables,%,Arduino_BHY2/examples/ReadSensorConfiguration<br>flash,%,Arduino_BHY2/examples/ReadSensorConfiguration<br>RAM for global variables,%,Arduino_BHY2/examples/ShowSensorList<br>flash,%,Arduino_BHY2/examples/ShowSensorList<br>RAM for global variables,%,Arduino_BHY2/examples/Standalone<br>flash,%,Arduino_BHY2/examples/Standalone<br>RAM for global variables,%,Arduino_BHY2/examples/StandaloneFlashStorage<br>flash,%,Arduino_BHY2/examples/StandaloneFlashStorage<br>RAM for global variables,%,Arduino_BHY2Host/examples/Accelerometer<br>flash,%,Arduino_BHY2Host/examples/Accelerometer<br>RAM for global variables,%,Arduino_BHY2Host/examples/Orientation<br>flash,%,Arduino_BHY2Host/examples/Orientation<br>RAM for global variables,%,Arduino_BHY2Host/examples/Temperature<br>flash,%,Arduino_BHY2Host/examples/Temperature<br>RAM for global variables,%,Arduino_BHY2Host/examples/Nicla_IoT_Bridge<br>flash,%,Arduino_BHY2Host/examples/Nicla_IoT_Bridge<br>RAM for global variables,%
arduino:mbed_nicla:nicla_sense,128,0.02,-8,-0.01,128,0.02,-8,-0.01,-2180,-0.41,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,128,0.02,-8,-0.01,0,0.0,0,0.0,152,0.03,-8,-0.01,128,0.02,-8,-0.01,88,0.02,-8,-0.01,152,0.03,-8,-0.01
arduino:samd:mkrgsm1400,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrnb1500,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrwan1310,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrwifi1010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrzero,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,

@bstbud
Copy link
Contributor Author

bstbud commented May 25, 2023

@facchinm
Hi
could you look into this PR? it adds feature which is essential for the BME688 sensor on board

@facchinm
Copy link
Member

Sure, I didn't have the chance to test it yet but we'll surely take a look very soon @sebromero

Copy link
Contributor

@aliphys aliphys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @bstbud 👋
Thanks for your contributions. So comments:

  • The two newly added examples - BSECGasScannerClassify.ino and BSECGasScannerCollectData.ino - compile successfully. However, they do not send any data over to the Serial monitor.
  • The examples use very low level syntax to interface with the sensor. This increases the barrier of entry for users.
  • The additional code should be documented, for future records as well as helping users.
    cc @facchinm

if (bsec2.getNewDataFlag()) {
bsec2.setNewDataFlag(false);

Serial.println(bsec2.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bsec2.toString() function does not print anything to the Serial. I've verified that the Serial port is sending data correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use the new examples, the new BHI260 FW needs to be updated as well, I agree this should be mentioned in a README or some other documentation. Could you try the examples after updating the BHI260 FW by using the BHYFirmwareUpdate sketch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bstbud ! Is there a way to extract the BHI260 FW version from the binary data? Is so, what's the offset and format?

@github-actions
Copy link

Memory usage change @ 0cf4a57

Board flash % RAM for global variables %
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:samd:mkrgsm1400 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrnb1500 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1310 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board Arduino_BHY2Host/examples/Accelerometer
flash
% Arduino_BHY2Host/examples/Accelerometer
RAM for global variables
% Arduino_BHY2Host/examples/Orientation
flash
% Arduino_BHY2Host/examples/Orientation
RAM for global variables
% Arduino_BHY2Host/examples/Temperature
flash
% Arduino_BHY2Host/examples/Temperature
RAM for global variables
% Arduino_BHY2Host/examples/Nicla_IoT_Bridge
flash
% Arduino_BHY2Host/examples/Nicla_IoT_Bridge
RAM for global variables
% Arduino_BHY2Host/examples/Portenta_BLE_Bridge
flash
% Arduino_BHY2Host/examples/Portenta_BLE_Bridge
RAM for global variables
%
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
arduino:samd:mkrgsm1400 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrnb1500 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwan1310 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwifi1010 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrzero 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,Arduino_BHY2Host/examples/Accelerometer<br>flash,%,Arduino_BHY2Host/examples/Accelerometer<br>RAM for global variables,%,Arduino_BHY2Host/examples/Orientation<br>flash,%,Arduino_BHY2Host/examples/Orientation<br>RAM for global variables,%,Arduino_BHY2Host/examples/Temperature<br>flash,%,Arduino_BHY2Host/examples/Temperature<br>RAM for global variables,%,Arduino_BHY2Host/examples/Nicla_IoT_Bridge<br>flash,%,Arduino_BHY2Host/examples/Nicla_IoT_Bridge<br>RAM for global variables,%,Arduino_BHY2Host/examples/Portenta_BLE_Bridge<br>flash,%,Arduino_BHY2Host/examples/Portenta_BLE_Bridge<br>RAM for global variables,%
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A
arduino:samd:mkrgsm1400,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,
arduino:samd:mkrnb1500,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,
arduino:samd:mkrwan1310,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,
arduino:samd:mkrwifi1010,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,
arduino:samd:mkrzero,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,

@bstbud bstbud force-pushed the fea_bsec2_with_webupdate branch from 0cf4a57 to 8c6d6a6 Compare September 11, 2023 15:53
@github-actions
Copy link

Memory usage change @ 8c6d6a6

Board flash % RAM for global variables %
arduino:mbed_nicla:nicla_sense 🔺 0 - +152 0.0 - +0.03 💚 -8 - 0 -0.01 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:samd:mkrgsm1400 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrnb1500 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1310 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board Arduino_BHY2/examples/App
flash
% Arduino_BHY2/examples/App
RAM for global variables
% Arduino_BHY2/examples/AppLowDelay
flash
% Arduino_BHY2/examples/AppLowDelay
RAM for global variables
% Arduino_BHY2/examples/BHYFirmwareUpdate
flash
% Arduino_BHY2/examples/BHYFirmwareUpdate
RAM for global variables
% Arduino_BHY2/examples/BSEC2GasScannerClassify
flash
% Arduino_BHY2/examples/BSEC2GasScannerClassify
RAM for global variables
% Arduino_BHY2/examples/BSEC2GasScannerCollectData
flash
% Arduino_BHY2/examples/BSEC2GasScannerCollectData
RAM for global variables
% Arduino_BHY2/examples/DataHarvester
flash
% Arduino_BHY2/examples/DataHarvester
RAM for global variables
% Arduino_BHY2/examples/Fail_Safe_flasher
flash
% Arduino_BHY2/examples/Fail_Safe_flasher
RAM for global variables
% Arduino_BHY2/examples/ReadSensorConfiguration
flash
% Arduino_BHY2/examples/ReadSensorConfiguration
RAM for global variables
% Arduino_BHY2/examples/ShowSensorList
flash
% Arduino_BHY2/examples/ShowSensorList
RAM for global variables
% Arduino_BHY2/examples/Standalone
flash
% Arduino_BHY2/examples/Standalone
RAM for global variables
% Arduino_BHY2/examples/StandaloneFlashStorage
flash
% Arduino_BHY2/examples/StandaloneFlashStorage
RAM for global variables
% Arduino_BHY2Host/examples/Accelerometer
flash
% Arduino_BHY2Host/examples/Accelerometer
RAM for global variables
% Arduino_BHY2Host/examples/Orientation
flash
% Arduino_BHY2Host/examples/Orientation
RAM for global variables
% Arduino_BHY2Host/examples/Temperature
flash
% Arduino_BHY2Host/examples/Temperature
RAM for global variables
% Arduino_BHY2Host/examples/Nicla_IoT_Bridge
flash
% Arduino_BHY2Host/examples/Nicla_IoT_Bridge
RAM for global variables
% Arduino_BHY2Host/examples/Portenta_BLE_Bridge
flash
% Arduino_BHY2Host/examples/Portenta_BLE_Bridge
RAM for global variables
%
arduino:mbed_nicla:nicla_sense 128 0.02 -8 -0.01 128 0.02 -8 -0.01 0 0.0 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A 64 0.01 -8 -0.01 0 0.0 0 0.0 152 0.03 -8 -0.01 128 0.02 -8 -0.01 88 0.02 -8 -0.01 88 0.02 -8 -0.01
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
arduino:samd:mkrgsm1400 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrnb1500 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwan1310 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwifi1010 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrzero 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,Arduino_BHY2/examples/App<br>flash,%,Arduino_BHY2/examples/App<br>RAM for global variables,%,Arduino_BHY2/examples/AppLowDelay<br>flash,%,Arduino_BHY2/examples/AppLowDelay<br>RAM for global variables,%,Arduino_BHY2/examples/BHYFirmwareUpdate<br>flash,%,Arduino_BHY2/examples/BHYFirmwareUpdate<br>RAM for global variables,%,Arduino_BHY2/examples/BSEC2GasScannerClassify<br>flash,%,Arduino_BHY2/examples/BSEC2GasScannerClassify<br>RAM for global variables,%,Arduino_BHY2/examples/BSEC2GasScannerCollectData<br>flash,%,Arduino_BHY2/examples/BSEC2GasScannerCollectData<br>RAM for global variables,%,Arduino_BHY2/examples/DataHarvester<br>flash,%,Arduino_BHY2/examples/DataHarvester<br>RAM for global variables,%,Arduino_BHY2/examples/Fail_Safe_flasher<br>flash,%,Arduino_BHY2/examples/Fail_Safe_flasher<br>RAM for global variables,%,Arduino_BHY2/examples/ReadSensorConfiguration<br>flash,%,Arduino_BHY2/examples/ReadSensorConfiguration<br>RAM for global variables,%,Arduino_BHY2/examples/ShowSensorList<br>flash,%,Arduino_BHY2/examples/ShowSensorList<br>RAM for global variables,%,Arduino_BHY2/examples/Standalone<br>flash,%,Arduino_BHY2/examples/Standalone<br>RAM for global variables,%,Arduino_BHY2/examples/StandaloneFlashStorage<br>flash,%,Arduino_BHY2/examples/StandaloneFlashStorage<br>RAM for global variables,%,Arduino_BHY2Host/examples/Accelerometer<br>flash,%,Arduino_BHY2Host/examples/Accelerometer<br>RAM for global variables,%,Arduino_BHY2Host/examples/Orientation<br>flash,%,Arduino_BHY2Host/examples/Orientation<br>RAM for global variables,%,Arduino_BHY2Host/examples/Temperature<br>flash,%,Arduino_BHY2Host/examples/Temperature<br>RAM for global variables,%,Arduino_BHY2Host/examples/Nicla_IoT_Bridge<br>flash,%,Arduino_BHY2Host/examples/Nicla_IoT_Bridge<br>RAM for global variables,%,Arduino_BHY2Host/examples/Portenta_BLE_Bridge<br>flash,%,Arduino_BHY2Host/examples/Portenta_BLE_Bridge<br>RAM for global variables,%
arduino:mbed_nicla:nicla_sense,128,0.02,-8,-0.01,128,0.02,-8,-0.01,0,0.0,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,64,0.01,-8,-0.01,0,0.0,0,0.0,152,0.03,-8,-0.01,128,0.02,-8,-0.01,88,0.02,-8,-0.01,88,0.02,-8,-0.01
arduino:mbed_portenta:envie_m7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A
arduino:samd:mkrgsm1400,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,
arduino:samd:mkrnb1500,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,
arduino:samd:mkrwan1310,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,
arduino:samd:mkrwifi1010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,
arduino:samd:mkrzero,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,

@akash73
Copy link
Member

akash73 commented Oct 13, 2023

@aliphys can we push this ?

@aliphys
Copy link
Contributor

aliphys commented Oct 18, 2023

@akash73 Looking into this PR in this sprint. Will keep you updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants