CO2 MG811 logic

Hello, I have problem with MG811 its look like classic one but functions are different.
1:
Voltage analog output are between 0.3v - 2v can be adjus with knob. The measuring range is around 50 mv (when i breathe it).
2:
The logic of this module is when increase volts then increase co2 ppm.

Here is my problems when I cannot find correct library for these module.Always they have 5v version and logic is opposite.
I was tried switch logic (in CO2Sensor.h library) with function map but cannot make for 2v (not sure how to count with it).

Thank you for some tries. :slight_smile:

As the ESP32 is not 5V tolerant if you hooked up the device to 5V and connected it to the ESP32, the ESP32 may be burnt.

The device a 6V device and will need its analog signal stepped down from 6V to 3.3V max output. A voltage divider can be used for that purpose. Here is a link to a voltage divider thingy, Voltage Divider Calculator (ohmslawcalculator.com).

Data sheet: MG811.doc (mouser.com)

The words ":arduino MG811" gives lots of info on how to use the device.

I use a ESP32 and a MH-Z19B to detect C02, works great.

this library seems to allow you to calibrate your sensor so if you can reduce the sensor output range as you claimed in your initial post, then this library link may be useful to you! :wink:

Recommended supply for the sensor seems to be 6V, so default analog output range would probably be 0-5V. As Idahowalker, suggested ESP32 is not 5V tolerant so you may need to 'step-down' the sensor output before connecting it to your board.

hope that helps....

I am using AtMega 2560. For sensor is separated power supply 6V but all have same ground.
These 2V is maximum from analog, with knob you can leveling down to minimum 0.3V (all measure on multimeter). Device show some ppm but with opposite logic and small change, not what i expect.

I'll explore the library, but I need to reverse the logic. The analog output is max 2V and minimum 0.3V. I can only tune to this extent.

Example

Hi, @Zajicek
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

This will help with advice on how to present your code and problems.

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.