Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Bosch BME680 Sensor

Bosch BME680 Sensor

Scheduled Pinned Locked Moved My Project
24 Posts 7 Posters 10.5k Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • HeinzH Offline
    HeinzH Offline
    Heinz
    Hero Member
    wrote on last edited by Heinz
    #1

    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.

    alexsh1A NeverDieN 2 Replies Last reply
    2
    • HeinzH Heinz

      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.

      alexsh1A Offline
      alexsh1A Offline
      alexsh1
      wrote on last edited by
      #2

      @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?

      Nca78N 1 Reply Last reply
      0
      • alexsh1A alexsh1

        @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?

        Nca78N Offline
        Nca78N Offline
        Nca78
        Hardware Contributor
        wrote on last edited by
        #3

        @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.

        alexsh1A NeverDieN 3 Replies Last reply
        0
        • HeinzH Offline
          HeinzH Offline
          Heinz
          Hero Member
          wrote on last edited by
          #4

          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

          alexsh1A 1 Reply Last reply
          2
          • Nca78N Nca78

            @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.

            alexsh1A Offline
            alexsh1A Offline
            alexsh1
            wrote on last edited by
            #5

            @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

            1 Reply Last reply
            0
            • Nca78N Nca78

              @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.

              alexsh1A Offline
              alexsh1A Offline
              alexsh1
              wrote on last edited by
              #6

              @Nca78 Do you mean this software - https://github.com/BoschSensortec/BME680_driver ???

              1 Reply Last reply
              0
              • HeinzH Heinz

                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

                alexsh1A Offline
                alexsh1A Offline
                alexsh1
                wrote on last edited by
                #7

                @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?

                1 Reply Last reply
                0
                • HeinzH Offline
                  HeinzH Offline
                  Heinz
                  Hero Member
                  wrote on last edited by
                  #8

                  @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.

                  alexsh1A S 2 Replies Last reply
                  1
                  • HeinzH Heinz

                    @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.

                    alexsh1A Offline
                    alexsh1A Offline
                    alexsh1
                    wrote on last edited by
                    #9

                    @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.

                    1 Reply Last reply
                    1
                    • HeinzH Heinz

                      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.

                      NeverDieN Offline
                      NeverDieN Offline
                      NeverDie
                      Hero Member
                      wrote on last edited by
                      #10

                      @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.

                      1 Reply Last reply
                      0
                      • Nca78N Nca78

                        @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.

                        NeverDieN Offline
                        NeverDieN Offline
                        NeverDie
                        Hero Member
                        wrote on last edited by NeverDie
                        #11

                        @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?

                        NeverDieN 1 Reply Last reply
                        0
                        • NeverDieN Offline
                          NeverDieN Offline
                          NeverDie
                          Hero Member
                          wrote on last edited by
                          #12

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

                          1 Reply Last reply
                          1
                          • NeverDieN Offline
                            NeverDieN Offline
                            NeverDie
                            Hero Member
                            wrote on last edited by
                            #13

                            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.

                            1 Reply Last reply
                            0
                            • NeverDieN NeverDie

                              @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?

                              NeverDieN Offline
                              NeverDieN Offline
                              NeverDie
                              Hero Member
                              wrote on last edited by NeverDie
                              #14

                              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.

                              1 Reply Last reply
                              0
                              • NeverDieN Offline
                                NeverDieN Offline
                                NeverDie
                                Hero Member
                                wrote on last edited by NeverDie
                                #15

                                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.]

                                mfalkviddM 1 Reply Last reply
                                0
                                • NeverDieN NeverDie

                                  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.]

                                  mfalkviddM Offline
                                  mfalkviddM Offline
                                  mfalkvidd
                                  Mod
                                  wrote on last edited by
                                  #16

                                  @neverdie sounds you might have found a good source for random number generation ;-)

                                  1 Reply Last reply
                                  0
                                  • mr_redM Offline
                                    mr_redM Offline
                                    mr_red
                                    wrote on last edited by
                                    #17

                                    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.

                                    1 Reply Last reply
                                    3
                                    • NeverDieN Offline
                                      NeverDieN Offline
                                      NeverDie
                                      Hero Member
                                      wrote on last edited by NeverDie
                                      #18

                                      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. ]

                                      Nca78N 1 Reply Last reply
                                      2
                                      • NeverDieN NeverDie

                                        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. ]

                                        Nca78N Offline
                                        Nca78N Offline
                                        Nca78
                                        Hardware Contributor
                                        wrote on last edited by
                                        #19

                                        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.

                                        NeverDieN 1 Reply Last reply
                                        0
                                        • Nca78N Nca78

                                          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.

                                          NeverDieN Offline
                                          NeverDieN Offline
                                          NeverDie
                                          Hero Member
                                          wrote on last edited by NeverDie
                                          #20

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

                                          alexsh1A 1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          24

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular