[MG811] CO2 sensor problems

Hello everyone.

I'm working on a project that has to have a co2 sensor detect average amounts of atmospheric co2. It uses many other sensors, including gas sensors, and I have not had any real problems connecting any of them until I got to the MG811. I have been troubleshooting this for days now, the main problem resulting from lack of documentation and detailed guides. I have tried several different breakouts and even building the circuits myself, and have had no luck getting any of them to work with arduino models Uno or the Mega successfully. What i guess i'm looking for is a step by step guide to getting the breakout boards listed below working. If someone could help me set any of these up I would be extremely greatful because this is the last step in getting this prototype to work before i start to work on a production design.

http://www.robotelectron.com/prodShows.asp?prodid=989
http://www.ebay.com/itm/MG811-MG-811-CO2-Carbon-Dioxide-Sensor-Module-for-Arduino-/321171363099?pt=LH_DefaultDomain_0&hash=item4ac74e151b

I have built the schematic for the following board to the best of my abilities and i found it slightly confusing. I would have just bought it, but it seems like the board has been discontinued and i could not find it anywhere. The end result being failure, so i really would like someone to help me get the ones above working correctly, also because I'd prefer not to spend any more money.

please don't just link me to a guide you found on google if it does not refer to the specific breakout boards above because I have seen every single guide on a whole range of mg811 sensor circuits.

Do you have 6V ? The sensor requires 6V.
You can verify how the gas sensor itself is connected: Look at the bottom, keep 3 on the left and three on the right. The middle on the left and middle on the right is the heater. Connect the upper and lower on the left, that is A (or B). Connect also the upper and lower on the right, that is B (or A).
This sensor has a very small output, therefor an opamp is used to amplify it.

When you buy something, start at www.adafruit.com and www.sparkfun.com , they give all the information you need.

The module from robotelectron.com and Ebay doesn't come with a schematic. But I think the 4 pins are : 6V, Dout, Aout, GND.
Connect the Analog_out to an Arduino analog input with a protection resistor of 1k to 4k7.

Of course i've been using 6V, I have followed every guide on the web step by step. I really just want this sainsmart model to work but i can't find code ANYWHERE. No normal electronics shop carry these breakouts so just finding a library or whatever is not an option.

So it is working ?
Can you see the analog values ? Do they change when CO2 changes ? (light a match nearby for example).

You only want to have code for the concentration of CO2 ?
It is not that kind of sensor. The Arduino reads an analog value, that's about it.
After the preheat (let it on for 1 or 2 days), the first step is to have an analog value with a known concentration of CO2. That is the first reference point.

I have bought the same Sainsmart MG811 CO2 sensor and I think I've made a mistake because there is no support for it. This is the only description you get:

http://www.ebay.com/itm/SainSmart-MG-811-MG811-CO2-Carbon-Dioxide-Sensor-For-Arduino-UNO-R3-Raspberry-Pi-/301191399526?

"This sensor module has an MG-811 on-board as the sensor component. There is an on-board signal conditioning circuit for amplifying output signal and an on-board heating circuit for heating the sensor. The MG-811 is highly sensitive to CO2 and less sensitive to alcohol and CO. It could be used in air quality control, ferment process, in-door air monitoring application. The output voltage of the module falls as the concentration of the CO2 increases."

Feature

IC: LM393、MG811 Sensor
Work voltage:DC6V
Features:
Instructions with the signal output;
Analog + TTL output;
TTL output signal is low effective;
Analog output 30~50mV, (higher consistency, higher voltage)
Of carbon dioxide with high sensitivity and good selectivity;
Long life span and reliable long-term stability
Sensor removable design is convenient for testing.

I am intending to use it in a project for environment monitoring .

Sensor has 2 outputs A0 and DO, which I guess stand for Analog and Digital output. However the the analog voltage output comes from the DO pin, which is weird. This and the fact that the description is copied from the actual MG 811 sensor ( analog output 30-50mV) and the lack of even a small datasheet make me think It is a poorly made module and you should go with other similar sensor such as the Sandbox one.

Theese are some voltage values measured with arduino uno:

My room - between 3.93 - 4.10 V ( fresh air and closed window)
Outside 3.63 - 3.80 - daytime, around ~ 4.02 V nighttime ( plants consume co2 daytime, nighttime they produce co2)

