ELECFREAKS Octopus CO2 Gas Sensor (MG811)

SKU: EF04100
$49.90 USD
In stock and ready for shipping

Frequently Bought Together

We Accept



Octopus MG811 CO2 Gas Sensor is a CO2 electronic brick in our OCTOPUS series, the basic design for the outlook, PCB fixing holes and connections are the same as theirs.

The higher the CO2 concentration is, the lower the output voltage would be. The users can read the CO2 value easily after checking our brochures and coding samples.
The CO2 probe is made with an industrial grade that is highly allergic to CO2 and anti-interference to alcohol and CO. It is of high performance and quick response with a loaded signal amplification circuit even in different temperature and humidity environments. Besides, the heating circuit on-board helps to convert to stable 6V voltage from 5V directly improves the adaptability of the module.


The module belongs to electrochemistry CO2 and the probe heats itself when working, please do not touch in case getting hurt.
Please make seal preservation while the sensor is not in use in case the probe gets “poisoned” due to the long time exposure in the air or you have to heat it continuously for another 48 hours to activate it!
The MG-811 probe belongs to the category of electrochemistry sensor, please make a proving operation for it before using it to get an accurate value.


Working voltage of the probes: 6v
With the booster circuit inbuilt, it supports input DC 3.7~5V and the current over 500mA.
OCTOPUS electronic bricks.
Easy connection.


Item Parameter
Name Octopus MG811 CO2 Gas Sensor
SKU EF04100
Working Voltage DC 3.7~5v
Connection Mode G-GND,V-VCC,S-pin signals
Size 31 x 48mm
Net Weight 9.6g

Outlook & Dimension

Hardware Connection

The module connects to the A0 of the Arduino UNO through a Dupont wire with the best fastener, the Arduino main board much be powered with an extra connection(7.5V-9V).



The MG-811 probe belongs to the category of electrochemistry sensor, please make a proving operation for it before using it to get an accurate value. The probes heat themselves after giving a stable power supply. Please put the module in a place in fresh air and heat for 48 hours continuously. Please measure the output voltage(unit: V) of the module and divides by 8.5, the final value should be filled into the macro definition of the code:

#define ZERO_POINT_VOLTAGE (Revise as: Voltage(V)/8.5)
For example: if the voltage tested by the multimeter is 2.4V, then we use 2.4/8.5=0.282, and we should revise them as below:

#define ZERO_POINT_VOLTAGE (0.282)
After revising, please upload it to Arduino main board and you can use it to test your own projects now.


Coding Samples

/*Demo for MG-811 Gas Sensor Module V1.1*

/**Hardware Related Macros**/

#define MG_PIN (A0) //define which analog input channel you are going to use

#define DC_GAIN (8.5) //define the DC gain of amplifier

/*Software Related Macros**/

#define READ_SAMPLE_INTERVAL (50) //define how many samples you are going to take in normal operation

#define READ_SAMPLE_TIMES (5) //define the time interval(in milisecond) between each samples in
//normal operation

/**Application Related Macros**/
//These two values differ from sensor to sensor. user should derermine this value.

#define ZERO_POINT_VOLTAGE (0.220) //define the output of the sensor in volts when the concentration of CO2 is 400PPM

#define REACTION_VOLTGAE (0.030) //define the voltage drop of the sensor when move the sensor from air into 1000ppm CO2

float CO2Curve[3] = {2.602,ZERO_POINT_VOLTAGE,(REACTION_VOLTGAE/(2.602-3))};
//two points are taken from the curve.
//with these two points, a line is formed which is
//"approximately equivalent" to the original curve.
//data format:{ x, y, slope}; point1: (lg400, 0.324), point2: (lg4000, 0.280)
//slope = ( reaction voltage ) / (log400 –log1000)

void setup()
Serial.begin(9600); //UART setup, baudrate = 9600bps
Serial.print("MG-811 Demostration\n");

void loop()
int percentage;
float volts;

volts = MGRead(MG_PIN);
Serial.print( "SEN0159:" );
Serial.print( "V           " );

percentage = MGGetPercentage(volts,CO2Curve);
if (percentage == -1) {
    Serial.print( "<400" );
} else {

Serial.print( "ppm" );  



/* MGRead *
Input: mg_pin - analog channel
Output: output of SEN-000007
Remarks: This function reads the output of SEN-000007
float MGRead(int mg_pin)
int i;
float v=0;

for (i=0;i<READ_SAMPLE_TIMES;i++) {
    v += analogRead(mg_pin);
v = (v/READ_SAMPLE_TIMES) *5/1024 ;
return v;  


/* MQGetPercentage **
Input: volts - SEN-000007 output measured in volts
pcurve - pointer to the curve of the target gas
Output: ppm of the target gas
Remarks: By using the slope and a point of the line. The x(logarithmic value of ppm)
of the line could be derived if y(MG-811 output) is provided. As it is a
logarithmic coordinate, power of 10 is used to convert the result to non-logarithmic
int MGGetPercentage(float volts, float *pcurve)
return -1;
} else {
return pow(10, ((volts/DC_GAIN)-pcurve[1])/pcurve[2]+pcurve[0]);



Open the serial monitor and you will get the concentration of the CO2 around you after 5 minutes.


Packing List

Item Parameter
Octopus MG811 CO2 Gas Sensor 1



Octopus MG811 CO2 Gas Sensor

Recommended for You