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 epierre

    @alexsh1 is that raw ADC output or with a calculation ? normaly this should go up or down but not in sucha drastic way

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

    @epierre

    This is a value gw.send(msg.set(MQ135_DEFAULTPPM+(int)ceil(valAIQ))) reported to Domoticz.
    It does not make any sense to me at all.

    epierreE 1 Reply Last reply
    0
    • epierreE epierre

      @tantt2810 said:

      @epierre
      Thank you. Your mean is Vcc->5V, GND->GND, Dout->Digital pin, Aout->Analog pin. Is it right?
      But I don't know the tcm pin connect with ? I have read datasheet but I don't find any info about tcm pin. Please help me. Thank you so much !!!

      do not use the digital pin !!! it only reacts with the potentiometer in on/off mode, so useless... you need to power the device with Vcc/Gnd, and read the output with Aout (A stands for analog). The last one forget it.

      tantt2810T Offline
      tantt2810T Offline
      tantt2810
      wrote on last edited by
      #170

      @epierre
      Thanks you so much !!! Good job, Good boy =)).

      1 Reply Last reply
      0
      • alexsh1A alexsh1

        @epierre

        This is a value gw.send(msg.set(MQ135_DEFAULTPPM+(int)ceil(valAIQ))) reported to Domoticz.
        It does not make any sense to me at all.

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

        @alexsh1 said:

        @epierre

        This is a value gw.send(msg.set(MQ135_DEFAULTPPM+(int)ceil(valAIQ))) reported to Domoticz.
        It does not make any sense to me at all.

        same for mle, sometime it is good to have two piece to compare their behavior... I have 3 o them ...

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

        1 Reply Last reply
        0
        • alexsh1A Offline
          alexsh1A Offline
          alexsh1
          wrote on last edited by
          #172

          @epierre do you think it is a faulty sensor though?

          epierreE 1 Reply Last reply
          0
          • tantt2810T Offline
            tantt2810T Offline
            tantt2810
            wrote on last edited by tantt2810
            #173

            Hello,

            Can I use pinMode(digitalpin, OUTPUT) to turn off sensor? Or Is there any way to wirte a function that turn off sensor?

            I want to remote it on web to turn on or off it.

            Thank you so much !!!

            epierreE 1 Reply Last reply
            0
            • supersjimmieS Offline
              supersjimmieS Offline
              supersjimmie
              wrote on last edited by
              #174

              For those who are trying to use an MQ135 module from e-bay or other sellers, on a small pcb with a chip, LED and potmeter:
              It took me a while until I figured out that the little chip has a very big influence on the value that you read on the A-out pin.
              Only after removing the connection between the A-out pin and the little chip, I got normal measurements.

              I also replaced the small resistor marked "102" with a 10k resistor, to make measurements more compatible with code that uses a 10k pull down resistor. But that was already a known issue, found on many other places.

              1 Reply Last reply
              1
              • tantt2810T tantt2810

                Hello,

                Can I use pinMode(digitalpin, OUTPUT) to turn off sensor? Or Is there any way to wirte a function that turn off sensor?

                I want to remote it on web to turn on or off it.

                Thank you so much !!!

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

                @tantt2810 said:

                Hello,

                Can I use pinMode(digitalpin, OUTPUT) to turn off sensor? Or Is there any way to wirte a function that turn off sensor?

                I want to remote it on web to turn on or off it.

                Thank you so much !!!

                well no, powering is through Vcc/GND, so you whould use a switch on this. Digital pins do not gives enough power for such sensors.

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

                1 Reply Last reply
                0
                • alexsh1A alexsh1

                  @epierre do you think it is a faulty sensor though?

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

                  @alexsh1 said:

                  @epierre do you think it is a faulty sensor though?

                  coud be, hard to know without possibility to compare to another one.

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

                  1 Reply Last reply
                  0
                  • alexsh1A Offline
                    alexsh1A Offline
                    alexsh1
                    wrote on last edited by
                    #177

                    @epierre

                    This is what I discovered. When nobody is around the sensor 'settles' on a particular value. However, when there is anyone around in the room, the sensor reading goes up and down - see the snapshot attached. Any idea what the problem may be?

                    0_1459957501388_Untitled.jpg

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

                      @alexsh1 hard to say, could be something moving inside if someone makes vibration around and thus this strange reaction... the down curve at the end is correct, the in between not

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

                      1 Reply Last reply
                      0
                      • E Offline
                        E Offline
                        Elfnoir
                        wrote on last edited by
                        #179

                        Hi,
                        Can you check the reception level?
                        I had same behaviour with an old temperature/humidity module; need to move it to another place in the room, and works perfectly now :-)

                        epierreE 1 Reply Last reply
                        0
                        • E Elfnoir

                          Hi,
                          Can you check the reception level?
                          I had same behaviour with an old temperature/humidity module; need to move it to another place in the room, and works perfectly now :-)

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

                          @Elfnoir said:

                          ; need to move it to another place in the room, and works perfectly now

                          temp/hum are "less" sensitive on environment, here the sensors heats up to 40-60° (or more) so temp/hum is not the most impacting (I can be wrong anyway ;-)

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

                          1 Reply Last reply
                          0
                          • alexsh1A Offline
                            alexsh1A Offline
                            alexsh1
                            wrote on last edited by
                            #181

                            @epierre I wonder if you looked at this sensor Figaro TGS8100:

                            http://www.figarosensor.com/products/entry/tgs8100.html

                            Looks like it is perfect for a low-powered platform.

                            epierreE R 2 Replies Last reply
                            0
                            • alexsh1A alexsh1

                              @epierre I wonder if you looked at this sensor Figaro TGS8100:

                              http://www.figarosensor.com/products/entry/tgs8100.html

                              Looks like it is perfect for a low-powered platform.

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

                              @alexsh1 said:

                              @epierre I wonder if you looked at this sensor Figaro TGS8100:

                              http://www.figarosensor.com/products/entry/tgs8100.html

                              Looks like it is perfect for a low-powered platform.

                              as a replacement for MQ in low power yes could be... the bad part is how to get one ?

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

                              alexsh1A 1 Reply Last reply
                              0
                              • epierreE epierre

                                @alexsh1 said:

                                @epierre I wonder if you looked at this sensor Figaro TGS8100:

                                http://www.figarosensor.com/products/entry/tgs8100.html

                                Looks like it is perfect for a low-powered platform.

                                as a replacement for MQ in low power yes could be... the bad part is how to get one ?

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

                                @epierre said:
                                the bad part is how to get one ?

                                How about http://www.soselectronic.com/?str=371&artnum=170939&name=figaro-tgs8100 ?

                                1 Reply Last reply
                                0
                                • epierreE epierre

                                  I'm now testing the MICS-6814 (3 sensors in one) given for :
                                  Carbon monoxide CO 1 -1000ppm
                                  **Nitrogen dioxide NO2 0.05 –10ppm **
                                  Ethanol C2H5OH 10 –500ppm
                                  Hydrogen H2 1 –1000ppm
                                  Ammonia NH3 1 –500ppm
                                  Methane CH4 >1000ppm
                                  Propane C3H8 >1000ppm
                                  Iso-butane C4H10 >1000ppm

                                  Datasheet maionly speaks on CO, NO2 and NH3:
                                  http://www.seeedstudio.com/wiki/images/1/10/MiCS-6814_Datasheet.pdf

                                  Here is are scripts:
                                  http://www.seeedstudio.com/wiki/Grove_-_Multichannel_Gas_Sensor

                                  http://www.seeedstudio.com/wiki/images/1/10/MiCS-6814_Datasheet.pdf

                                  Some readings:

                                  The concentration of NH3 is 0.99 ppm
                                  The concentration of CO is 1.20 ppm
                                  The concentration of NO2 is 0.15 ppm
                                  The concentration of C3H8 is 1000.04 ppm
                                  The concentration of C4H10 is 999.98 ppm
                                  The concentration of CH4 is 2991.14 ppm
                                  The concentration of H2 is 1.09 ppm
                                  The concentration of C2H5OH is 1.40 ppm
                                  

                                  I guess I'll make a script soon...

                                  VirV Offline
                                  VirV Offline
                                  Vir
                                  wrote on last edited by
                                  #184

                                  Hi, It all make sense, I am just confused that in your code once your multiply and once you divide...

                                  case CO:
                                  {
                                  if(ratio1 < 0.01) ratio1 = 0.01;
                                  if(ratio1 > 3) ratio1 = 3;
                                  //c = pow(10, 0.6) / pow(ratio1, 1.2);
                                  ** c = pow(ratio1, -1.179)4.385; //mod by jack*
                                  break;
                                  }
                                  case NO2:
                                  {
                                  if(ratio2 < 0.07) ratio2 = 0.07;
                                  if(ratio2 > 40) ratio2 = 40;
                                  //c = ratio2 / pow(10, 0.8);
                                  ** c = pow(ratio2, 1.007)/6.855; //mod by jack**
                                  break;
                                  }
                                  SO, what is the actual formula?

                                  Vir

                                  @epierre said:

                                  I'm now testing the MICS-6814 (3 sensors in one) given for :
                                  Carbon monoxide CO 1 -1000ppm
                                  **Nitrogen dioxide NO2 0.05 –10ppm **
                                  Ethanol C2H5OH 10 –500ppm
                                  Hydrogen H2 1 –1000ppm
                                  Ammonia NH3 1 –500ppm
                                  Methane CH4 >1000ppm
                                  Propane C3H8 >1000ppm
                                  Iso-butane C4H10 >1000ppm

                                  Datasheet maionly speaks on CO, NO2 and NH3:
                                  http://www.seeedstudio.com/wiki/images/1/10/MiCS-6814_Datasheet.pdf

                                  Here is are scripts:
                                  http://www.seeedstudio.com/wiki/Grove_-_Multichannel_Gas_Sensor

                                  http://www.seeedstudio.com/wiki/images/1/10/MiCS-6814_Datasheet.pdf

                                  Some readings:

                                  The concentration of NH3 is 0.99 ppm
                                  The concentration of CO is 1.20 ppm
                                  The concentration of NO2 is 0.15 ppm
                                  The concentration of C3H8 is 1000.04 ppm
                                  The concentration of C4H10 is 999.98 ppm
                                  The concentration of CH4 is 2991.14 ppm
                                  The concentration of H2 is 1.09 ppm
                                  The concentration of C2H5OH is 1.40 ppm
                                  

                                  I guess I'll make a script soon...

                                  1 Reply Last reply
                                  0
                                  • epierreE epierre

                                    @tantt2810 said:

                                    Hello,
                                    I'm don't understand the recipe below. Why RL_Value(Load Resistance)(1023-raw_adc)/raw_adc)? Can you explain for me?
                                    Thank you so much !!!
                                    Input: raw_adc - raw value read from adc, which represents the voltage
                                    Output: the calculated sensor resistance
                                    Remarks: The sensor and the load resistor forms a voltage divider. Given the voltage
                                    across the load resistor and its resistance, the resistance of the sensor
                                    could be derived.
                                    float MQ2::MQResistanceCalculation(int raw_adc)
                                    RL_VALUE
                                    (1023-raw_adc)/raw_adc));

                                    in fact it is above described, you have a voltage, you want a resistance.
                                    https://learn.sparkfun.com/tutorials/voltage-dividers

                                    datasheet needs a value which is the Rs/Ro (called here RL) where
                                    Ro: sensor resistance at 100ppm of NH3 in the clean air.
                                    Rs:sensor resistance at various concentrations of gases

                                    here the formula is a simplification of this:

                                    float Vrl = val * ( 5.00 / 1024.0 ); // V
                                    float Rs = 20000 * ( 5.00 - Vrl) / Vrl ; // Ohm
                                    int ratio = Rs/Ro;
                                    ppm = 37143 * pow (ratio, -3.178);

                                    VirV Offline
                                    VirV Offline
                                    Vir
                                    wrote on last edited by
                                    #185

                                    What does 37143 represents, Rs? and -3.178 is a second value from your regression method, but what about the first value?
                                    Can you elaborate on ppm line, please
                                    Vir

                                    here the formula is a simplification of this:

                                    float Vrl = val * ( 5.00 / 1024.0 ); // V
                                    float Rs = 20000 * ( 5.00 - Vrl) / Vrl ; // Ohm
                                    int ratio = Rs/Ro;
                                    ppm = 37143 * pow (ratio, -3.178);

                                    VirV 1 Reply Last reply
                                    0
                                    • B bhavika

                                      I am confused with MiCS 4514 sensor. What I had done is :

                                      using MiCS quick start evaluation board, measured ADC value
                                      calculated Vout and from that calculated R0.
                                      Rs/R0 concentration gives me high value, which is not possible, My data is as follows
                                      clean air file is used for the purpose of R0 value
                                      https://drive.google.com/file/d/0B8sF8a6FHoseWjhWOHRoYzIxakk/view?usp=sharing
                                      and Polluted file is used to calculate the actual pollution
                                      https://drive.google.com/file/d/0B8sF8a6FHoseR1BnclhCUHdibEU/view?usp=sharing

                                      I am confused. Please help me

                                      VirV Offline
                                      VirV Offline
                                      Vir
                                      wrote on last edited by
                                      #186

                                      @bhavika said:

                                      I am confused with MiCS 4514 sensor. What I had done is :

                                      using MiCS quick start evaluation board, measured ADC value
                                      calculated Vout and from that calculated R0.
                                      Rs/R0 concentration gives me high value, which is not possible, My data is as follows
                                      clean air file is used for the purpose of R0 value
                                      https://drive.google.com/file/d/0B8sF8a6FHoseWjhWOHRoYzIxakk/view?usp=sharing
                                      and Polluted file is used to calculate the actual pollution
                                      https://drive.google.com/file/d/0B8sF8a6FHoseR1BnclhCUHdibEU/view?usp=sharing

                                      I am confused. Please help me

                                      I am confused by the formula you are using, could you please explain?
                                      Pollution NO2 = (POWER((RS/R0)*(1/POWER(10,0.8068)),(1/1.01)))

                                      Pollution CO = POWER((RS/R0)*(1/POWER(10 , 0.5476)),(1/-0.8497)))

                                      is the actual formula like this?:

                                      pollution = POWER((ratio *(1/POWER(10, curve[0])),(1/[curve[1])))

                                      This is different than any other formulas discussed in this thread...
                                      Vir

                                      1 Reply Last reply
                                      0
                                      • VirV Vir

                                        What does 37143 represents, Rs? and -3.178 is a second value from your regression method, but what about the first value?
                                        Can you elaborate on ppm line, please
                                        Vir

                                        here the formula is a simplification of this:

                                        float Vrl = val * ( 5.00 / 1024.0 ); // V
                                        float Rs = 20000 * ( 5.00 - Vrl) / Vrl ; // Ohm
                                        int ratio = Rs/Ro;
                                        ppm = 37143 * pow (ratio, -3.178);

                                        VirV Offline
                                        VirV Offline
                                        Vir
                                        wrote on last edited by
                                        #187

                                        so does 37164 represents the scaling factor and -3.178 the exponent?
                                        Vir
                                        @Vir said:

                                        What does 37143 represents, Rs? and -3.178 is a second value from your regression method, but what about the first value?
                                        Can you elaborate on ppm line, please
                                        Vir

                                        here the formula is a simplification of this:

                                        float Vrl = val * ( 5.00 / 1024.0 ); // V
                                        float Rs = 20000 * ( 5.00 - Vrl) / Vrl ; // Ohm
                                        int ratio = Rs/Ro;
                                        ppm = 37143 * pow (ratio, -3.178);

                                        1 Reply Last reply
                                        0
                                        • alexsh1A Offline
                                          alexsh1A Offline
                                          alexsh1
                                          wrote on last edited by alexsh1
                                          #188

                                          @epierre I have the problem with the dust sketch (shinyei ppd42ns). The following code does not work in MySensors 1.5

                                          ...
                                          gw.send(msgPM10.set("ppm"));
                                            ...
                                          gw.send(msgPM25.set("ppm")); 
                                          ...
                                          
                                          2016-04-24 14:44:19.438 Error: MySensors: Unknown/Invalid sensor type (43)
                                          2016-04-24 14:44:19.438 Error: MySensors: Unknown/Invalid sensor type (43)
                                          

                                          So far both PM10 and PM25 are showing zero. However, if I upload the following code, it works fine (one channel though):

                                          // Watch video here: https://www.youtube.com/watch?v=a8r4CeQopfY
                                          
                                          /* 
                                           Connection:
                                           
                                           JST Pin 1 (Black Wire)  => Arduino GND
                                           JST Pin 3 (Red wire)    => Arduino 5VDC
                                           JST Pin 4 (Yellow wire) => Arduino Digital Pin 8
                                          
                                           Green Led connected to Arduino D7
                                           Yellow Led connected to Arduino D6
                                           Red Led connected to Arduino D5
                                           
                                           
                                          Dust Sensor possible application:
                                          - Applications of customer
                                          - Air quality sensor
                                          - Dustlessness workshop
                                          - Cigarette detector
                                          */
                                          
                                          /*
                                          Sensor is to create Digital (Lo Pulse) output to Particulate Matters (PM). Lo Pulse Occupancy time (LPO time) is in proportion
                                          to PM concentration. The output is for PM whose size is around 1 micro meter or larger. We can use the sensor to detect the dust in clean room.
                                          Minimum detect particle: 1um
                                          http://www.seeedstudio.com/wiki/Grove_-_Dust_Sensor
                                           Grove - Dust Sensor Demo v1.0
                                           Interface to Shinyei Model PPD42NS Particle Sensor
                                           Program by Christopher Nafis 
                                           Written April 2012
                                           
                                           http://www.seeedstudio.com/depot/grove-dust-sensor-p-1050.html
                                           http://www.sca-shinyei.com/pdf/PPD42NS.pdf
                                           */
                                          
                                          int pin = 8;
                                          unsigned long duration;
                                          unsigned long starttime;
                                          unsigned long sampletime_ms = 1000;//sampe 1s ;
                                          unsigned long lowpulseoccupancy = 0;
                                          float ratio = 0;
                                          float concentration = 0;
                                          int gLed = 7;
                                          int yLed = 6;
                                          int rLed = 5;
                                          
                                          void setup() {
                                            Serial.begin(9600);
                                            pinMode(8,INPUT);
                                            pinMode(gLed,OUTPUT);
                                            pinMode(yLed,OUTPUT);
                                            pinMode(rLed,OUTPUT);
                                            starttime = millis();//get the current time;
                                          }
                                          
                                          void loop() {
                                            duration = pulseIn(pin, LOW);
                                            lowpulseoccupancy = lowpulseoccupancy+duration;
                                          
                                            if ((millis()-starttime) > sampletime_ms)//if the sampel time == 30s
                                            {
                                              ratio = lowpulseoccupancy/(sampletime_ms*10.0);  // Integer percentage 0=>100
                                              concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; // using spec sheet curve
                                              Serial.print("concentration = ");
                                              Serial.print(concentration);
                                              Serial.print(" pcs/0.01cf  -  ");
                                              if (concentration < 1.0) {
                                               Serial.println("It's a smokeless and dustless environment"); 
                                               digitalWrite(gLed, HIGH);
                                               digitalWrite(yLed, LOW);
                                               digitalWrite(rLed, LOW);
                                            }
                                              if (concentration > 1.0 && concentration < 20000) {
                                               Serial.println("It's probably only you blowing air to the sensor :)"); 
                                               digitalWrite(gLed, HIGH);
                                               digitalWrite(yLed, LOW);
                                               digitalWrite(rLed, LOW);
                                              }
                                              
                                              if (concentration > 20000 && concentration < 315000) {
                                               Serial.println("Smokes from matches detected!"); 
                                               digitalWrite(gLed, LOW);
                                               digitalWrite(yLed, HIGH);
                                               digitalWrite(rLed, LOW);
                                              }
                                                if (concentration > 315000) {
                                               Serial.println("Smokes from cigarettes detected! Or It might be a huge fire! Beware!"); 
                                               digitalWrite(gLed, LOW);
                                               digitalWrite(yLed, LOW);
                                               digitalWrite(rLed, HIGH);
                                            }
                                              
                                              lowpulseoccupancy = 0;
                                              starttime = millis();
                                            }
                                          }
                                          
                                          
                                          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