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. Particle Powered Air Quality Sensor Logging to Google Docs

Particle Powered Air Quality Sensor Logging to Google Docs

Scheduled Pinned Locked Moved My Project
si7021air qualitypm2.5particlehpma115s0ccs811
69 Posts 6 Posters 6.4k 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.
  • FotoFieberF FotoFieber

    @jaredwolff
    Managed to compile Bosch arduino demo code on ESP32 on platformio after 3 hours. :sunglasses:

    But then....

    BSEC library version 1.4.7.3
    Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], Static IAQ, CO2 equivalent, breath VOC equivalent
    BSEC error code : -2
    

    Maybe I give up here, as I really don't like to use binary code in my sensors....

    J Offline
    J Offline
    jaredwolff
    wrote on last edited by
    #46

    @fotofieber integrating their static library is a PITA.

    What processor are you using exactly? That wold dictate which version of the BSEC you'd integrate.

    For Arduino, the library should handle the import of the .a file. If you're in any other environment you'll have to add a few lines:

    LIB_DEPS += $(USER_LIB_DIR)/libalgobsec.a
    LDFLAGS += -Wl,--whole-archive $(USER_LIB_DIR)/libalgobsec.a -Wl,--no-whole-archive
    

    I had to add these to the makefile in .particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/modules/xenon/user-part for the Particle stuff to work.

    FotoFieberF 1 Reply Last reply
    0
    • J jaredwolff

      @fotofieber integrating their static library is a PITA.

      What processor are you using exactly? That wold dictate which version of the BSEC you'd integrate.

      For Arduino, the library should handle the import of the .a file. If you're in any other environment you'll have to add a few lines:

      LIB_DEPS += $(USER_LIB_DIR)/libalgobsec.a
      LDFLAGS += -Wl,--whole-archive $(USER_LIB_DIR)/libalgobsec.a -Wl,--no-whole-archive
      

      I had to add these to the makefile in .particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/modules/xenon/user-part for the Particle stuff to work.

      FotoFieberF Offline
      FotoFieberF Offline
      FotoFieber
      Hardware Contributor
      wrote on last edited by
      #47

      @jaredwolff
      ESP32 is the platform I use.

      Linking is no problem (after trial and error of two hours :) ).

      I seem to have made a call to the lib:

      BSEC library version 1.4.7.3
      

      Now adding DEBUG-Messages to the BSEC arduino library.

      J 1 Reply Last reply
      0
      • FotoFieberF FotoFieber

        @jaredwolff
        ESP32 is the platform I use.

        Linking is no problem (after trial and error of two hours :) ).

        I seem to have made a call to the lib:

        BSEC library version 1.4.7.3
        

        Now adding DEBUG-Messages to the BSEC arduino library.

        J Offline
        J Offline
        jaredwolff
        wrote on last edited by
        #48

        @fotofieber said in Particle Powered Air Quality Sensor Logging to Google Docs:

        Linking is no problem (after trial and error of two hours ).

        Yea it took me a bit to figure that out too. :grimacing:

        Have you fired up the standard I2C library to see if you can talk to the BME680? Or maybe throw a logic analyzer on it to maker sure it's communicating? I'd imaging the compiler would barf if you used the wrong static library. Bosch does have an ESP32 specific one.

        Unfortunately, I don't have any way of testing that here. Keep me posted, I'm curious as to why it's not working.

        FotoFieberF 1 Reply Last reply
        0
        • J jaredwolff

          @fotofieber said in Particle Powered Air Quality Sensor Logging to Google Docs:

          Linking is no problem (after trial and error of two hours ).

          Yea it took me a bit to figure that out too. :grimacing:

          Have you fired up the standard I2C library to see if you can talk to the BME680? Or maybe throw a logic analyzer on it to maker sure it's communicating? I'd imaging the compiler would barf if you used the wrong static library. Bosch does have an ESP32 specific one.

          Unfortunately, I don't have any way of testing that here. Keep me posted, I'm curious as to why it's not working.

          FotoFieberF Offline
          FotoFieberF Offline
          FotoFieber
          Hardware Contributor
          wrote on last edited by
          #49

          @jaredwolff
          The data is read correctly:

          temp 1883
          hum 54739
          press 94317
          gas resistance 118267
          call bsec_do_steps(..
          return of bsec_do_steps -2
          

          And -2 means:

           BSEC_E_DOSTEPS_VALUELIMITS = -2,                /*!< Value of input (physical) sensor signal passed to bsec_do_steps() is not in the valid range */
          

          I wish I had the source code of the lib....

          J 1 Reply Last reply
          0
          • FotoFieberF FotoFieber

            @jaredwolff
            The data is read correctly:

            temp 1883
            hum 54739
            press 94317
            gas resistance 118267
            call bsec_do_steps(..
            return of bsec_do_steps -2
            

            And -2 means:

             BSEC_E_DOSTEPS_VALUELIMITS = -2,                /*!< Value of input (physical) sensor signal passed to bsec_do_steps() is not in the valid range */
            

            I wish I had the source code of the lib....

            J Offline
            J Offline
            jaredwolff
            wrote on last edited by jaredwolff
            #50

            @fotofieber the library does have an error I found earlier. Divide _data.temperature by 100.0f and _data.humidity by 1000.0f. This is in BSEC.cpp

            See below:

            /**
             * @brief Read data from the BME680 and process it
             */
            bool Bsec::readProcessData(int64_t currTimeNs, bsec_bme_settings_t bme680Settings)
            {
            	bme680Status = bme680_get_sensor_data(&_data, &_bme680);
            	if (bme680Status != BME680_OK) {
            		return false;
            	}
            
            	bsec_input_t inputs[BSEC_MAX_PHYSICAL_SENSOR]; // Temp, Pres, Hum & Gas
            	uint8_t nInputs = 0, nOutputs = 0;
            
            	if (_data.status & BME680_NEW_DATA_MSK) {
            		if (bme680Settings.process_data & BSEC_PROCESS_TEMPERATURE) {
            			inputs[nInputs].sensor_id = BSEC_INPUT_TEMPERATURE;
            			inputs[nInputs].signal = _data.temperature/100.0f; // Need to divide by 100 for fp
            			inputs[nInputs].time_stamp = currTimeNs;
            			nInputs++;
            			/* Temperature offset from the real temperature due to external heat sources */
            			inputs[nInputs].sensor_id = BSEC_INPUT_HEATSOURCE;
            			inputs[nInputs].signal = _tempOffset;
            			inputs[nInputs].time_stamp = currTimeNs;
            			nInputs++;
            		}
            		if (bme680Settings.process_data & BSEC_PROCESS_HUMIDITY) {
            			inputs[nInputs].sensor_id = BSEC_INPUT_HUMIDITY;
            			inputs[nInputs].signal = _data.humidity/1000.0f; // Need to divide by 1000 for fp;
            			inputs[nInputs].time_stamp = currTimeNs;
            			nInputs++;
            		}
            		if (bme680Settings.process_data & BSEC_PROCESS_PRESSURE) {
            			inputs[nInputs].sensor_id = BSEC_INPUT_PRESSURE;
            			inputs[nInputs].signal = _data.pressure;
            			inputs[nInputs].time_stamp = currTimeNs;
            			nInputs++;
            		}
            		if (bme680Settings.process_data & BSEC_PROCESS_GAS) {
            			inputs[nInputs].sensor_id = BSEC_INPUT_GASRESISTOR;
            			inputs[nInputs].signal = _data.gas_resistance;
            			inputs[nInputs].time_stamp = currTimeNs;
            			nInputs++;
            		}
            	}
            
            
            1 Reply Last reply
            0
            • FotoFieberF Offline
              FotoFieberF Offline
              FotoFieber
              Hardware Contributor
              wrote on last edited by
              #51

              @jaredwolff said in Particle Powered Air Quality Sensor Logging to Google Docs:

              ...
              inputs[nInputs].signal = _data.humidity/1000.0f; // Need to divide by 1000 for fp;
              ...

              WTF, they have a known bug in the library and we all have to discover it by ourselves?....

              How cool is that, you seem to have solved the problem I had.... :)

              BSEC library version 1.4.7.3
              Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], Static IAQ, CO2 equivalent, breath VOC equivalent
              End setup()
              279, 21.37, 94698.00, 57.66, 80982.00, 25.00, 0, 21.37, 57.66, 25.00, 500.00, 0.50
              3278, 21.21, 94700.00, 57.42, 111997.00, 25.00, 0, 21.15, 58.10, 25.00, 500.00, 0.50
              6278, 21.22, 94700.00, 57.25, 127972.00, 25.00, 0, 21.16, 57.80, 25.00, 500.00, 0.50
              9278, 21.22, 94702.00, 57.10, 135341.00, 25.00, 0, 21.16, 57.58, 25.00, 500.00, 0.50
              

              I hope I will have a graph in two days and I can compare the Bosch sensor to the NIDIR-Sensors...

              J 1 Reply Last reply
              0
              • FotoFieberF FotoFieber

                @jaredwolff said in Particle Powered Air Quality Sensor Logging to Google Docs:

                ...
                inputs[nInputs].signal = _data.humidity/1000.0f; // Need to divide by 1000 for fp;
                ...

                WTF, they have a known bug in the library and we all have to discover it by ourselves?....

                How cool is that, you seem to have solved the problem I had.... :)

                BSEC library version 1.4.7.3
                Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], Static IAQ, CO2 equivalent, breath VOC equivalent
                End setup()
                279, 21.37, 94698.00, 57.66, 80982.00, 25.00, 0, 21.37, 57.66, 25.00, 500.00, 0.50
                3278, 21.21, 94700.00, 57.42, 111997.00, 25.00, 0, 21.15, 58.10, 25.00, 500.00, 0.50
                6278, 21.22, 94700.00, 57.25, 127972.00, 25.00, 0, 21.16, 57.80, 25.00, 500.00, 0.50
                9278, 21.22, 94702.00, 57.10, 135341.00, 25.00, 0, 21.16, 57.58, 25.00, 500.00, 0.50
                

                I hope I will have a graph in two days and I can compare the Bosch sensor to the NIDIR-Sensors...

                J Offline
                J Offline
                jaredwolff
                wrote on last edited by
                #52

                @fotofieber I'm not sure they know.. haha I should tell them.

                Good luck and let me know how it goes!

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jaredwolff
                  wrote on last edited by jaredwolff
                  #53

                  They know about it. They keep their library up to date on Github:

                  Here's the diff:

                  https://github.com/BoschSensortec/BSEC-Arduino-library/commit/e9a10fe23739bb95650d2ab89ed37764a4ba3caf

                  Here's the library link:

                  https://github.com/BoschSensortec/BSEC-Arduino-library

                  You probably downloaded it from the website just like I did.

                  I'll have to update my repo and point it to this as a submodule.

                  FotoFieberF 1 Reply Last reply
                  1
                  • J jaredwolff

                    They know about it. They keep their library up to date on Github:

                    Here's the diff:

                    https://github.com/BoschSensortec/BSEC-Arduino-library/commit/e9a10fe23739bb95650d2ab89ed37764a4ba3caf

                    Here's the library link:

                    https://github.com/BoschSensortec/BSEC-Arduino-library

                    You probably downloaded it from the website just like I did.

                    I'll have to update my repo and point it to this as a submodule.

                    FotoFieberF Offline
                    FotoFieberF Offline
                    FotoFieber
                    Hardware Contributor
                    wrote on last edited by
                    #54

                    @jaredwolff
                    I downloaded the binaries from the Bosch site and the source library from the github repo.

                    In the binaries archive is an arduino library with an example with the error, you found.... The github repo has no binaries and I couldn't get it up with the binary.

                    The binary distribution of essential code makes it more complicated than it could be...

                    The integration in platformio is not to complicated in my code. I only had to add (after investigating for some hours)

                    build_flags =   -Llib/BSEC/src/esp32/
                                    -lalgobsec
                    
                    1 Reply Last reply
                    1
                    • J Offline
                      J Offline
                      jaredwolff
                      wrote on last edited by
                      #55

                      @FotoFieber how goes the testing?

                      The BME680 and the SGP30 both correlate in their readings with temperature. This means when the temperature goes up and down, i've seen the TVOC reading go up and down as well. Hardly useful for a sensor that is supposed to tell you if your air is bad or not.

                      Take a look at the screenshot below:

                      0_1560869706305_image.png

                      You can see that both sensors react wildly to temperature. Whereas the CCS811 has a bump but not significantly. If I go by the scales in the data sheets for the BME680 and SGP30, the room that these sensors are in require immediate venting.

                      Even right now, the SGP30 sensor is half way to the danger zone. 😵

                      Danger zone!

                      0_1560869685735_image.png

                      While testing that, I also threw everything together into an enclosure. Even added GPS:

                      0_1560869778746_image.png

                      So it sits up in the kitchen and chirps at me when I burn my food. I switch on my air purifier and the particulate level goes down pretty quick!

                      Nca78N FotoFieberF 2 Replies Last reply
                      2
                      • J jaredwolff

                        @FotoFieber how goes the testing?

                        The BME680 and the SGP30 both correlate in their readings with temperature. This means when the temperature goes up and down, i've seen the TVOC reading go up and down as well. Hardly useful for a sensor that is supposed to tell you if your air is bad or not.

                        Take a look at the screenshot below:

                        0_1560869706305_image.png

                        You can see that both sensors react wildly to temperature. Whereas the CCS811 has a bump but not significantly. If I go by the scales in the data sheets for the BME680 and SGP30, the room that these sensors are in require immediate venting.

                        Even right now, the SGP30 sensor is half way to the danger zone. 😵

                        Danger zone!

                        0_1560869685735_image.png

                        While testing that, I also threw everything together into an enclosure. Even added GPS:

                        0_1560869778746_image.png

                        So it sits up in the kitchen and chirps at me when I burn my food. I switch on my air purifier and the particulate level goes down pretty quick!

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

                        Thank you for the feedback @jaredwolff, that is very useful.
                        Do you confirm that you use the BSEC library for the BME680 and not direct values from the sensor ?

                        J 1 Reply Last reply
                        1
                        • Nca78N Nca78

                          Thank you for the feedback @jaredwolff, that is very useful.
                          Do you confirm that you use the BSEC library for the BME680 and not direct values from the sensor ?

                          J Offline
                          J Offline
                          jaredwolff
                          wrote on last edited by
                          #57

                          @nca78 I am using the BSEC library. I’m using the compensated humidity and temperature so I’m sure if that. I may have to take a second look at the code for both sensors. I may have mucked something up!

                          1 Reply Last reply
                          1
                          • J jaredwolff

                            @FotoFieber how goes the testing?

                            The BME680 and the SGP30 both correlate in their readings with temperature. This means when the temperature goes up and down, i've seen the TVOC reading go up and down as well. Hardly useful for a sensor that is supposed to tell you if your air is bad or not.

                            Take a look at the screenshot below:

                            0_1560869706305_image.png

                            You can see that both sensors react wildly to temperature. Whereas the CCS811 has a bump but not significantly. If I go by the scales in the data sheets for the BME680 and SGP30, the room that these sensors are in require immediate venting.

                            Even right now, the SGP30 sensor is half way to the danger zone. 😵

                            Danger zone!

                            0_1560869685735_image.png

                            While testing that, I also threw everything together into an enclosure. Even added GPS:

                            0_1560869778746_image.png

                            So it sits up in the kitchen and chirps at me when I burn my food. I switch on my air purifier and the particulate level goes down pretty quick!

                            FotoFieberF Offline
                            FotoFieberF Offline
                            FotoFieber
                            Hardware Contributor
                            wrote on last edited by
                            #58

                            @jaredwolff
                            My experiments with VOC sensors were all not satisfactory.

                            The NDIR-sensors reported more or less the same as the netatmo devices and I will therefore stick with them. Apart from that, using the NDIR-sensors in arduino is much easier and you don't have to store baselines or link precompiled code.

                            Nca78N 1 Reply Last reply
                            1
                            • FotoFieberF FotoFieber

                              @jaredwolff
                              My experiments with VOC sensors were all not satisfactory.

                              The NDIR-sensors reported more or less the same as the netatmo devices and I will therefore stick with them. Apart from that, using the NDIR-sensors in arduino is much easier and you don't have to store baselines or link precompiled code.

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

                              @fotofieber said in Particle Powered Air Quality Sensor Logging to Google Docs:

                              @jaredwolff
                              My experiments with VOC sensors were all not satisfactory.

                              The NDIR-sensors reported more or less the same as the netatmo devices and I will therefore stick with them. Apart from that, using the NDIR-sensors in arduino is much easier and you don't have to store baselines or link precompiled code.

                              Of course sensors measuring CO2 will give better results than sensors trying to guess the CO2 levels by measuring something else.
                              But the power consumption is way too high, my hope was to be able to have a battery (li-ion) powered sensor able to run the BME680 in low power settings for a few months and just use it as a warning on when you need to ventilate a room. Unfortunately it seems to not even be fit for this limited use case :(

                              J 1 Reply Last reply
                              1
                              • Nca78N Nca78

                                @fotofieber said in Particle Powered Air Quality Sensor Logging to Google Docs:

                                @jaredwolff
                                My experiments with VOC sensors were all not satisfactory.

                                The NDIR-sensors reported more or less the same as the netatmo devices and I will therefore stick with them. Apart from that, using the NDIR-sensors in arduino is much easier and you don't have to store baselines or link precompiled code.

                                Of course sensors measuring CO2 will give better results than sensors trying to guess the CO2 levels by measuring something else.
                                But the power consumption is way too high, my hope was to be able to have a battery (li-ion) powered sensor able to run the BME680 in low power settings for a few months and just use it as a warning on when you need to ventilate a room. Unfortunately it seems to not even be fit for this limited use case :(

                                J Offline
                                J Offline
                                jaredwolff
                                wrote on last edited by
                                #60

                                @nca78 I mean, you can run it on a battery. Just need a really big one! 😬

                                Because of the internal heater it does make it hard to integrate into a battery powered application.

                                I haven’t measured the low power mode on the BME. What were you getting @Nca78

                                Nca78N 1 Reply Last reply
                                0
                                • J jaredwolff

                                  @nca78 I mean, you can run it on a battery. Just need a really big one! 😬

                                  Because of the internal heater it does make it hard to integrate into a battery powered application.

                                  I haven’t measured the low power mode on the BME. What were you getting @Nca78

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

                                  @jaredwolff said in Particle Powered Air Quality Sensor Logging to Google Docs:

                                  I haven’t measured the low power mode on the BME. What were you getting @Nca78

                                  With 5mn interval it's supposed to use only 90uA, it's good enough for a li-ion battery of a reasonable size.

                                  J 1 Reply Last reply
                                  0
                                  • Nca78N Nca78

                                    @jaredwolff said in Particle Powered Air Quality Sensor Logging to Google Docs:

                                    I haven’t measured the low power mode on the BME. What were you getting @Nca78

                                    With 5mn interval it's supposed to use only 90uA, it's good enough for a li-ion battery of a reasonable size.

                                    J Offline
                                    J Offline
                                    jaredwolff
                                    wrote on last edited by
                                    #62

                                    @nca78 agreed. It totally depends on the application. On a 225mA button cell that may not work especially if it has to last a year or two!

                                    1 Reply Last reply
                                    0
                                    • SebexS Offline
                                      SebexS Offline
                                      Sebex
                                      wrote on last edited by
                                      #63

                                      So @jaredwolff & @FotoFieber what sensor would you suggest to use for measuring air quality using an Arduino (nano/uno), with the option to make it battery powered in the future. From my understanding this will remove the BME from the list due to memory/computing requirements. What are your suggestions?

                                      1 Reply Last reply
                                      0
                                      • J Offline
                                        J Offline
                                        jaredwolff
                                        wrote on last edited by
                                        #64

                                        Hey @Sebex

                                        After running my setup for more than 8 months here are a few suggestions:

                                        1. If you care about particulates then the PM2.5 sensor works wonders. I've been using the HPMA115S0. It uses UART which you should be able to use with any Arduino variant.
                                        2. If you're more concerned with chemicals, a MOx sensor like the CCS811 is still my choice.

                                        The CCS811 is available as development boards from Adafruit and Sparkfun. The HPMA115S0 can be purchased from Arrow, Mouser and Digikey.

                                        I actually developed an all-in-one for Featherwing board. You can check that out for inspiration as well.

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

                                          Regarding the bme680, has anyone yet figured out the correct amount of pre-heating that should be applied to it, or is that still unknown? See https://forum.mysensors.org/topic/7788/bosch-bme680-sensor/15?_=1578489395821 .

                                          J 1 Reply Last reply
                                          0
                                          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