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. Hardware
  3. Air Quality Sensor

Air Quality Sensor

Scheduled Pinned Locked Moved Hardware
calibrationaqigas sensorhchoair quality
270 Posts 46 Posters 308.8k Views 35 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
    #107

    Adjusting my mq-135 sensor took several atempts as the CO2 value of the atmosphere is not a constant value of 399ppm.
    This value is measured in Hawaii ( see http://co2now.org/ ) and is probably significantly lower than at your home. In germany for example you should calibrate your sensor when the wind comes from west over the atlantic which brings fresh air along. See http://www.donnerwetter.de/deutschland/co2.htm

    Everytime my sensor passed values below 400 I adjusted the R0 value. In the end I modified the sketch to be able to send this R0 value from FHEM to the sensor to avoid recompiling the sketch everytime.
    See
    https://github.com/windkh/mysensors/tree/master/CO2Sensor/CO2sensor.ino Line 440ff

    image.png

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

      The sensor is in my kitchen. The value in the screenshot is very high as I made some french fries 2 hours ago.
      image.png

      1 Reply Last reply
      1
      • epierreE Offline
        epierreE Offline
        epierre
        Hero Member
        wrote on last edited by epierre
        #109

        @Heinz so bad I don't have a MQ135 running anymore to compare, here are the MH-Z14 curves I have near my desk.

        chart(6).png

        z-wave - Vera -> Domoticz
        rfx - Domoticz <- MyDomoAtHome <- Imperihome
        mysensors -> mysensors-gw -> Domoticz

        1 Reply Last reply
        0
        • B bhavika

          IN MiCS 2614 , sensitivity factor is defined by "Rs at 100 ppb of O3 divided by Rs at 50 ppb of O3". From where you measured Rs at 100 ppb or 50 ppb.???

          epierreE Offline
          epierreE Offline
          epierre
          Hero Member
          wrote on last edited by
          #110

          @bhavika said:

          IN MiCS 2614 , sensitivity factor is defined by "Rs at 100 ppb of O3 divided by Rs at 50 ppb of O3". From where you measured Rs at 100 ppb or 50 ppb.???

          this is just to tell you how much a double concentration scales up, here they just say it is somehow linear at ratio 2

          z-wave - Vera -> Domoticz
          rfx - Domoticz <- MyDomoAtHome <- Imperihome
          mysensors -> mysensors-gw -> Domoticz

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rasenheizung
            wrote on last edited by
            #111

            @Heinz very nice work :+1: (wie heisst du im FHEM Forum?)

            Does someone have the values a MQ-07 needs to perform properly? I rally don't know how to gather the right values from the description.... :)

            Thank you

            1 Reply Last reply
            0
            • epierreE Offline
              epierreE Offline
              epierre
              Hero Member
              wrote on last edited by epierre
              #112

              @Rasenheizung if you base yourself on my template here https://github.com/empierre/arduino/blob/master/AirQuality-Multiple_Gas_Sensor1_4.ino

              H2
              1.3 50
              0.8 100
              0.28 400
              0.16 1000
              0.05 4000

              y = 73.59123879 x-1.355617483
              Residual Sum of Squares: rss = 87393.44418
              H2Curve[3] = {73.5912, -1.355617};

              CO
              1.6 50
              1 100
              0.39 400
              0.21 1000
              0.09 4000

              y = 99.27731641 x-1.513643469
              Residual Sum of Squares: rss = 43168.87424
              COCurve[3] = {99.27731, -1.51364};

              CO is a dangerous gas, the MQ7 is very sensitive to many things and no calibration too... for a serious work please think about using the MICS-6814 that is calibrated, includes 3 gases out of the box, and is very low consumption (can run on battery !)
              https://github.com/empierre/arduino/blob/master/AirQuality-CO-NO2-NH3.ino

              z-wave - Vera -> Domoticz
              rfx - Domoticz <- MyDomoAtHome <- Imperihome
              mysensors -> mysensors-gw -> Domoticz

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bhavika
                wrote on last edited by
                #113

                What is the pre-heating time for TGS2442???

                epierreE 1 Reply Last reply
                0
                • B bhavika

                  What is the pre-heating time for TGS2442???

                  epierreE Offline
                  epierreE Offline
                  epierre
                  Hero Member
                  wrote on last edited by epierre
                  #114

                  @bhavika said:

                  What is the pre-heating time for TGS2442???

                  from datasheet: "the sensor’s resistance reaches to 90% of its final value in less than one minute"

                  z-wave - Vera -> Domoticz
                  rfx - Domoticz <- MyDomoAtHome <- Imperihome
                  mysensors -> mysensors-gw -> Domoticz

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bhavika
                    wrote on last edited by
                    #115

                    So what is the conditioning period for testing in it??? It is two days.. What does it mean??

                    epierreE 1 Reply Last reply
                    0
                    • B bhavika

                      So what is the conditioning period for testing in it??? It is two days.. What does it mean??

                      epierreE Offline
                      epierreE Offline
                      epierre
                      Hero Member
                      wrote on last edited by epierre
                      #116

                      @bhavika said:

                      So what is the conditioning period for testing in it??? It is two days.. What does it mean??

                      on this kind maybe to have it powered for a full two days to burn out the production "dusts" that may remain in.

                      those sensors are not good science, see the correlation of gases they are reported for in the datasheet

                      z-wave - Vera -> Domoticz
                      rfx - Domoticz <- MyDomoAtHome <- Imperihome
                      mysensors -> mysensors-gw -> Domoticz

                      1 Reply Last reply
                      0
                      • epierreE Offline
                        epierreE Offline
                        epierre
                        Hero Member
                        wrote on last edited by
                        #117

                        Hello,

                        a very sensitive HCHO module you can see a demo here: http://www.seeedstudio.com/recipe/379-a-handheld-hcho-detector.html?utm_source=EDM&utm_medium=EDM&utm_campaign=EDM20150930

                        https://github.com/empierre/arduino/blob/master/AirQuality-HCHO.ino

                        z-wave - Vera -> Domoticz
                        rfx - Domoticz <- MyDomoAtHome <- Imperihome
                        mysensors -> mysensors-gw -> Domoticz

                        1 Reply Last reply
                        0
                        • paqorP Offline
                          paqorP Offline
                          paqor
                          wrote on last edited by
                          #118

                          I have a question for the MQ135. Do not always be above 500 ppm, the measured values? I also get values of 0. I suspect that it is due to the conversion. The values vary greatly. Is that normal? I get the values with an ordinary power supply. mq135 werte.PNG

                          1 Reply Last reply
                          0
                          • paqorP Offline
                            paqorP Offline
                            paqor
                            wrote on last edited by paqor
                            #119
                            This post is deleted!
                            1 Reply Last reply
                            0
                            • HeinzH Offline
                              HeinzH Offline
                              Heinz
                              Hero Member
                              wrote on last edited by
                              #120

                              Looks strange, could you supply your code?
                              Btw the sensor draws a lot of current, the power supply should be able to deliver 1A. Did you burn in the sensor for 12-24 hours?

                              1 Reply Last reply
                              0
                              • paqorP Offline
                                paqorP Offline
                                paqor
                                wrote on last edited by
                                #121

                                I have used the code from epiere. Baking I have not done. I use different power supplies (USB, Samsung and a large controllable power supply). I sometimes feel that contacts do not function properly. But the sensor draws but only about 100 mA = 0.1 A? Then it seems to be on branding. I have three new sensors. Mostly we read that it is only an attempt here is to measure the CO2 content. When I check the values with a measuring instrument with which agree the details here https://olimex.wordpress.com/2015/05/26/experimenting-with-gas-sensors-and-arduino/ Branding should work outdoors? Can you show me a chart or values?

                                1 Reply Last reply
                                0
                                • paqorP Offline
                                  paqorP Offline
                                  paqor
                                  wrote on last edited by
                                  #122
                                  This post is deleted!
                                  1 Reply Last reply
                                  0
                                  • HeinzH Offline
                                    HeinzH Offline
                                    Heinz
                                    Hero Member
                                    wrote on last edited by
                                    #123

                                    I used this library:
                                    https://github.com/GeorgK/MQ135

                                    Together with this description:
                                    https://hackaday.io/project/3475-sniffing-trinket/log/12363-mq135-arduino-library

                                    Simple to use and very good explanations.

                                    1 Reply Last reply
                                    0
                                    • paqorP Offline
                                      paqorP Offline
                                      paqor
                                      wrote on last edited by
                                      #124

                                      I've read about. It sounds interesting.

                                      I stand a little hard with the development. Is there a skit for MQ135.h and MYSENSORS?

                                      I will test this afternoon.

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

                                        Hi @paqor,
                                        I wrote a little sketch which you could use as a start, it uses the MQ135 library.
                                        I also used a timer library, but this could be replaced by a simple sleep, too.

                                        RZERO should be changed when calibrating the sensor, this can be done at compile-time or during runtime by sending the value to the sensor via the gateway.

                                        Unfortunately I could not test the sketch yet, but it should help you getting started.
                                        If you have a second sensor which provides humidity and temperature then you can also get the corrected ppm from the library,...

                                        good luck!

                                        /*
                                        MQ135 MySensor
                                        A0      white
                                        D0      black
                                        GND     brown
                                        5V      red
                                        */
                                        
                                        #include <SPI.h>
                                        #include <MySensor.h>
                                        #include <MQ135.h>
                                        #include "Timer.h"
                                        
                                        Timer timer;
                                        
                                        // 30 seconds
                                        #define TEMP_UPDATE_INTERVAL 30000
                                        
                                        // MQ135
                                        #define CHILD_ID_CO2 0
                                        #define CHILD_ID_R0 1
                                        
                                        #define CO2_SENSOR_ANALOG_PIN 0
                                        
                                        /// Calibration resistance at atmospheric CO2 level
                                        #define RZERO 300.0
                                        #define EEPROM_R0 0
                                        
                                        MQ135 gasSensor = MQ135(CO2_SENSOR_ANALOG_PIN, RZERO);
                                        int lastC02;
                                        float lastR0;
                                        
                                        //-----------------------------------------------------------------------------
                                        // MySensor
                                        MySensor gw;
                                        MyMessage msgCO2(CHILD_ID_CO2, V_VAR1);
                                        MyMessage msgR0(CHILD_ID_R0, V_VAR1);
                                        
                                        //-----------------------------------------------------------------------------
                                        void setup()
                                        {
                                            gw.begin(incomingMessage, AUTO, true);
                                            gw.sendSketchInfo("MQ135 Sensor", "1.0");
                                            gw.present(CHILD_ID_CO2, S_AIR_QUALITY);
                                            gw.present(CHILD_ID_R0, S_CUSTOM);
                                            
                                            uint8_t R02 = gw.loadState(EEPROM_R0);
                                        
                                            // get R0 from EEPROM
                                            float R0 = R02 * 2;
                                        
                                        	// do a plausibility check
                                            if (R0 > 1.0 && R0 < 400.0) 
                                            {
                                                Serial.print(F("Setting R0 from EEPROM: "));
                                            }
                                            else
                                            {
                                                Serial.print(F("Setting default R0: "));
                                                R0 = RZERO;
                                            }
                                        
                                            Serial.print(R0);
                                            Serial.println(F(""));
                                        
                                            gasSensor.setR0(R0);
                                            
                                            timer.every(TEMP_UPDATE_INTERVAL, timerHandler);
                                        }
                                        
                                        
                                        bool MQ135Changed()
                                        {
                                            bool changed = false;
                                        
                                            lastR0 = gasSensor.getRZero();
                                            Serial.print(F("R0: "));
                                            Serial.println(lastR0);
                                        
                                            {
                                                float ppm = gasSensor.getPPM();
                                        
                                                Serial.print(F("CO2 ppm: "));
                                                Serial.print(ppm);
                                        
                                        
                                                int roundedPpm = (int)ppm;
                                                Serial.print(F(" --> "));
                                                Serial.println(roundedPpm);
                                        
                                                if (roundedPpm != lastC02)
                                                {
                                                    lastC02 = roundedPpm;
                                                    changed = true;
                                                }
                                            }
                                        
                                            return changed;
                                        }
                                        
                                        
                                        void timerHandler()
                                        {
                                            bool airQualityChanged = MQ135Changed();
                                            if (airQualityChanged)
                                            {
                                                gw.send(msgCO2.set(lastC02));
                                                gw.send(msgR0.set(lastR0, 2));
                                            }
                                        }
                                        
                                        
                                        void loop()
                                        {
                                            gw.process();
                                            timer.update();
                                        }
                                        
                                        
                                        // Gets the R0 value from the gw passes ot to the lib and stores it into the EEPROM.
                                        void incomingMessage(const MyMessage& message)
                                        {
                                            Serial.println(F("Incoming Message:"));
                                        
                                            if (message.isAck())
                                            {
                                                Serial.println(F("This is an ack from gateway"));
                                            }
                                        
                                            uint8_t sensor = message.sensor;
                                            if (sensor == CHILD_ID_R0)
                                            {
                                                float R0 = message.getFloat();
                                        
                                                Serial.print(F("Incoming R0: "));
                                                Serial.print(R0);
                                                Serial.println(F(""));
                                        
                                                gw.saveState(EEPROM_R0, (uint8_t)(R0/2));
                                                gasSensor.setR0(R0);
                                                gw.send(msgR0.set(R0, 2));
                                            }
                                        }
                                        
                                        
                                        1 Reply Last reply
                                        0
                                        • paqorP Offline
                                          paqorP Offline
                                          paqor
                                          wrote on last edited by paqor
                                          #126

                                          I have compiled from various sources themselves something. The result is https://gleisnetze.de/2015/12/25/das-erste-kleine-programm/ described herein. The most plausible values I received with the MQ135.h library. For that I have then added the transfer after MySensors / FHEM.

                                          Bildschirmfoto vom 2015-12-25 07-53-25.png

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


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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