PPM calculation from MG812(Co2) sensor

Hello geeks,
This one is first thread of mine.
Right now I’m dealing with MG812 Co2 sensor, sensor is similar with famous MG811(both have a same curve and characteristic)
Here is the datasheet of the sensor…

sensor manual

main difference between MG812 and MG811 is that MG811 runs with +6V heater voltage while MG812 with +5V heater voltage

There is one tutorial provided by DFRobots for MG811 to calculate ppm, here is the link…
Doc for MG811 to calculate ppm

both of the sensor produced EMF at o\p in mV w.r.t Co2 concentration

Now when i use DFrobot code to calculate ppm then it show me o\p which is not fit in to the characteristic of the sensor

here is my connection for the sensor…

PIN STATE
1(Heater1) ------> +5V
3 (Heater2) -------> GND
2(Test1) --------> GND
4(Test2) ---------> MCU Adc

o\p voltage should be in range of mv(253-330mV)
and when i display ADC’s samples and voltage then it show me…

Samplse: 23
Volts: 0.11
mV: 112.3046875000

Samplse: 15
Volts: 0.07
mV: 73.2421875000

Samplse: 21
Volts: 0.10
mV: 102.5390625000

Samplse: 16
Volts: 0.08
mV: 78.1250000000

Samplse: 18
Volts: 0.09
mV: 87.8906250000

Samplse: 19
Volts: 0.09
mV: 92.7734375000

Samplse: 15
Volts: 0.07
mV: 73.2421875000

Samplse: 22
Volts: 0.11
mV: 107.4218750000

Samplse: 16
Volts: 0.08
mV: 78.1250000000

Samplse: 19
Volts: 0.09
mV: 92.7734375000

Samplse: 19
Volts: 0.09
mV: 92.7734375000

Samplse: 17
Volts: 0.08
mV: 83.0078125000

Samplse: 20
Volts: 0.10
mV: 97.6562500000

Samplse: 15
Volts: 0.07
mV: 73.2421875000

In datasheet they also put unity gain amplifier at the o\p of the sensor
but o\p of unity gain amplifier is as same as i\p

Guys any idea?

Have you tried looking into other threads that deal with similar sensors?

There is a search feature to look for things like co2, ppm or mq135

One point all of the hits will draw your attention to is the fact that the ADCs are not 10bit ,as any Arduino code would assume, but 12bit and the max voltage at 4095 units will be 3.3V instead of 5V.

1 Like

yes, when i was writing the post then i found some similar threads here,
but the thing is that MQ series sensors are electro-chemical resistive sensor and reading is graphical relation of RS/R0 and ppm

Yes, but the resistor divider is still producing a voltage to sense and so is your MG. So what’s the actual difference that these hints won’t apply for your sensor?

And my hints about the ADC differences still apply.

yeah! I know in MQ series, they produced voltage divider and can measure voltage
but here for MG812 it has graph which have limits of o\p mV 250 to 330
and my sensor only producing voltage from 70-100mv!

here I’m using arduino and getting ADC’s voltage as…

volts=(samplse*5.0)/1023
mv=volts*1000

As I said (twice before and a third time now): The ADC is different!

The Particle ADC is 12bit (4095) and not 10bit (1023) and it’s 3.3V not 5V.

Plug that in your formula and see!

Why do people always assume they have understood what one wrote but not apply any of the info?

here I’m dealing with Arduino!

But this forum is for Particle devices.

so what
I’ve post hear in hardware section!!
for any MCU logic is not going to be change :slight_smile:

Not the way how you’d read the values but definetly how to convert the readings.

So yes, it makes a difference regarding your question!
What Arduino are you using? There are some 3.3V Arduinos too and AFAIK some clones do also feature ADC with other than 10bit.

But if it’s not a matter of the MCU used, it might be the sensor.
Have you measured the voltage of the sensor conventionally?

BTW, “Hardware” section still refering to the Particle hardware and stuff attached to that kind of HW :wink:

1 Like