Shop OBEX P1 Docs P2 Docs Learn Events
27929 mg811 — Parallax Forums

27929 mg811

35°C0lDFuSion35°C0lDFuSion Posts: 5
edited 2013-08-12 15:36 in Accessories
Why is it so hard to have clear information on the 27929 board.

I want to be able to determine what ppm of co2 is present in the air.
I have search all over the internet and found nothing that can help me.

I want to hook up the board to a arduino board and be able to determine how many ppm of co2 is present.

From what I have see in my research, is that I am not alone who want this information.

Use this thread to finally give all the information that is needed for this device.

I can not understand why parallax does not give any sample code or a .h to help them sale the device.

I have found many post of succes using this board but no code to help me learn and use this board.

If you are able to help please do. I will, upon completion give my code and if I can make a 27929.h to help

future buyer and developper of the 27929 board.

Comments

  • 35°C0lDFuSion35°C0lDFuSion Posts: 5
    edited 2012-04-12 19:55
    From what I have found.
    If you want to be able to get the ppm value of co2 is that
    you have to get a reading from tp1.

    well to get this reading do you need a common ground with you power supply.

    I have a 6 volt power supply connected to the VIN and groung but do I
    need to also connect the ground to the arduino.

    how do I get info from the tp1 from the arduino.

    need code exemple.
  • FranklinFranklin Posts: 4,747
    edited 2012-04-12 21:04
  • 35°C0lDFuSion35°C0lDFuSion Posts: 5
    edited 2012-04-13 19:25
    I finally figure it out using piece of code and bits of info from every thing I have found

    I plugge the 27929 board using a 6v power supply to GND, VIN and CNTL.
    I also plugge the GND from the arduino to the GND of the 27929.
    The TP1 of the 27929 is plugge to the arduino analog port.

    I use this code and it give me the ppm
    /* Carbon dioxide calibration
         y = MLogn(x) + C
         x = e^((y-C)/M)
    
         where y is bit value and x is c02 concentration
     C02        Bit Value
    400    279.98
    
    10000    -0.03
      =-87*(LN(N25))+800
     */
    
    #define Carbon_M -83.45 // was-87
    #define Carbon_C 768.62 //was 800
    
    
    char PIN = A0;
    int CarbonVal = 0;
    
    void setup() {
      Serial.begin(9600);
      pinMode(PIN,INPUT);  
    }
    
    void loop() {
        int carbon_temp = analogRead(PIN);
      
        float c_float = carbon_temp - Carbon_C;
        c_float = c_float/Carbon_M;    
        CarbonVal  = pow(2.718,c_float);
        Serial.print(CarbonVal);
        Serial.println(" ppm");
        delay(1000);
    }
    

    Look like it's working good but a little pain to calibrate.
    this is how anthony_p1234 did it
    The way I went about this was to look at the current value of C02 ppm in the world today (yes it is going up!), it's around 400ppm.
    Assuming that it is a bit higher if you live in the city (my one is relatively clean) I assumed normal outside Co2 levels to be 500 ppm.

    So I opened my window and after allowing the Co2 sensor to heat up I took a number of
    Serial.println(carbonD[4]);
    readings.

    I averaged these out, and set my X1 value to equal this, my Y1 = 500.

    The datasheet showed that the sensor maxed out at 10000ppm, so for my second reading I got some bicarb and vinegar put that in
    a plastic bag with the sensor and sealed it up and set the reaction off.
    After a minute or so It reached its lowest reading using
    Serial.println(carbonD[4]);
    so I used this value as my X2, my Y2 I set to 10000.

    Now I solved to find M and C: (or use excell :) )

    y1 = MLogn(x1) + C
    y2 = MLogn(x2) + C

    And plugged these values back into the program:

    #define Carbon_M -83.45
    #define Carbon_C 768.62



    By the way for this step I am not convinced about my assumptions made about X2 and Y2 values (or Y1 values for that matter :)
    ), if anyone has some suggestions I am open to them

    Hope this help many and fell free to comment to help correct and improve this solution.
  • batobato Posts: 1
    edited 2013-08-11 14:54
    gracias tu informaci
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-08-12 10:01
    bato wrote: »
    thanks your information I have been very useful, you're right in saying that Parallax should provide sample code for these sensors.

    As per the documentation Parallax Inc does not provide any calibration information and that is something that must be done on a per sensor / installation basis. Example code for the BASIC Stamp and Propeller Chip would require calibration. That is all that is needed to operate this sensor, however you do need to calibrate it using a calibrated reference which we cannot provide.
    De acuerdo con la documentaci
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2013-08-12 15:36
    There's a video of the BASIC Stamp with an MG-811 sensor (#27929, retired) at http://www.youtube.com/watch?v=tpNl9FVKo1A

    I'm skeptical of the calibration method proposed by anthony_p1234 and quoted in post #4. The response curve of the MG-811 (as shown in its data sheet), shows no tendency to level off at 10000ppm (1%). If the gas concentration produced by the vinegar/soda reaction is much greater, as it probably is, then the slope of the logarithmic curve will be greatly overestimated. I think it is better to rely on the data sheet typical value. The data sheet value from the curve below, using 400ppm and 10000ppm is mV = -41 log(ppm) + 429. Compare that with the value from post #4, where the slope estimated is -83. The data sheet specs the slope between -30 and -50 mV between 350 and 10k ppm, so -41 is about in the middle.
    Screen shot 2013-08-12 at 2.27.28 PM.png

    A better calibation might be had by using a 5 liter bottle full of ambient air, and then use a small measured amount of soda to add quantitative amount of CO2 to that volume.

    Anyone curious about that sensor should look at the principles behind its operation. Unlike a lot of the other gas sensors which depend on surface resistance changes in a catalytic film, the CO2 sensor is a solid state electrolytic cell, a little battery, based on an exotic material, class "Nasicom". Conduction involves migration of an ion like lithium (in the MG811) or sodium through pores in a tetrahedral lattice.
Sign In or Register to comment.