
Davide Gironi writes:
MH-Z14 NDIR Infrared gas module is a common type, small size sensor, using non-dispersive infrared (NDIR) principle to detect the existence of CO2 in the air, with good selectivity, non-oxygen dependant and long life.
MH-Z14 has a PWM output, with a sensitivity range of 0ppm to 2000ppm CO2, an accurancy of ±200ppm.
The cycle is 1004ms±5%, given the duty cicle Th (pulse high), Tl is 1004-Th, we can convert it to CO2 value using the formula: CO2ppm = 2000 * (Th – 2ms) /(Th + Tl – 4ms)
This library read PWM output, and convert it to CO2ppm. This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 8MHz
Check out the video after the break.

Nice!
Where have you bought this sensor?
I can totally see CO2 sensors being used to optimize room atmosphere in crowded office spaces or even at home. Nice project.
Martin, CO2 meters are rather expensive for home use; $100 and up. Because of my interest in building science, I have a CO2 meter (stand-alone unit with USB interface so you can log to a computer as well). Because animals exhale a lot of water vapor, RH is a good (and cheap) proxy for indoor CO2. For the times it’s not (i.e. cooking and showering increase RH without increasing CO2), you generally want to increase air changes anyway to reduce the RH.
You also need a *REALLY* tight building to get elevated CO2 levels. My house tested out at 1.2ACH@50pa, and the only time CO2 got over 1000ppm was during one of my son’s birthday parties with over a dozen young boys running around the house.
Ralph, thanks for the heads up. $100+ doesnt necessarily put me off, but the tight building seems to be an important point. I’ll have to check that, thanks.
Ralph, thanks for the heads up. $100+ doesnt necessarily put me off, but the tight building seems to be an important point. I’ll have to check that, thanks.