I just wanted to share some information on the hardware of the popular MH-Z19 sensor. The software part is well covered in mysensors.org: MH-Z19 CO2 sensor and in particular in revspace.nl: MH-Z19.
As my sensor showed a discontinuous rise in CO2 concentration in my closed bedroom during a typical night (which is illogical) so I decided to open it. See attached photos.
Inside there is a STM32 Microcontroller, and some optics: Incandescent light bulb (= broadband IR source) -> open gas cell with focusing concave mirror -> narrow-band IR filter tuned to CO2 absorption wavelength -> broadband photo diode. So basically the CO2 molecules absorb specific IR light which results in a lower current of the photo diode. NDIR on Wikipedia.
The sensor has no reference gas cell, so it needs factory calibration and probably a calibration after a couple of months of operation (Pull Hd pin to GND for 7seconds). The module has also a built in temperature sensor.