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.
  • epierreE Offline
    epierreE Offline
    epierre
    Hero Member
    wrote on last edited by epierre
    #9

    So tonight with these new formulae, I updated my mega sketch to get :

     MQ2    :LPG   :0ppm    CO    :0ppm    SMOKE :0ppm
     MQ6    :LPG   :0ppm    CH4   :0ppm
     MQ131  :CL2   :1ppm    O3    :1ppm
     TGS2600:H2    :0ppm    C2H5OH:0ppm    C4H10 :0ppm
    

    Going through the "clean air calibation" I have:

    float MQResistanceCalculation(int raw_adc)    {
      return ( ((float)RL_VALUE*(1023-raw_adc)/raw_adc));
    }
    

    Here are the readings without:

    MQ2:5.28
    MQ6:36.94
    MQ131:3.61
    TGS2600:0.04
    

    and with all is 0... BTW...

    What do you think of that ? nothing indicated that MQ6 should be so big, and tgs so low... same for MQ131 that should be 100k-200k per datasheet....

    YveauxY jenbakerJ 2 Replies Last reply
    0
    • epierreE epierre

      So tonight with these new formulae, I updated my mega sketch to get :

       MQ2    :LPG   :0ppm    CO    :0ppm    SMOKE :0ppm
       MQ6    :LPG   :0ppm    CH4   :0ppm
       MQ131  :CL2   :1ppm    O3    :1ppm
       TGS2600:H2    :0ppm    C2H5OH:0ppm    C4H10 :0ppm
      

      Going through the "clean air calibation" I have:

      float MQResistanceCalculation(int raw_adc)    {
        return ( ((float)RL_VALUE*(1023-raw_adc)/raw_adc));
      }
      

      Here are the readings without:

      MQ2:5.28
      MQ6:36.94
      MQ131:3.61
      TGS2600:0.04
      

      and with all is 0... BTW...

      What do you think of that ? nothing indicated that MQ6 should be so big, and tgs so low... same for MQ131 that should be 100k-200k per datasheet....

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #10

      @epierre are you totally sure of the calculation in MQResistanceCalculation? Maybe the evaluation is correct, but I always add some braces to make the evaluation order explicit: first do the substraction, then the float multiplication and the integer division, cast to float, as last.

      http://yveaux.blogspot.nl

      epierreE 1 Reply Last reply
      0
      • YveauxY Yveaux

        @epierre are you totally sure of the calculation in MQResistanceCalculation? Maybe the evaluation is correct, but I always add some braces to make the evaluation order explicit: first do the substraction, then the float multiplication and the integer division, cast to float, as last.

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

        @Yveaux you mean something like this ?

        return ( (((float)RL_VALUE*(1023.0 - (float) raw_adc)) / (float) raw_adc));
        

        I somehow forked the discussion on arduino.cc and sent an email in parallel do Davide Gironi for I would like to understand his formula as opposed to the curve approach.

        epierreE 1 Reply Last reply
        0
        • epierreE Offline
          epierreE Offline
          epierre
          Hero Member
          wrote on last edited by epierre
          #12
          This post is deleted!
          YveauxY 1 Reply Last reply
          0
          • epierreE epierre

            This post is deleted!

            YveauxY Offline
            YveauxY Offline
            Yveaux
            Mod
            wrote on last edited by
            #13

            @epierre something like that, yes. You could also feed it some artificial values in a debug build and see if the calculated values match your expectations.
            It wouldn't be the first time that some calculations (divisions) are unexpectedly calculated as ints and always return either 0 or 1 instead of the expected fraction...

            http://yveaux.blogspot.nl

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

              Hello,

              Having sorted out how to make a power regression, I now have the sames values as Davide Gironi.

              I applied this to MQ2, MQ6, MQ131, MQ135 and TGS2600 with resistance calibration at start.

              MQ2    :LPG   :12ppm    CO    :0ppm    SMOKE :21ppm
              MQ6    :LPG   :3ppm    CH4   :39ppm
              MQ131  :CL2   :2ppm    O3    :3ppm
              TGS2600:H2    :5191ppm    C2H5OH:8825ppm    C4H10 :16954ppm
              MQ135  :CO2    :0ppm    CO    :0ppm    CH3    :0ppm    NH4    :0ppm
              GP2Y1010AU0F Raw Signal Value (0-1023): 19 - Voltage: 0.09 - Dust Density: -84.23
              

              the MQ135 is still doing its first heating period, do not care about its values.

              Clearly the TGS shows abnormal values, I'm quite puzzled by this, using the previous method it was always 0...

              YveauxY 1 Reply Last reply
              0
              • epierreE epierre

                Hello,

                Having sorted out how to make a power regression, I now have the sames values as Davide Gironi.

                I applied this to MQ2, MQ6, MQ131, MQ135 and TGS2600 with resistance calibration at start.

                MQ2    :LPG   :12ppm    CO    :0ppm    SMOKE :21ppm
                MQ6    :LPG   :3ppm    CH4   :39ppm
                MQ131  :CL2   :2ppm    O3    :3ppm
                TGS2600:H2    :5191ppm    C2H5OH:8825ppm    C4H10 :16954ppm
                MQ135  :CO2    :0ppm    CO    :0ppm    CH3    :0ppm    NH4    :0ppm
                GP2Y1010AU0F Raw Signal Value (0-1023): 19 - Voltage: 0.09 - Dust Density: -84.23
                

                the MQ135 is still doing its first heating period, do not care about its values.

                Clearly the TGS shows abnormal values, I'm quite puzzled by this, using the previous method it was always 0...

                YveauxY Offline
                YveauxY Offline
                Yveaux
                Mod
                wrote on last edited by Yveaux
                #15

                @epierre I'm still a bit wondered by the way in which you present the values.
                I, for instance, have an MQ135. Is "sensitive to noxious gas concentration. MQ135 sensor also sensitive to sulfide, benzene steam, smoke, etc". The logarithmic charts in the datasheet show the sensitivity to the various gases.
                This sensor has a single analog output from which IMHO you cannot determine the fraction of individual gases. Yet you present them as individual values in your measurement data... How can you distinguish?

                http://yveaux.blogspot.nl

                epierreE 1 Reply Last reply
                0
                • YveauxY Yveaux

                  @epierre I'm still a bit wondered by the way in which you present the values.
                  I, for instance, have an MQ135. Is "sensitive to noxious gas concentration. MQ135 sensor also sensitive to sulfide, benzene steam, smoke, etc". The logarithmic charts in the datasheet show the sensitivity to the various gases.
                  This sensor has a single analog output from which IMHO you cannot determine the fraction of individual gases. Yet you present them as individual values in your measurement data... How can you distinguish?

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

                  @Yveaux in fact it is a correlation, if you have a value from the analog, then from the curve you can guess it is one of the group, not one individually... it is the way they are designed...

                  YveauxY 1 Reply Last reply
                  0
                  • epierreE epierre

                    @Yveaux in fact it is a correlation, if you have a value from the analog, then from the curve you can guess it is one of the group, not one individually... it is the way they are designed...

                    YveauxY Offline
                    YveauxY Offline
                    Yveaux
                    Mod
                    wrote on last edited by
                    #17

                    @epierre That's exactly my point!

                    http://yveaux.blogspot.nl

                    epierreE 1 Reply Last reply
                    0
                    • YveauxY Yveaux

                      @epierre That's exactly my point!

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

                      @Yveaux and there's worse : if you don't have the environment to calibrate it with real gas, it is just an indication... that is maybe why some projects that may have taken such sensor may hae a production process issue at the moment... In fact despite my researches, I've never found someone that said it made it to mesure correctly with gas sensors, mostly theory or just analog reading only...

                      An example: my MQ135 was silencious, I put its nose in the Aceton bottle:

                      Before:
                      Q2 :LPG :11ppm CO :0ppm SMOKE :18ppm
                      MQ6 :LPG :3ppm CH4 :36ppm
                      MQ131 :CL2 :2ppm O3 :3ppm
                      TGS2600:H2 :7602ppm C2H5OH:13706ppm C4H10 :26350ppm
                      MQ135 :CO2 :0ppm CO :0ppm CH3 :0ppm NH4 :0ppm
                      Dust :raw : 18 Voltage: 0.09 - Dust Density: -85.06

                      After:
                      MQ2 :LPG :208ppm CO :0ppm SMOKE :832ppm
                      MQ6 :LPG :44ppm CH4 :172ppm
                      MQ131 :CL2 :16ppm O3 :17ppm
                      TGS2600:H2 :7774ppm C2H5OH:13818ppm C4H10 :27274ppm
                      MQ135 :CO2 :999ppm CO :0ppm CH3 :484ppm NH4 :1904ppm
                      Dust :raw : 58 Voltage: 0.28 - Dust Density: -51.86

                      The MQ135 has reacted, but all others around...

                      epierreE 1 Reply Last reply
                      0
                      • epierreE epierre

                        @Yveaux and there's worse : if you don't have the environment to calibrate it with real gas, it is just an indication... that is maybe why some projects that may have taken such sensor may hae a production process issue at the moment... In fact despite my researches, I've never found someone that said it made it to mesure correctly with gas sensors, mostly theory or just analog reading only...

                        An example: my MQ135 was silencious, I put its nose in the Aceton bottle:

                        Before:
                        Q2 :LPG :11ppm CO :0ppm SMOKE :18ppm
                        MQ6 :LPG :3ppm CH4 :36ppm
                        MQ131 :CL2 :2ppm O3 :3ppm
                        TGS2600:H2 :7602ppm C2H5OH:13706ppm C4H10 :26350ppm
                        MQ135 :CO2 :0ppm CO :0ppm CH3 :0ppm NH4 :0ppm
                        Dust :raw : 18 Voltage: 0.09 - Dust Density: -85.06

                        After:
                        MQ2 :LPG :208ppm CO :0ppm SMOKE :832ppm
                        MQ6 :LPG :44ppm CH4 :172ppm
                        MQ131 :CL2 :16ppm O3 :17ppm
                        TGS2600:H2 :7774ppm C2H5OH:13818ppm C4H10 :27274ppm
                        MQ135 :CO2 :999ppm CO :0ppm CH3 :484ppm NH4 :1904ppm
                        Dust :raw : 58 Voltage: 0.28 - Dust Density: -51.86

                        The MQ135 has reacted, but all others around...

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

                        doing the same on my basic sketch here what I have:

                        2014-08-03 11:29:57 3 0 1 24 -28393
                        

                        looks like my old sketch needs some update...

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

                          Doing the same on the basic sketch :

                           Vrl / Rs / ratio:4.21 3731.17 0
                           CO ppm :inf
                          

                          Then:

                          Vrl / Rs / ratio:4.21 3731.17 0
                          CO ppm :inf
                          
                          1 Reply Last reply
                          0
                          • epierreE Offline
                            epierreE Offline
                            epierre
                            Hero Member
                            wrote on last edited by
                            #21

                            and now ethanol/isopropylène (bike chain cleaning product):

                            MQ2    :LPG   :247ppm   CO    :0ppm    SMOKE :1053ppm
                            MQ6    :LPG   :3527ppm    CH4   :2160ppm
                            MQ131  :CL2   :10ppm    O3    :12ppm
                            TGS2600:H2    :7891ppm C2H5OH:14279ppm C4H10 :27751ppm
                            MQ135  :CO2   :0ppm    CO    :0ppm     CH3   :0ppm    NH4    :0ppm
                            Dust   :raw   : 206    Voltage: 1.01 - Dust Density: 71.00
                            
                            1 Reply Last reply
                            0
                            • epierreE Offline
                              epierreE Offline
                              epierre
                              Hero Member
                              wrote on last edited by
                              #22

                              and now eveyone through aceton:

                              MQ2    :LPG   :25ppm   CO    :0ppm    SMOKE :48ppm
                              MQ6    :LPG   :19677ppm    CH4   :3010ppm
                              MQ131  :CL2   :71ppm    O3    :51ppm
                              TGS2600:H2    :8448ppm C2H5OH:15007ppm C4H10 :28738ppm
                              MQ135  :CO2   :840ppm    CO    :0ppm     CH3   :400ppm    NH4    :1474ppm
                              Dust   :raw   : 728    Voltage: 3.55 - Dust Density: 504.30
                              

                              remark that dust sensor goes up ! and TGS2600 goes down afterward:

                              MQ2    :LPG   :8ppm   CO    :0ppm    SMOKE :11ppm
                              MQ6    :LPG   :1264ppm    CH4   :1194ppm
                              MQ131  :CL2   :27ppm    O3    :24ppm
                              TGS2600:H2    :4966ppm C2H5OH:8407ppm C4H10 :16227ppm
                              MQ135  :CO2   :840ppm    CO    :0ppm     CH3   :400ppm    NH4    :1474ppm
                              Dust   :raw   : 165    Voltage: 0.81 - Dust Density: 36.96
                              
                              1 Reply Last reply
                              0
                              • epierreE Offline
                                epierreE Offline
                                epierre
                                Hero Member
                                wrote on last edited by epierre
                                #23

                                @hek I now have the netatmo CO2 xml and json, they are based on the generic sensor.

                                But I don't have mysensors running on my vera...

                                I would need from you:

                                • the device and variable type
                                • an icon, but maybe I can reuse the other one

                                maybe
                                CO2 = {22, "urn:schemas-micasaverde-com:device:CO2Sensor:1", "D_CO2Sensor.xml", "CO2 "}
                                CO2 = {36, "urn:micasaverde-com:serviceId:CO2Sensor", "Concentration", "396" },

                                S_CO2Sensor.json D_CO2Sensor.xml D_CO2Sensor.json

                                P.S. there's the icon from Nest plugin too: http://cocu.la/vera/nest/nest_co.png

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

                                  About initial calibration, just a warning from this graph:

                                  chart.png

                                  you can see high levels around july 21 then dropping in august... the sensor has been restarted... that is what the call clean air...

                                  this automatic reading at the start should be stored in the sketch and not reclaculated at each reboot or you would loose all reference on your data...

                                  1 Reply Last reply
                                  0
                                  • epierreE Offline
                                    epierreE Offline
                                    epierre
                                    Hero Member
                                    wrote on last edited by
                                    #25
                                    This post is deleted!
                                    1 Reply Last reply
                                    0
                                    • epierreE Offline
                                      epierreE Offline
                                      epierre
                                      Hero Member
                                      wrote on last edited by
                                      #26
                                      This post is deleted!
                                      YveauxY 1 Reply Last reply
                                      1
                                      • epierreE epierre

                                        This post is deleted!

                                        YveauxY Offline
                                        YveauxY Offline
                                        Yveaux
                                        Mod
                                        wrote on last edited by
                                        #27

                                        @epierre did you just post the same reply 3 times or is the forum software showing yet another bug?

                                        http://yveaux.blogspot.nl

                                        epierreE 1 Reply Last reply
                                        0
                                        • YveauxY Yveaux

                                          @epierre did you just post the same reply 3 times or is the forum software showing yet another bug?

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

                                          @Yveaux don't know, I did post once...

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


                                          15

                                          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