Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Problem when reading two BME680

    Problem when reading two BME680

    Elektrix
    Member

    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 1.4.7.4 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 1.4.7.1. 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 iaqSensor.run() 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

    Elektrix

    8 REPLIES 8

    kgoveas
    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

    Elextrix

    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.

    Elektrix

    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