Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BME 680 Gas resistance adc reading 0

    BME 680 Gas resistance adc reading 0

    Established Member


    I'm using the BME680 and I'm facing a problem with GAS Resistance measurements.

    Here is my setup:

    • - custom board, 3v3, I2C connection
    • -  BSECv1.4.7.3 used within barebone ARM-M4F/GCC environment
    • - main code mimicking "bsec_iot_example", using "LP" or "ULP" measure rate

    I first thought everything worked fine as I'm getting Temp,Pressure and RH values nicely correlating with measured environment, but even after a few days (weeks) of running measurements, I could still not make any sense of IAQ values.

    It turns out that the GAS_RAW value is stuck to a high value corresponding to an adc reading of zero (gas_r=0 and gas_range =0).

    I checked requested heater temperature and time (given by BSEC) and it looks correct (320 C/ 197ms in 3 seconds "LP" setup).

    When fetching results I always get gas_valid and heat_stab bits set, thus the measurement seems to be correctly performed.

    I traced the first seconds of measurements of a brand new BM680 and I saw that adc reading are actually moving:

    18:46:07:642 [DRV 3] calc_gas_resistance: adc:392 range:11 -> 4291.02
    18:46:10:634 [DRV 3] calc_gas_resistance: adc:960 range:9 -> 11720.93
    18:46:13:633 [DRV 3] calc_gas_resistance: adc:379 range:8 -> 34713.96
    18:46:16:635 [DRV 3] calc_gas_resistance: adc:413 range:7 -> 68053.58
    18:46:19:638 [DRV 3] calc_gas_resistance: adc:616 range:6 -> 116028.30
    18:46:22:641 [DRV 3] calc_gas_resistance: adc:619 range:5 -> 229796.34
    18:46:25:643 [DRV 3] calc_gas_resistance: adc:839 range:4 -> 401811.03
    18:46:28:646 [DRV 3] calc_gas_resistance: adc:309 range:4 -> 588290.75
    18:46:31:648 [DRV 3] calc_gas_resistance: adc:879 range:3 -> 785630.88
    18:46:34:651 [DRV 3] calc_gas_resistance: adc:533 range:3 -> 984626.62
    18:46:37:653 [DRV 3] calc_gas_resistance: adc:310 range:3 -> 1176727.88
    18:46:40:659 [DRV 3] calc_gas_resistance: adc:187 range:3 -> 1318627.50
    18:46:43:658 [DRV 3] calc_gas_resistance: adc:80 range:3 -> 1473165.38
    18:46:46:661 [DRV 3] calc_gas_resistance: adc:860 range:2 -> 1588895.38
    18:46:49:664 [DRV 3] calc_gas_resistance: adc:687 range:2 -> 1769736.62
    18:48:22:741 [DRV 3] calc_gas_resistance: adc:825 range:0 -> 6489747.00
    18:49:34:803 [DRV 3] calc_gas_resistance: adc:366 range:0 -> 8974145.00
    18:50:13:837 [DRV 3] calc_gas_resistance: adc:221 range:0 -> 10208728.00
    18:56:32:915 [DRV 3] calc_gas_resistance: adc:0 range:0 -> 12946861.00

    but after a few minutes the values reaches 0 and stays stuck. I understand ther is a "burn-in" phase for MOX sensors, but I guess it should not "burn" down to zero...

    After unplugging/unpowering the BM680 for a while and restarting, I get back some "life" on adc measurements (starting lower than the very first time though), but following the same steep curve to zero. I tried 4 different boards with same result.

    Does it ring a bell to anyone ? What could be my problem here ? I can give more detailed info about registers setup (even though I'm just following BSEC requests).



    22 REPLIES 22

    Community Moderator
    Community Moderator

    This behavior doesn't seem expected in typical conditions. If you could share some your code and schematic related to the sensor, we could look for anything outstanding.

    Established Member


    the Hardware side is quite simple: the BME680 is on a daughtercard with another I2C sensor(Idle during my tests), powered by VREG that can be set to anything between 1.8v to 3.3v (3.3V for my last tests),  SDA and SCL are 1K-pulled to VREG, SDO tied to GND, CSB tied to VREG, VDD and VDDIO are tied to VREG and decoupled with 100nF+1uF.

    Software side is more difficult to share/explain as I had to remap your code to my environment. I'll attach an excerpt of it anyway as I think its readable enough.

    Here is a summary of the thread handling the BME:

    First the Init part:

    1. Get calibration data and fill bme680_dev.calib
    2. Initialize BSEC by calling bsec_init()
    3. Load library config if any with bsec_set_configuration (none in my test)
    4. Load last saved state if any with bsec_set_state (none in my test)
    5. Subscribe to wanted "sensors" with bsec_update_subscription (here :HEAT_COMP_TEMPERATURE, RAW_PRESSURE,RAW_HUMIDITY,HEAT_COMP_HUMIDITY,RAW_GAS,IAQ,STATIC_IAQ,CO2_EQUIVALENT)

    Then the measurement loop:

    1. Get current time
    2. Get BSEC's BME settings with bsec_sensor_control
    3. if trigger_measurement is set, fill tph_sett and gas_sett
    4. setup filter, heater control, T,P and H oversampling, runGas and NB conv etc
    5. Set power mode to Forced-mode to trigger measurement
    6. Get expected measure duration with bme680_get_profile_dur
    7. Wait and poll until BME back to sleep
    8. Fetch new data and fill "inputs" to BSEC
    9. call bsec_do_steps to get "outputs" and send them to application
    10. Wait for next iteration based on BSEC's next_call

    I attach both source code and a debug trace of its execution. If you need specific register dumps or test case I'll be happy to run them.

    Thanks for your support,




    Established Member

    I forgot the driver code...

    Established Member


    Any news about the log and source-code I shared ?