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.