GeorgK/MQ135

Problems using this code on ESP32

Opened this issue · 3 comments

Hi , I tried using this code on ESP32 but the values from the getPPM() function were just not the same like on the UNO.

I know for a fact that the GPIO on esp32 is 4096, but changing the value on the getPPM() function, did not work. Any ideas? Thank you.

I'm having a similar issue, but on ESP8266 - my (uncorrected) PPM readings seem rather unrealistic (about 2ppm in room air, 15ppm if I blow smoke into the MQ135).

I went through the burn-in procedure of the sensor already.

I'm not 100% sure, but It might be due to a floating point accuracy difference on AVR (Uno) and ARM (ESP32).

MQ-135 is analog sensor so you should consider trying to convert the data yourself, without the library. I mean, it's just some math, no bit ops or complex communications.

What ADC resolution are you running at? The code only works for 10-bit ADC atm. See this line:

return ((1023./(float)val) * 5. - 1.)*RLOAD;