Lack of support makes you think, so I figured out the "hidden" calculations in the sketch above and proposing the code modification to allow users to port the code to a different gas sensor using data taken directly from the sensor chart. Here are modified fragments of the code showing only CO curve for MQ2 sensor:

float CO2Curve[4] = {0.8,200,2.2,10};

//two end points are taken from the curve with two coordinates for each point

//in form of{Y1, X1,Y2, X2) where X is PPM axis, Y is Rs/Ro axis from the sensor chart for specifc gas

//then equation X=(Y-b)/m is used,

//where m is slope of the curve, b is Y axis intersept point

float Slope = (log(pcurve(1)-log(pcurve(0))/(log(pcurve(3)-log(pcurve(2));

float Y_Intercept=log(pcurve(1)-Slope*log(pcurve(3);

int MQGetPercentage(float rs_ro_ratio, float *pcurve)

{

{ return (pow(10,((log(rs_ro_ratio)-Y_Intercept)/Slope))); }

}