MG-811 CO2 Sensor - Supplier Code = SEN0159 - Programming Questions


First off, I want to say how awesome this community has been. I just started learning arduino about 3 weeks ago and these forums have been a life saver.

So my first major project was to get a DHT22 humidity and temperature sensor to read. I have successfully done that as of today. It was super awesome because it took me a while to get the code to work and I was very happy once it did work.

The second part of what I really want to do is add a CO2 sensor. I live in the Mid-West and during this time of year our house gets very dry because of the heat running so often. SO I thought I would build a sensor system for kids rooms to monitor how comfortable their rooms are.

With all that said, here is my question. I am finding very little on the MG-811 CO2 Sensor as far as how to program it, and doing the wiring. I would also like it to run with my currently setup DHT22 sensor as well. I have attached pictures of my current setup. Will that work? I do NOT have an I2C power pack on my LCD 16x2 screen.

I will end by saying I am sorry if I have done something wrong with this post. Please let me know if I need to add or omit something for this to be an accurate post.

Lastly thank you all for being super awesome and helpful. I am so excited to dig deeper into this amazing technology.

DHT22_WITH_LCD.ino (1.09 KB)

looking at the datasheet ( is looks the sensor outputs an voltage the value being a log/exponetional of the CO2 ppm

so you could use analogRead() to read the sensor output and using the datasheet figure out the formula (or approximate formula... a quick excel plotting gave me, ppm = (2e10)exp(-0.055mV) ;)) to determine the corresponding ppm

having those then incoperating that bit of code into your current code should then be fairly trivial

hope that helps....