Bosch BME680 Sensor


  • Hero Member

    I just created a sketch for controlling a BME680 sensor via I2C.
    For the ones who are interested in it, the sketch can be downloaded at:
    https://github.com/windkh/mysensors/tree/master/BME680Sensor

    Right now only the gas resistance value is transmitted as the air quality value (IAQ) can only be calculated when you make use of the closed source library from Bosch (which is by the way only available for ARM, X86, ...)

    The pressure is, like on the BME280 ,an absolute value. The sketch calculates the sealevel pressure from it.

    I am using the breakout board from watterott which can be found here:
    https://github.com/watterott/BME680-Breakout

    Right now you have to download this library in order to be able to compiile the sketch:
    https://github.com/windkh/BME680_Breakout
    This fork replaces the original I2C read and write routines from https://github.com/vicatcu/BME680_Breakout.

    Wiring:
    I am using a standard Arduino Uno with Radio attached to the standard pins with the mysensors 2.0 lib.
    To connect the breakout-board you need 4 wires:

    Breakout --> Arduino
    GND - GND
    NC
    VCC - 3.3V
    SCL - A5
    SDA - A4
    SDO
    CS

    The chip supports SPI and I2C. I used SCL and SDA for I2C and left SDO and CS disconnected.

    The next steps will be making the air quality values useful by finding an appropriate algorithm... stay tuned.



  • @heinz Thanks. I have tried it so far Adafruit lib and it gives me negative sea level ??!!

    How do you like the sensor? I what how accurate air quality is compare to other sensors?


  • Hardware Contributor

    @alexsh1 air quality is more accurate than other sensors but you need to use software from Bosch. It uses temperature, humidity and pressure to adjust measures gas value with some calibration data.
    As it needs a lot of memory you will need an SAMD, ESP or NRF5 processor to run it.


  • Hero Member

    I like the BME680 sensor as it has a very low power consumption. But it has also some disadvantages that have impact on the application and the environment it should be used.
    As far as I know the sensor was developed to be used in mobile phones or smart watches. Those devices are exposed to "fresh air" almost every day which makes it possible to estimate the air quality from the resistante of the sensor. The resistance of the sensor increases over the weeks and months as the internal chemical layer is exhausted or used up depending on the environment it is exposed to. The fading of the resistance can be compensated through smart algorithms that work on historical data (see post above). When the sensor is exposed to "fresh air" once a day, the algorithm can use this value as a kind of reference value to estimate the air quality index.
    But if you want to use this sensor for indoor applications, where the environment is very constant or changing very slowly, then I doubt that the algorithm is able to calculate an exact value for the air quality index.
    Knowing this means that you can use the sensor resistance also without the BSEC library and with your own simplified algorithm when "recalibration with fresh air" is done sometimes on your own. Another useful application could also be an outdoor weather station where the sensor is exposed to fresh air most of the time.
    All in all it is a cool product as it offers other measurements, too which spares hardware and minimizes the costs. In addition to that you can change the meaurement parameters of the sensor on your own as a good user manual of the sensor is also available.

    I am using the sensor in my kitchen to detect when someone is cooking. In this case I am not interested in the absolute resistance, but in the change over time. If the air quality gets worse in a very short time (resistance change per minute), then I can activate the ventilation system. The same could be done on the toilet 🙂

    best regards Heinz



  • @nca78 Damn! My node takes only 9uA (atmega328p based) and that’s including BME680. With SAMD I need to see what the sleeping consumption is. It has to last more than a year on 2xAA batteries





  • @heinz said in Bosch BME680 Sensor:

    I am using the sensor in my kitchen to detect when someone is cooking. In this case I am not interested in the absolute resistance, but in the change over time. If the air quality gets worse in a very short time (resistance change per minute), then I can activate the ventilation system. The same could be done on the toilet 🙂

    Thank you for your excellent feedback. I actually have not been thinking about such an application. Modifying kitchen sounds like an excellent idea.
    Are you using BSEC Lib?


  • Hero Member

    @alexsh1
    No I am not using the BSEC library. I read the raw values of the resistance and calculate the first derivative for triggering the ventilation system. The ventilation system is turned on, when
    (delta resistance)/minute > threshold

    Sometimes the ventilation is also triggered when I open my fridge. Then the smell of food coming out of the fridge also fires the trigger.

    It is said that the sensor is very sensitive to any kind of silicone which is basically everywhere in the air when you have dishes created from silicone in your kitchen. Silicone poisens/blinds the sensor immediately for several hours.
    So be careful when making experiments with it.



  • @heinz said in Bosch BME680 Sensor:

    @alexsh1
    No I am not using the BSEC library. I read the raw values of the resistance and calculate the first derivative for triggering the ventilation system. The ventilation system is turned on, when
    (delta resistance)/minute > threshold

    Sometimes the ventilation is also triggered when I open my fridge. Then the smell of food coming out of the fridge also fires the trigger.

    It is said that the sensor is very sensitive to any kind of silicone which is basically everywhere in the air wVErhen you have dishes created from silicone in your kitchen. Silicone poisens/blinds the sensor immediately for several hours.
    So be careful when making experiments with it.

    OK, so you are using the first derivative (rate of change/time). Clear
    This is amazing - it triggered when one opens the fridge? Must be very sensitive.

    Ok, let me tinker with the sensor and I'll post my feedback here.


  • Hero Member

    @heinz said in Bosch BME680 Sensor:

    Right now only the gas resistance value is transmitted as the air quality value (IAQ) can only be calculated when you make use of the closed source library from Bosch (which is by the way only available for ARM, X86, ...)

    Supposedly the Bosch library also runs on a Mega2560.


  • Hero Member

    @nca78 said in Bosch BME680 Sensor:

    @alexsh1 air quality is more accurate than other sensors but you need to use software from Bosch. It uses temperature, humidity and pressure to adjust measures gas value with some calibration data.
    As it needs a lot of memory you will need an SAMD, ESP or NRF5 processor to run it.

    Have you gotten the Bosch library to work on any of the above?

    At present my living room seems to be a prestine 260KOhm. I say that only because the higher the number, the better. Also, my SGP30 says I have 400ppm CO2 and around 14ppb VOC, which I guess is pretty good. i.e. it correlates with the Bosch value.

    How is it that you are currently interpreting the KOhm values?


  • Hero Member

    FWIW, a PMS5003 works great for detecting cooking in the kitchen. My sensor is in the living room, and it detects kitchen cooking anyway.


  • Hero Member

    Anyone know how long you need to heat the BME280 for before you can get an accurate measurement? I notice that if I read it once a second from the Adafruit library, the values start out low and then eventually climb up to an equilibrium value. So, whatever
    Adafruit is pre-heating it for, apparently isn't long enough.


  • Hero Member

    So, now the Bosch is reading 285, but the SGP30 is reading about the same. So, I guess it's just a loose correlation. Either that or the Bosch presents the result of trailing averages.


  • Hero Member

    Wow, I just now tried changing the pre-heat time on the BME680, and I get completely different KOhm values. I tried going from 150ms to 1 second, 2 seconds, 3 seconds, and 4 seconds. Each time the KOhm value went up, even though the air is exactly the same. At 4 seconds I was getting 760KOhm, as compared to 280KOhm with the much shorter pre-heat time of 150ms.

    Given this, how does one pick a proper pre-heat time?

    [Edit: even worse, now that I've tried these other settings, if I go back to the original settings (pre-heat to 320C for 150ms), I'm getting much lower values than previously. Now, instead of 280Kohms, I'm getting far close to 200KOhms.

    This is not good!

    Even how often I read the sensor has an effect on the value it reports.]


  • Mod

    @neverdie sounds you might have found a good source for random number generation 😉



  • I am dealing with these types of sensors on a professional level so, I thought I could add to your experiments.
    As mentioned above these sensors are very sensitive to organic compounds, which get emitted by silicon bases materials.

    This can go as far as tainting the sensors completely and rendering them useless. I remember a oversized project to qualify new glues for the whole production, after having to scrap 5k+ sensors because of tainting. They said the sensors where “poisoned” 😊

    A standard approach is to get rid of some residual compounds is to heat the sensor to a higher temperature to get rid of these compounds, then lowering the temp. to get a reading.

    This is all not low power application but I guess BOSCH is going this approach. The reason why you get different resistive values after you experimented with preheat phase times, seems to me as a typical finding after a longer heating phases, which “cleaned” the sensor.
    The reason why you get higher values with longer preheat times is weird though. Maybe they use the known thermal mass of the sensor to estimate the die temperature from the heating time with known power. But this would be a very crude approach, but would explain your results. The longer the preheat phase, the hotter the senor, changing your results.


  • Hero Member

    I'm guessing the BME680 sensor just doesn't lend itself to one-off measurements. Probably (?) using the BSEC software is required, as well as waiting up to 4 days for it to calibrate. Here's a quote from the datasheet:

    The calibration process considers the recent measurement history (typ. up to four days) to ensure that IAQ ~ 25 corresponds to “typical good” air and IAQ ~ 250 indicates “typical polluted” air

    It does make me wonder though: if it calibrates in a dirty environment, how does it ever know what a clean environment is?

    In any case, I think there needs to be more guidance about what kind of pre-heats to do and for how long, and also how often the sensor should be read, since that also appears to affect the measured value.

    [Edit: I will say that the SGP30 seems a lot easier to comprehend and work with, and its measured values seem to make sense in light of what I know about the environment. So, I'm not sure that I'll be going further with the BME680 at this time. Its use of closed libraries is just not friendly, and the non-transparency draws into question whether the code is even correct or not since the usual checks by open inspection are missing. ]


  • Hardware Contributor

    Thank you for the feedback @neverdie, it seems I need to order some SGP30. I'll add it to my air quality board and also add a level converter for i2C section.

    Did you buy the BME680 on a breakout board or chip only ?

    I'm not shocked by the "calibration" process, it's similar to what CO2 sensors do, they take the minimum over a period of time and decide it's 400ppm (co2 level outside). It's not adapted to constantly polluted/closed environment but fine for inside home where you're supposed to regularly open windows to get fresh air.


  • Hero Member

    @nca78 I bought my bme680 on an adafruit breakout board. Same with the SGP30. Both purchased from Digikey.



  • I am working on BME680 to interface with the MSP430launch pad having microcontroller MSP430G2553 using I2C interface. My code is not working correctly and I am getting the wrong readings. May be there will be problems in compensation parameters. I tried the almost similar code on BME280 and it was working fine.

    Online code available at Github is only for arduino and I have checked it is working on my sensor adafruit BME680 board interfaced with arduino.

    Please someone can help me.



  • @neverdie this is my observation as well that the sensor is showing strange values in the beginning but gradually they become more and more accurate. I have not tinkered long enough to have good viable results.



  • @heinz Please help me out. I am using bme680 just for humidity and temperature and trying to run code on code composer studio without activating the gas registers.Problem is that where are the data calibration registers.I am getting the temperature results correct but humidity results are completely terrible. I am getting the values of humidity like 0% then 100% then -1.35% then 0 the 1.8%

    Kindly provide some help. I am using msp430 launch pad and I2c protocol to communicate between sensor and controller.


  • Hero Member

    @sm_ali
    You can have a look at this lib here
    https://raw.githubusercontent.com/DFRobot/DFRobot_BME680/master/bme680.c

    there is code that handles the calib thing


Log in to reply
 

Suggested Topics

  • 8
  • 7
  • 90
  • 3
  • 44
  • 2

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts