Hi for all,
I use MQ7 gas sensor for CO detecting,
I have equation for temp and hum compensation, please see attached image,
(hr is humidity in range 0.0 to 1.0; t is temp in C)
I use this part of code to ppm calculation
//Calculation of PPM
void calculatePPM() {
double lgPPM;
Vrl = (double)adc_rd * Vadc_5; // For 5V Vcc use Vadc_5 and for 3V Vcc use Vadc_33
Rs = Rl * (5 - Vrl)/Vrl; // Calculate sensor resistance
ratio = Rs/Rl; // Calculate ratio
lgPPM = (log10(ratio) * -3.7)+ 0.9948; // Calculate ppm
ppm = pow(10,lgPPM); // Calculate ppm
}
can somebody advice how to implement that equation in code?
thanks
regards
The equation involves multiplication, addition, and the natural log function. It is trivial to implement. What are you trying to get from the equation? What have YOU tried? With what results?
Hi PaulS, thanks for reply,
I use MQ7 for CO measurement,
MQ7 data manual advice implementation temp and hum compensation, to get better result according real outdoor conditions,
manual in attach,
in original code Rl (load resistance) for MQ7 is defined 10K (recommended value is 5K to 47K, need to choice according real situation), and Rs is calculated from Rs = Rl * (5 - Vrl)/Vrl;
RATIO is a variable defined with Rs/Rl,
in this case RATIO depends only from Rl and analog read,
but this RATIO depend also from real temp and hum on location of use,
I found equation and I need advice how to implement,