crisap94 / MHZ19

MH-Z19 CO2 sensor library for ESP8266 or Arduino
Other
69 stars 25 forks source link

How to change ppm range? #20

Open Eisbaeeer opened 2 years ago

Eisbaeeer commented 2 years ago

Thank you for your great job and this library! Some others reports wrong PWM outputs vs UART outputs. This belongs of the range of the NDIR sensor. If I change the range to 5000ppm the PWM output is verry similar to the UART. Can you expand the lib to set the range? I found some hints in the source: enum MHZ19_PWM_DATA { CALC_2000_PPM, CALC_5000_PPM }; And I changed this in MHZ19.h to 5000. After that, the PWM value seems right: From: // Pwm Data Flag uint8_t PWM_DATA_SELECT = MHZ19_PWM_DATA::CALC_2000_PPM; To: // Pwm Data Flag uint8_t PWM_DATA_SELECT = MHZ19_PWM_DATA::CALC_5000_PPM;

PWM-setting

Thank you!