Problem when coding for MQ136 and MQ135

HI, Can you help me with my code please? I am currently making a project to read SO2 and CO2 gas using sensors MQ136 and MQ136 and NodeMCU ESP8266. but the result is 0. This is my code

#include <ESP8266WiFi.h>
#include "Arduino.h"

//MQ136
int mq136 = A0;
int Rload136= 10000;
float rO136 = 18897;
double ppm136 = 50;
float a136 = 36.77992237;
float b136 = -3.500061191;
//MQ135
int mq135 = 2;
int Rload135= 20000;
float rO135 = 2842;
double ppm135 = 411.28;
float a135 = 110.7432567;
float b135 = -2.856935538;

unsigned long previousMillis = 0;       
const long interval = 5000;  

void setup()
{
  Serial.begin(9600);
 
  
}

void loop(){
     int adcRaw136 = analogRead(mq136);
  double rS136 = ((1023.0 * Rload136)/adcRaw136)-Rload136;
  float rSrO136 = rS136/rO136;
  float ppm136 = a136 * pow((float)rS136/(float)rO136, b136);

    int adcRaw135 = analogRead(mq135);
  double rS135 = ((1023.0 * Rload135)/adcRaw135)-Rload135;
  float rSrO135 = rS135/rO135;
  float ppm135 = a135 * pow((float)rS135/(float)rO135, b135);
  delay (5000);

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) 
  {
    previousMillis = currentMillis;
    Serial.print ("rSrO SO2 = ");
    Serial.println (rSrO136);
    Serial.print ("SO2 = ");
    Serial.println (ppm136);
    Serial.print ("rSrO CO2 = ");
    Serial.println (rSrO135);
    Serial.print ("CO2 = ");
    Serial.println (ppm135);
}
}

and this is the result

rSrO SO2 = 270.15
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 179.92
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 179.92
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 270.15
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 179.92
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 179.92
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 67.14
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 67.14
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf
rSrO SO2 = 59.62
SO2 = 0.00
rSrO CO2 = 0.00
CO2 = inf

Any help appreciated, Thank you very much

My first guess would be that your ESP8266 is giving you 12-bit analog results (0-4095) while the sketch is expecting 10-bit results (0-1023).

Oh thanks Sir to the answer
But, if i only make program for one of them, it work!

How are you powering the sensors.
They need a 5volt supply with <0.1volt variation, capable of 300-350mA for the two.
And the right burn-in time.

How are you switching between the two sensors, because the NodeMCU only has one analogue input.
An ADS1015 or ADS1115 breakout board could solve this.

@johnwasser
The NodeMCU, with it’s ESP8266, has AFAIK a 10-bit resolution.
Leo…

@Wawa
Thanks for the answer Sir.
for the mq135 sensor it can turn on with a 3.3v supply, i tried it.
at nodemcu v3 by lolin there is a VU pin that produces 5v, can it be used as a power supply for the sensor?
because I found a discussion about VU pins here :

I used D4 pin (GPIO2) for additional analog input.

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Please include your power supply(s).

Thanks.. Tom... :slight_smile:

kariiayam:
for the mq135 sensor it can turn on with a 3.3v supply, i tried it.

Sure you can. Was it accurate? Why do you think the datasheet specifies 5.0volt ±0.1volt

kariiayam:
nodemcu v3 by lolin there is a VU pin that produces 5v, can it be used as a power supply for the sensor?

The nodeMCU does not produce 5volt.
That's the pin YOU provide power to the module, either via USB or external 5volt.
That pin could have about 4.5volt on it on USB supply, because of a USB backflow protection diode.

kariiayam:
I used D4 pin (GPIO2) for additional analog input.

You must have special powers to turn a digital input into an analogue input.
Leo..