Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BME680 BSEC for Python

    Highlighted
    Member

    BME680 BSEC for Python

    Hello, there are clear instructions on how to compile a Python stack here, but the script is made for an old BSEC release 1.4.6.0. Generic Release. Is there anybody out of there who can drop me a copy of that specific release or with the skills to address the script toward the latest release BSEC 1.4.8.0 ?

    Thank you in advance
    // Stefano

    7 REPLIES 7
    Highlighted
    Community Moderator

    Re: BME680 BSEC for Python

    Can you share your Python script here? 

    Currently, we didn't make any formal release package for Phython version of BSEC lib.

    So i want to take a look for the current one and check if it is able to be used for latest version.

    Highlighted
    Established Member

    Re: BME680 BSEC for Python

    Hello

    A third-party python interface/wrapper is available here: https://github.com/rstoermer/bsec_bme680_python

    and basically  the new BSEC release is compatible with the older one, by "compatible"  I mean the APIs provided by BSEC such as: bsec_init(), bsec_do_steps() etc remain the same,  so you could pretty much replace the files in: https://github.com/rstoermer/bsec_bme680_python/tree/master/src/BSEC_1.4.6.0_Generic_Release_2018042... with latest BSEC release, and with minor changes (if any) expect the python interface to work. In theory, no work on the python side is needed.

     

     

     

    Highlighted
    Member

    Re: BME680 BSEC for Python

    Hello zgg,

    thank you so much for your reply, I'll give a try asap...

    Highlighted
    Member

    Re: BME680 BSEC for Python

    #!/bin/sh

    set  -eu

    . ./make.config

    if [ ! -d "${BSEC_DIR}" ]; then
      echo 'BSEC directory missing.'
      exit 1
    fi

    if [ ! -d "${CONFIG_DIR}" ]; then
      mkdir "${CONFIG_DIR}"
    fi

    STATEFILE="${CONFIG_DIR}/bsec_iaq.state"
    if [ ! -f "${STATEFILE}" ]; then
      touch "${STATEFILE}"
    fi

    echo 'Patching...'
    dir="${BSEC_DIR}/examples"
    patch='patches/eCO2+bVOCe.diff'
    if patch -N --dry-run --silent -d "${dir}/" \
      < "${patch}" 2>/dev/null
    then
      patch -d "${dir}/" < "${patch}"
    else
      echo 'Already applied.'
    fi

    echo 'Compiling...'
    cc -Wall -Wno-unused-but-set-variable -Wno-unused-variable -static \
      -std=c99 -pedantic \
      -iquote"${BSEC_DIR}"/API \
      -iquote"${BSEC_DIR}"/algo/${ARCH} \
      -iquote"${BSEC_DIR}"/examples \
      "${BSEC_DIR}"/API/bme680.c \
      "${BSEC_DIR}"/examples/bsec_integration.c \
      ./bsec_bme680.c \
      -L"${BSEC_DIR}"/algo/"${ARCH}" -lalgobsec \
      -lm -lrt \
      -o bsec_bme680
    echo 'Compiled.'

    cp "${BSEC_DIR}"/config/"${CONFIG}"/bsec_iaq.config "${CONFIG_DIR}"/
    echo 'Copied config.'
    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist