MQ135 and Spark Core

@alexsh1 We're talking about MQ135 for less than $2 and MH-Z14A for minimum $35. Sure the sensor itself looks very promising, but expensive for my use case & design.

@ScruffR Calculation on the photon is almost the same except for the fact that the PPM calculated with the same method as Arduino, gets divided by "4". Sorry I mentioned this as "Zero" in my first post in this thread.


On Arduino:

float co2_ppm = gasSensor.getPPM();

returns 0.22


On Photon:
MQ135 Library at Particle Web IDE has given an example code and from that:

float co2_ppm = gasSensor.getPPM();
float ppm = co2_ppm / 4;

returns 150


Here co2_ppm gets divided by "4", probably for the fact that 1023*4 = 4092

getPPM() function is same for both platforms and as follows:

float MQ135::getPPM() {
  return PARA * pow((getResistance()/RZERO), -PARB);
}

float MQ135::getResistance() {
  int val = analogRead(_pin);
  return ((1023./(float)val) * 5. - 1.)*RLOAD;
}

I didn't calculate much... Just looking at the numbers in the getResistance() function included in MQ135.cpp
I did change the number 1023 to 4095. Also I assumed the number 5 in that is 5volts and changed it to 3.3.

float MQ135::getResistance() {
  int val = analogRead(_pin);
  return ((4095./(float)val) * 3.3 - 1.)*RLOAD;
}

RAW returns 1060
PPM returns 35

Output impedance of the sensor... I calculated the resistance between MQ135's Analog Out Pin and Ground while the sensor is removed from the circuit and it showed 1K Ohm. Is this how we measure output impedance? Is this what you mean? Just to be sure, i tried these too...

float MQ135::getResistance() {
  int val = analogRead(_pin);
  return ((4095./(float)val) * 3.3 - 1.)*1; // Changed RLOAD(Resistance Load) to 1 as the output impedance measured 1KOhm
}

And I didn't divide PPM from this by 4...
RAW returns 1100
PPM returns 41

Still PPM values of 35 & 41 is no where close to the PPM value of 0.22 returned by Arduino...
Since I've changed "1023 to 4095" and "5 to 3.3", I don't need to divide this PPM by 4, right? And, if at all I do, it approximates to 9-10...

How exactly do I add an impedance converter circuit that can do the 5V to 3.3V adjustment. Can you refer any closest possible example to do this for my use case?