Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Problem when reading two BME680

    Problem when reading two BME680


    Hello all,

    I am new to the forum. Somebody at the Embedded World fair told me about this forum. Thanks for that.

    In my application I have two BME680 sehsors to measure air quality in two different rooms. The sensors are connected via I2C (together with bus drivers). BSEC version is from github. The controller is a Adafruit ItsyBitsy M0 (Cortex M0) and my IDE is the arduino IDE 1.8.10 running on Debian Buster. I had my software up and running with an  old version of BSEC, I think it was 1.4.6 or The way I read the sensors is the same as in the basic example but doubled for two sensors. In the old version I had readings from both sensors every three seconds as expected. Now only one sensor is read although the other one is up and running.

    To show you the problem I have altered the basic example for two sensors. For better readability I have deleted the helper functions and it reads only two values per sensor. I attach the file as zip.

    My output is:

    Sensor1 3040, 21.58, 61.29
    Sensor1 6040, 21.58, 61.29
    Sensor1 9040, 21.58, 61.30
    Sensor1 12040, 21.58, 61.33
    Sensor1 15040, 21.58, 61.32
    Sensor1 18040, 21.59, 61.41
    Sensor1 21040, 21.59, 61.51
    Sensor0 24040, 22.31, 60.09
    Sensor0 27041, 22.31, 60.07
    Sensor0 30041, 22.31, 60.04
    Sensor1 33040, 21.60, 61.44
    Sensor1 36040, 21.60, 61.35
    Sensor0 39041, 22.32, 60.06
    Sensor1 42040, 21.60, 61.30
    Sensor0 45041, 22.31, 60.04
    Sensor0 48041, 22.32, 60.03
    Sensor0 51040, 22.32, 60.02
    Sensor1 54040, 21.59, 61.41
    Sensor0 57040, 22.30, 60.31
    Sensor0 60041, 22.31, 60.36
    Sensor1 63040, 21.59, 61.97
    Sensor0 66041, 22.31, 60.38
    Sensor1 69040, 21.60, 61.90

    Sometimes it reads sensor 0 and sometimes sensor 1 but I don't get readings from every sensor every three seconds.

    The problem seems to be a timing problem. I think when is TRUE there is only very little time to read the values. Otherwise they are gone. In my application reading and displaying the results on a serial display takes so much time that the values of the other sensor are already gone.

    This behaviour is strange and unexpected to me as it makes no sense in my eyes. And it worked correctly this way in an older version of the BSEC library.

    So my question is:can anybody give me any information how to solve the problem?

    Very best regards


    8 REPLIES 8

    Community Moderator
    Community Moderator

    Hi @maren ,

    you may try to use the GitHub - BoschSensortec/Bosch-BME68x-Library: Arduino library for the BME680 and BME688 sensors from.... It however can only provide the raw values from the sensor without any processing of the BSEC library. I2C may not work at the moment as the Uno only supports 32 byte reads. There are active pull-requests to fix this however it is not yet merge. You may use that code as reference. 

    Hi maren,

    if you use a library for a 8-bit platform like the adafruit library or a arduino library you cannot read the IAQ values as these are calculated values from the raw data of the gas sensor. This works only on 32-bit controllers. If you want to read the IAQ values you have to use a 32-bit controller like the Cortex M0 (Arduino Zero or Adafruit Feather M0 Express or Adafruit ItsyBitsy M0 Express in my case) and the BSEC library. You can get the library precompiled for different platforms like Arduino IDE. In the current version it is able to read two sensors. This is what I did.

    Hope this helps


    Hello @Elektrix , 

    thank you for the reply! I do not want to read the IAQ values as is it not possible with Arudino UNO, as you read. I got a formula for the calcualtion which is in the code included (found on Github). Unfortunaetly I only have the Arduino UNO for this project. But even if I just want to get the data for e.g. pressure from both sensors, it shows me for both of them only the value 0.0 . 

    Hi @maren ,

    you should try to do some basic I2C communication with the sensors to see if the bus is working. This should be done without using the BME680 libraries. In Arduino IDE use the Wire library directly. You can try to read the chip ID register 0xD0. Then you will see if the communication works or if it doesn't.. From there you can narrow down the error.