So using basic logic, since i have no written support for the module, the voltage increases as the co2 level increases. But the sensor description says that voltage drops when the co2 concentration rises .. which makes no sense.

Another contradictory thing about MG811 sensor is that in its datasheet(http://sandboxelectronics.com/files/SEN-000007/MG811.pdf) the table shows output 30-50mV associated with 350-10000ppm but the graph shows that 330mV is 300 ppm and as the co2 level increases to 10.000 ppm the voltage drops to 275mV.

I really don't know how to process output signal from the module,especially because I don't know how the signal is amplified, and how to even connect it via TTL, which is apparently suported. The most I can get out of it is at least a value that represents a high concentration of co2 that should be taken care of, which is in fact my goal.

As you can see in this youtube video, when someone exhales into the sensor co2 ppm goes from 400 up to 3000 ppm, which I am afraid doesnt happen when I exhale into my sensor.; sometimes when I exhale it goes up from like 3.93 to 3.97 V. :~

Any kind of help is appreciated.

That is weird indeed.
This sensor is not like the others. The other MQ sensors change resistance a lot with a little gas change. This one needs an amplifier.
I can't find a schematic for the SaintSmart module, so I can't tell how the analog output changed with CO2 change.

Test 1 : Apply power to the module. Wait 10 minutes or more. Does it get warm ? If if does: the heater is working.
Test 2 : With the powered module, turn the trimpot in all directions. Does the digital output change value ? What is the analog output doing when turning the trimpot ?
Test 3 : Breathing on it should change the value of the analog output. Taking it outside or measure at night could introduce other things, like temperature or humidity, or wind/draft.

Hi.

Thanks for replying, I did not respond because I've been working with interfacing others sensors with Arduino via UART, all went good.

1.The heater is working, I cannot hold my thumb too much on it after 5 minutes since I connect it. Also the analog value slightly increases as the sensor gets hotter, untill it becomes stable.

  1. If you shake the gas sensor, you can hear something like sand particles ( but not sand duh) bouncing around. If I shake it or turn it upside down the value doesnt change. But if I shake it stronger, the values start going weird for example if a normal voltage is 3.9V, sometime it goes down to 3.4, sometimes up to 4.4..

3.Indeed, as the main sensor datasheet says, the output signal is influeced by temperature and relative humidity.

I literally tried every possible way of figuring things out:

I put the sensor togeher with a burning candle, then covered them with a bowl -> values slightly increased.
Assuming the temperature was the one modifying the analog output, I put it in the fridge lol -> voltage didnt change.
I went with the sensor near trees or zones with alot of vegetation(plants consume c02) -> values ALWAYS increase slighlty

I don't really know how stuff around you influence CO2 values and I might be wrong..but still, there are too many factors and my logic fails. I think I will give up :~

Something is wrong. I think the sensor is broken. It should not make noise when shaking. I do not have a MG811 myself, but all my MQ sensors make no noise.
Here is the inside of a MQ sensor, as you can see it is fragile : Sensor Workshop: Sensor Report - MQ3 Gas sensor

I have just purchased one of the SainSmart MG811 Gas CO2 Carbon Dioxide Sensors and so far I have been completely unable to get it to work.

I have contacted the seller who has agreed to send a replacement... so I was able to do some investigation with the faulty unit.

From a brief look at the circuit board, I have noticed the following:

  1. The 'Ao' pin is connected directly to the MG811 sensor
  2. The 'Do' pin is connected to the output of the "amplifier"
  3. The Dout is also connected to an LED that probably illuminates when the CO2 level passes a level set by the trimpot.
  4. There are no feedback resistors on the amplifier, so it is not amplifying the output (as suggested on some websites) but is providing a logic level HIGH or LOW (hence TTL digital out) when passing the trimpot setpoint
  5. The rattling noise is actually caused by pieces of (what look like) graphite that are acting as a filter

I am really disappointed that SainSmart do not provide any documentation for this module and I will need a separate amplifier in order to use it with my Arduino project. In SainSmart's defense, the module does (well, I assume the working one will do) exactly what it says on their website, which isn't a lot!

I think I should look to see what else is out there - buying the cheap (but branded!) option failed!

The SainSmart CO2 sensor is a joke. It provides 5v instead of 6v to the heater and it does not buffer the output of the sensor.
The MG-811 has extremely high impedance and simply cannot be directly connected to the ADC.

Get the SandboxElectronics CO2 board instead. It uses a high input impedance rail-to-rail opamp to amplify and buffer the signal, and it has an SMPS to provide the heater with exactly 6V.

http://sandboxelectronics.com/?product=mg-811-co2-gas-sensor-module

It's also fully documented.
http://sandboxelectronics.com/?p=147

And its the same price:

Funny, I ordered mine from sandbox, and everything works great aside from the sensor itself having loose particles that shake around. It works fine when upside down, but when I turn it right side up, the reading goes up by 200 ppm and the reading jumps around quite a bit. I hope sandbox can return my customer service request. I'll keep you all updated.

Sandbox told me that I could take my sensor back for a full refund, but I want to keep to breakout board. Instead, I took the sensor apart, and found there are two screens on top of eachother, and some black pellets were inside. I carefully removed all pellets, then put one screen back in, put the pellets on top of that, then put the final screen over the pellets. Basically making a sandwich out of the pellets and screens. This fixed the problem. I suspect that there was a bad manufacturing run of the mg811 sensor. My RE-MANUFACTURED Sensor now works as I would have expected.
This is not the fault of sandbox. They offered me my money back, and I declined. Just get an NDIR sensor. I wouldn't buy any mg811s until this mfg issue is addressed and solved.

BobMoore18:
My RE-MANUFACTURED Sensor now works as I would have expected.
This is not the fault of sandbox. They offered me my money back, and I declined. Just get an NDIR sensor. I wouldn't buy any mg811s until this mfg issue is addressed and solved.

Thanks for the info. As I said in an earlier post, the Sandbox Electronics board is a good one, but the sensor itself seems flaky. I'll try rebuilding the sensor just now (my attempt to recondition it by leaving it on for a week failed). Originally when I spec'ed this part there was no cheap NDIR sensor available, but recently I saw a new entry on the market costing around 50 EUR. When this project becomes a priority again, I'll try it out. I don't seem to have the link for this new sensor, but I'm sure I'll find it again.

It's not the one I was thinking of, but Sandbox have this: 10,000ppm MH-Z16 NDIR CO2 Sensor with I2C/UART 5V/3.3V Interface for Arduino/Raspeberry Pi | Sandbox Electronics

I am also having a problem!!

I recently bought a mg811 co2 gas sensor from sandbox electronics for a science fair project and have been having some problems with it. I burned it in for 2 days and allowed 2 hours for it to heat up but the readings either jump around, are very inaccurate or steadily climb! The calibrated it properly and have done everything this guide told me to do:
Here is the link for the guide:

http://www.veetech.org.uk/Prototype_CO2_Monitor.htm

Here is the link for the sensor:

http://sandboxelectronics.com/?product=mg-811-co2-gas-sensor-module

PLEASE HELP!

i have been working on aproject which is based on the use of co2 sensor(MG811).please help me with the connections of the sensor with arduino and the code to run it.Below i have attached the snapshots of the sensor i have bought from ebay.in.

Is there any other code available for co2 sensor v1.2 (mg811), i have to use https://sandboxelectronics.com/?p=147 this code and connecting with the arduino ckt board. But it will give high ppm rate. By rotating the potentiometer it will not decreases. If any other code you have please provide me.

I have the same problem with MG811 module.
This module have 4 pin :
Vcc.Gnd. Aout. Dout
I connect 6v with 0.200mA power supply(Sensor heat very good,I can't touch it) and A0 from arduino UNO to analog-out and pin 2 from arduino to Dout.
but after 48h later, problem not solved. I recieved same message and there is no consistance at all :

SEN-00007:3.95V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.87V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.96V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.88V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.95V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.90V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.89V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.90V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.94V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.95V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.92V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.94V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.95V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.90V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.91V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.95V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.92V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.93V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.84V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.93V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.91V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.92V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.98V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.92V CO2:<400ppm
=====BOOL is HIGH======
SEN-00007:3.87V

link my sensor : Pasteboard - Uploaded Image
I use the same code in : https://sandboxelectronics.com/?product=mg-811-co2-gas-sensor-module
the mg811 use op-amp : lm358