To calibration, we need to find the R

_{O} value while measuring the clean air.

Since we known the ratio of the clean air from the graph is 9.83, then we can calculate R

_{O} from the equation below:

Now we can find the concentrations (ppm) of any gas from the graph from R

_{S}/R

_{O} ratio.

1. Take two points from gas graphs.

CO (x1, y1) = (log

_{10}200, log

_{10}5.14)

CO (x2, y2) = (log

_{10}1000, log

_{10}3.14)

SMOKE (x1, y1) = (log

_{10}200, log

_{10}3.43)

SMOKE (x2, y2) = (log

_{10}1000, log

_{10}1.89)

LPG (x1, y1) = (log

_{10}200, log

_{10}1.67)

LPG (x2, y2) = (log

_{10}1000, log

_{10}0.78)

2. Convert to base10

CO (x1, y1) = (2.3, 0.71)

CO (x2, y2) = (3.0, 0.50)

SMOKE (x1, y1) = (2.3, 0.54)

SMOKE (x2, y2) = (3.0, 0.28)

LPG (x1, y1) = (2.3, 0.22)

LPG (x2, y2) = (3.0, -0.11)

3. Calculate the slope using formula:

slope = (y2-y1) / (x2-x1)

CO = (0.50-0.71) / (3.0-2.3) = -0.21/0.7 = -0.31

SMOKE = (0.28-0.54) / (3.0-2.3) = -0.26/0.7 = -0.37

LPG = (-0.11-0.22) / (3.0-2.3) = -0.33/0.7 = -0.47

4. Create array graph in format {x, y, slope} for a program code.

CO = {2.3, 0.71, -0.31}

SMOKE = {2.3, 0.54, -0.37}

LPG = {2.3, 0.22, -0.47}

5. Gas concentration (x2) can calculate using formula:

x2 = ( (y2-y1) / slope ) + x1

Gas concentration = 10^( ( (log

_{10}(Rs/Ro)-y1) / slope ) + x1 )

6. Arduino codes

Code: Select all

```
float Graph_CO[3] = {2.3, 0.71, -0.31};
float Graph_Smoke[3] = {2.3, 0.54, -0.37};
float Graph_LPG[3] = {2.3, 0.22, -0.47};
int GetPPM(float RS_RO_Ratio, float *Graph)
{
return (pow(10,(((log10(RS_RO_Ratio)-Graph[1])/Graph[2])+Graph[0])));
}
```

http://exploreembedded.com/wiki/Interfacing_Gas_Sensor

https://github.com/zesteros/ArduinoAirQualityMonitor