I purchased this CO2 sensor a while back: SainSmart MG811 Gas CO2 Carbon Dioxide Sensor Module Sensor Module for Arduino UNO R3 Raspberry Pi

The module has four pins, Vin, GND, Dout and Aout. I assume Dout and Aout are digital output and analog output, respectively.

Other than that, the sensor came with no datasheet, instructions, or tutorial. I also searched online but fail to find anything useful.

I'm going simple for now, just hooking up the sensor module to Arduino board. I know I can probably connect the output pins to the analog pins, and analogRead them, but what I am looking for is how to convert the raw data readings into CO2 levels in PPM. Like a formula.

Also, I'm curious as to how the digital output works...


2 Answers 2


The Dout is a TTL threshold indicator; basically it goes high when a certain threshold of the sensor is reached, which is adjusted by the pot. The Aout is the VRef of the sensor.

Now the MG-811 is not the best sensor in the world; I did look at the datasheet which shows this sensor outputs mV in relation to the PPM so a map function could be used such as 100-600mV maps to 400-10000ppm CO2, see MG-811 CO2 Sensor Module, so you could feed this into a map() function and get the result but since there is a signal conditioning circuit consisting of a op-amp I'm not sure what it does to the raw sensor voltage.

Now the sandbox electronics module may not be identical to the SainSmart module, so you may need to reverse engineer the module you have to determine what is going on or use the schematic from the sandbox site to build your own and de-solder the MG-811 from the SainSmart module.


You can not directly convert the reading to ppm because you do not know what value means what ppm. You'd need at least one calibration point to calculate how many particles per million there are. The sensor is both affected by temperature and humidity so you might wish to compensate that too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.