Correction

The datasheet clearly says that the CO2 level is 2000x(th-2ms)/(th+tl+4ms), so I think here it should say 2000 too. At least that resulted in way better results for me.
This commit is contained in:
Portagoras 2020-07-01 22:57:48 +02:00 committed by GitHub
parent af5c565990
commit 093774f701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,7 +243,7 @@ int MHZ::readCO2PWM() {
if (debug) Serial.print(".");
th = pulseIn(_pwmpin, HIGH, 1004000) / 1000;
tl = 1004 - th;
ppm_pwm = 5000 * (th - 2) / (th + tl - 4);
ppm_pwm = 2000 * (th - 2) / (th + tl - 4);
} while (th == 0);
if (debug) {
Serial.print(F("\n # PPM PWM: "));