MG811 CO2 Sensor with Arduino

The MG-811 sensor is highly sensitive to CO2 and moderately 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.

It is available as a breakout board like this from dfrobot or you may opt for the sensor only option, in which case you might need an external amplifying and conditioning circuit.

MG811

It has an onboard heater which needs a separate 6V supply , but if you are getting the breakout board this can also be eliminated as the circuit itself takes care of heater supply voltage.

Connecting to arduino and getting the data is a fairly simple process. What I suggest would be to write a simple program like the one below to get the output values in terms of mV first against some known PPM values. You might want to get a high precision NDIR monitor or PPM monitor for this.

int sensorValue = analogRead(A5);
float voltage= (sensorValue * (5.0 / 1023.0))*1000;

Note down all the output voltage values against the known PPM values (ranging from around 300 ppm to 1000 ppm maybe) and plot a graph in excel. Add a trend-line and use curve fitting tool to get a logarithmic formula, something like the one shown below. You cannot always depend on the formula you get from web because the amplification factor of your particular breakout board might be different and it is always better to work reverse and get the formula by using a standard CO2 monitor.

1

 

Since the output voltage is directly proportional to this logarithmic function, you may use this formula in your code to convert the values to PPM.

float refy = (voltage-264.76)/-17.644;
float ppm = pow(2.71828,refy) * 10000;

Note: This piece of information is supposed to be used for demonstration only. More sophisticated calibrations are required for industrial applications.