kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.95k stars 494 forks source link

Add input: MH-Z14A CO2 sensor. #1187

Closed jcass77 closed 2 years ago

jcass77 commented 2 years ago

Add support for the Winsen MH-Z14A CO2 sensor: https://www.winsen-sensor.com/sensors/co2-sensor/mh-z14a.html

The sensor has a neat auto-calibration feature, which is completely useless in closed environments that produce their own CO2 :(

I wasn't sure what coding style the project currently uses so you may want to reformat the code for consistency (currently formatted using Black).

jcass77 commented 2 years ago

Update: refactor code and fix reading of CO2 measurements via PWM on a GPIO pin.

jcass77 commented 2 years ago

Switch to using GPIO's wait_for_edge for more reliable and accurate PWM readings on the GPIO pin.