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.
  • korttomaK korttoma

    I tried to analyze what is on the small ciscuitboar for my MQ-2 sensor an here is what I think it contains:
    upload-7d5906ec-43dc-4e10-a66f-65c84d5026cc

    So adding the 10K between AOUT and GND is pointless. So what now? Can I use it as is and just use the 1K value for RL in the sketch or is it recommended to change the 1K to something else (10K)??

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

    @korttoma You've been lucky finding such a schema, but it is strange there is a resistance on the other side of the sensor, and the variable one is not where expected... maybe the 1K is wrong on the schema, can you mesure it on the board?

    5.1 Ohm is low...

    The RL here is for the voltage comparator that gives the digital output with led.

    MQ-2 datasheet asks for Rs in 3KΩ-30KΩ
    If this is right, then the value that the autocalibration "in clean air" should give you something around 1K.

    The MQ-9 datasheet is a bit more versatile:
    Power of Sensitivity body(Ps): Ps=Vc^2×Rs/(Rs+RL)^2
    Resistance of sensor(Rs): Rs=(Vc/VRL-1)×RL

    MQ-9: Rs(in air)/Rs(100ppm CO)≥5

    I fear they are using a standard board for all sensors and that the resistance value may be wrong from this, just because they want to deliver a digital signal...

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

    korttomaK 1 Reply Last reply
    0
    • epierreE epierre

      @korttoma You've been lucky finding such a schema, but it is strange there is a resistance on the other side of the sensor, and the variable one is not where expected... maybe the 1K is wrong on the schema, can you mesure it on the board?

      5.1 Ohm is low...

      The RL here is for the voltage comparator that gives the digital output with led.

      MQ-2 datasheet asks for Rs in 3KΩ-30KΩ
      If this is right, then the value that the autocalibration "in clean air" should give you something around 1K.

      The MQ-9 datasheet is a bit more versatile:
      Power of Sensitivity body(Ps): Ps=Vc^2×Rs/(Rs+RL)^2
      Resistance of sensor(Rs): Rs=(Vc/VRL-1)×RL

      MQ-9: Rs(in air)/Rs(100ppm CO)≥5

      I fear they are using a standard board for all sensors and that the resistance value may be wrong from this, just because they want to deliver a digital signal...

      korttomaK Offline
      korttomaK Offline
      korttoma
      Hero Member
      wrote on last edited by
      #68

      @epierre

      I did not find the schema, I measured the board and figured it out myself so it might be wrong.

      Could you draw a schema that would show me exactly how it would preferably look so I can change it? Because I'm clearly not smart enough to understand it from your descriptions. Please explain it to me like I was 4 years old ;)

      • Tomas
      1 Reply Last reply
      0
      • korttomaK Offline
        korttomaK Offline
        korttoma
        Hero Member
        wrote on last edited by
        #69

        Now changed my sensor according to this (disconnected the OP related to DOUT) :
        upload-94e081f9-006e-4d91-b736-3f82ef8e119b

        Please confirm that this is how it is preferred to be connected.

        • Tomas
        epierreE 2 Replies Last reply
        0
        • korttomaK korttoma

          Now changed my sensor according to this (disconnected the OP related to DOUT) :
          upload-94e081f9-006e-4d91-b736-3f82ef8e119b

          Please confirm that this is how it is preferred to be connected.

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

          Hello,

          I guess here you have the same that the datasheet, so I assume it is ok ;-)

          I've been working to port sketches to a Spark Core with good results, the 12 bits ADC gives more precise values, at least the MQ135 is now very sensitive.

          I am also correcting errors in the sketches I have produced.

          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 epierre
            #71

            Hello,

            A good article on the comparison of 3 same MQ-7 sensors

            A lot of good questions, not easy to answer! It is good you tryed it with three sensors instead of just one, and you can see there is a lot of variation from one sensor to the next of the same batch.
            [...]
            As to the value of Ro, that is the million dollar question. You have to have a known calibration source of CO in order to determine that! Each MQ-7 sensor will be different. The normal levels in a lab or home will be (should be!) well below the level that this sensor can detect and discriminate. It's lower limit implied in the data sheet is around 50ppm, which is where it begins to be dangerous for continuous exposure. Do read wiki and other sources about carbon monoxide and levels that can occur under different conditions.
            

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

            1 Reply Last reply
            0
            • korttomaK Offline
              korttomaK Offline
              korttoma
              Hero Member
              wrote on last edited by
              #72

              During the weekend I did the hardware changes and tried my MQ-2 sensor again and now if I hit it with smoke (I have smoke on a can) I do get values in Vera under the Variable1 property. No values on the dashboard device itself. I guess some changes are needed for the device file to display the V_VAR1 or we should use something else than V_VAR1.

              If you have already updated the sketch for the MQ-2 please let me know where I can get the latest version so I can try it out.

              btw, is the MQ-2 supposed to give the value 0 after it is calibrated in clean air? My sensor sends the value 0 all the time unless I hit it with my smoke can.

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

                @korttoma said:

                If you have already updated the sketch for the MQ-2 please let me know where I can get the latest version so I can try it out.

                btw, is the MQ-2 supposed to give the value 0 after it is calibrated in clean air? My sensor sends the value 0 all the time unless I hit it with my smoke can.

                Yes I am deeply modifying it, and will have a question for @hek : to have something consistant in time, it owuld be better to have the initial calibration stored, either in EEPROM or as a VAR on the server. Could it be possible that I introduce a loop that wait till the var is answered and if not go into calibration ?

                @korttoma the best sketch so far is the following, to be scaled down to one sensor, remove specific Mega initialization. I will make a simpler one based on this soon, as I have already done it for the Spark core.
                https://github.com/empierre/arduino/blob/master/MQv01dgi_1_4.ino

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

                hekH 1 Reply Last reply
                0
                • epierreE epierre

                  @korttoma said:

                  If you have already updated the sketch for the MQ-2 please let me know where I can get the latest version so I can try it out.

                  btw, is the MQ-2 supposed to give the value 0 after it is calibrated in clean air? My sensor sends the value 0 all the time unless I hit it with my smoke can.

                  Yes I am deeply modifying it, and will have a question for @hek : to have something consistant in time, it owuld be better to have the initial calibration stored, either in EEPROM or as a VAR on the server. Could it be possible that I introduce a loop that wait till the var is answered and if not go into calibration ?

                  @korttoma the best sketch so far is the following, to be scaled down to one sensor, remove specific Mega initialization. I will make a simpler one based on this soon, as I have already done it for the Spark core.
                  https://github.com/empierre/arduino/blob/master/MQv01dgi_1_4.ino

                  hekH Offline
                  hekH Offline
                  hek
                  Admin
                  wrote on last edited by
                  #74

                  @epierre

                  The best solution (and most simple) is to keep calibration data in EEPROM.

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

                    Now some questions I have currently:

                    I've used your clean air calibration in open air given values of air concentration where appropriate. Around sept 20th I applied this method t omy sketches and I have since sensors that are very much more reactive ! Only 2SH12 has no curve, it is voltage for this (damn) sensor doesn't have a datasheet...

                    I don't know if this was this predictible...

                    They are all placed inside a room that I sometime open to clean air. Also there are restarts that calculates again those values where you see it drop maybe, but anyway it will still go to the previous values.

                    MQ135 in CO2:
                    MQ135-CO2.png
                    MQ2 in Smoke:
                    MQ2-Smoke.png
                    2SH12 in SO2 in voltage:
                    2SH12-SO2.png
                    MQ6 in O3:
                    MQ6-O3.png

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

                    1 Reply Last reply
                    0
                    • korttomaK korttoma

                      Now changed my sensor according to this (disconnected the OP related to DOUT) :
                      upload-94e081f9-006e-4d91-b736-3f82ef8e119b

                      Please confirm that this is how it is preferred to be connected.

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

                      @korttoma I have found a sketch that may interrest you about the gas sensors boards:

                      http://www.parallax.com/sites/default/files/downloads/27983-Gas-Sensor-Board-A-Schematic.pdf

                      Their document speaks also about calibrating some gases:
                      http://www.parallax.com/sites/default/files/downloads/27983-Gas-Sensor-Board-Guide-v1.0.pdf

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

                      1 Reply Last reply
                      0
                      • epierreE epierre

                        @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 Offline
                        epierreE Offline
                        epierre
                        Hero Member
                        wrote on last edited by
                        #77

                        @Yveaux I have doubts about calculing the resistance, for it is depending on the steps, either 1024 or 4096, and/or the voltage either 5V or 3.3V.

                        I started with this formulae:

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

                        But saw Davide Gironi using this one:

                        return  (long)((long)(1024*(long)RL_VALUE)/raw_adc-(long)RL_VALUE);
                        

                        RL_VALUE=22000

                        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
                          #78

                          @Yveaux @korttoma
                          Bummer... this is the same formula when doing the reduction.... one is 1023 the other 1024 the only change.

                          The RL_VALUE for Davide was 22k, when I mesure the resistance with Analog out with ground, I get 0,996 or 0,999 ohms depending on the sensor. I guess this is the RL_VALUE of the board which is way below the sensor maker recommendation (between 10K and 47K for a MQ135).

                          Also, I saw that the pot on the board does not change the analog to ground resistance, meaning it is used only for comparison of the digital output....

                          Am I correct in mesuring this ?

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

                          YveauxY 1 Reply Last reply
                          0
                          • epierreE epierre

                            @Yveaux @korttoma
                            Bummer... this is the same formula when doing the reduction.... one is 1023 the other 1024 the only change.

                            The RL_VALUE for Davide was 22k, when I mesure the resistance with Analog out with ground, I get 0,996 or 0,999 ohms depending on the sensor. I guess this is the RL_VALUE of the board which is way below the sensor maker recommendation (between 10K and 47K for a MQ135).

                            Also, I saw that the pot on the board does not change the analog to ground resistance, meaning it is used only for comparison of the digital output....

                            Am I correct in mesuring this ?

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

                            @epierre said:

                            Also, I saw that the pot on the board does not change the analog to ground resistance, meaning it is used only for comparison of the digital output....

                            That seems to match the schematic above where the pot connects to + of the lm393

                            http://yveaux.blogspot.nl

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

                              @Yveaux Doing so, I have used a RL_VALUE for each board I mesured, one went to 5MOhms...

                              MQ2:-8.85
                              MQ6:0.00
                              MQ131:0.00
                              TGS2600:0.00
                              MQ135:0.00
                              2SH12:-155004.00
                              TGZS2602:0.00
                              

                              Something to be noted: same boards have the same resistance, whatever the sensor maker recommendation, this is a pity...

                              The output I have:

                              MQ2    :LPG   :7ppm    CO    :0ppm    SMOKE :10ppm
                              MQ6    :LPG   :0ppm    CH4   :0ppm
                              MQ131  :CL2   :0ppm    O3    :0ppm
                              TGS2600:H2    :0ppm    C2H5OH:0ppm C4H10 :0ppm
                              MQ135  :CO2   :0ppm    CO    :0ppm     CH3   :0ppm    NH4    :0ppm
                              2SH12  :SO2   :-154588.20 raw 
                              TGS2602:C7H8  :0ppm
                              Dust   :raw   : 0    Voltage: 0.00 - Dust Density: -0.10
                              

                              something to remember: MQ135 was calibrated for 1ppm of CO, not 399ppm of CO2, so the calculated value is very low, a per gas Ro must be calculated (clean air calibration) if several gas on one sensor is required to be displayed.

                              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
                                #81

                                Some interresting points from another discussion on the MQ138 that is given for HCHO.

                                Historically a datasheet said so, but it is impossible to read the datasheet curves:
                                http://china-total.com/Product/meter/gas-sensor/MQ138.pdf

                                The latest ones do not speak of HCHO any more.

                                An available alternative: grove is a wsp2110 and datasheet can be found.
                                http://www.seeedstudio.com/wiki/Grove_-_HCHO_Sensor

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

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  alex
                                  wrote on last edited by
                                  #82

                                  Hello all,

                                  I'm new here, thanks to this topic very interesting for my personal project: a mobile air quality sensor.
                                  (sorry for my english, i'm french)

                                  Fistly, congrat's @epierre and the other, for having shared all this informations!
                                  (it's a litte funny because we had the same idea in the almost same time)
                                  So after having read the entire subject, here my questions (the number in front is the number post):

                                  _
                                  17 - @epierre, I haven't well understand How you can distinguish individual gas from a sensor who react with several gas.

                                  45 - The "Wunder Weather" list that you talked about, it's a website?

                                  55 - What David did you answer to you about "if he speaks of the organic sensor or the ceramic ones"?
                                  Moreover, what are the organic sensors? Have you example?

                                  72- On winsensor.com, an chinese gas sensor producer, the MQ-7 is more powerfull... I don't know who trust, maybe it's not the same?? See the PDF datasheet here.

                                  81 - Where did you read that the lastest one don't speak of HCHO anymore?
                                  After some research, I founded two, one who speak about HCHO here in english , and the other who don't....but I'm not sure (beacause in chinese) here.

                                  Otherwise, for the WSP2110 datasheet, it is here! But chinese too =/

                                  Regards,
                                  Alex.

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

                                    Hello,

                                    This is a short post, half has been lost in a forum crash, I hope the best remains ;-)

                                    17 - @epierre, I haven't well understand How you can distinguish individual gas from a sensor who react with several gas.
                                    

                                    You cannot as I showed below with the broken perfume bottle, you can guess there is one, but not which one.

                                    45 - The "Wunder Weather" list that you talked about, it's a website?
                                    

                                    This is wunderground.com

                                    55 - What David did you answer to you about "if he speaks of the organic sensor or the ceramic ones"?
                                    Moreover, what are the organic sensors? Have you example?
                                    

                                    The organic are the one that have a lifetime of 2 years, calibrated but wery expensive (aroung $150+ apiece), the winseng one for example, big and round.

                                    72- On winsensor.com, an chinese gas sensor producer, the MQ-7 is more powerfull... I don't know who trust, maybe it's not the same?? See the PDF datasheet here.
                                    

                                    this is hard to say... the MQ-7 is quite special with a sequence to power it up, and readings every period.

                                    81 - Where did you read that the lastest one don't speak of HCHO anymore?
                                    After some research, I found two, one who speak about HCHO here in english , and the other who don't....but I'm not sure (beacause in chinese) here.
                                    

                                    I don't see mention of HCHO (formaldehyde) in the english one (n-Hexane, Benzene, NH3, alcohol, ,smoke, CO. I found one in chinese with the link above but the curve couldn't be exploited. Please remark that Alcohool has not a single formula, but here they show only one curve, not very precise.

                                    Otherwise, for the WSP2110 datasheet, it is here! But chinese too =/
                                    

                                    Yes for this one something can be done, but there is no for WSP1110 there is no...

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

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      alex
                                      wrote on last edited by alex
                                      #84

                                      Ok! Thanks.

                                      And what about the ceramic sensors (like MQ serie). How long can we trust them?

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

                                        @alex said:

                                        Ok! Thanks.
                                        And what about the ceramic sensors (like MQ serie). How long can we trust them?

                                        a bit longer but they vary in time as Davide made the remark, so calibration is not one time in its life...

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

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          alex
                                          wrote on last edited by alex
                                          #86

                                          Hello

                                          @epierre : after received the PPD42NS, compared to the DSM501A, which one is the best do you think?

                                          Other things, I planned to purchase soon the sensors that I need for my air station.
                                          You made a list on the #1 post, and it's very useful thanks, but now I have to choose between them for each gas targeted (maybe some sensors are still missing on the list below)

                                          Which one appears for you, the better for each gas, with a reasonable price?

                                          O3		    MQ131   MICS-2610    Mics-2614
                                          NO2 	      MiCS-2710    MiCS-2714
                                          NO            ? 
                                          PM10 PM2.5    PPD42NS    SamYoung DSM501
                                          Benzene	   MQ135			
                                          CO  	      MQ307A   MQ309A   AQ-7   MiCS-5525   TGS2442
                                          So2 	      MQ136
                                          COV       	MQ135  TGS2602
                                          CO2 	      MQ135
                                          
                                          epierreE 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          9

                                          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