Table of Contents
MQ 2
The MQ2 gas sensor was used to determine the concentration of gasses such as LPG (liquid petroleum gas), carbon monoxide, and smoke from 200 to 10000ppm, this is a measurement of concentration of molecules in a volume, for example if we have a concentration of CO2 of 200ppm. Out of one million gas molecules in a volume we can say that 200 are CO2. MQ2 is a metal oxide semiconductor. It detects gasses based on the change of resistance of the sensing material when the gas comes in contact with the material, these are called Chemiresistors. Figure 2.1 MQ2 Sensor Schematics. Source: https://www.mouser.com/datasheet/2/321/605-00008-MQ-2-Datasheet-370464.pdf/}}
Specifications:
Operating Voltage | 5V |
Load resistance | 20kΩ |
Heater resistance | 33Ω ±5% |
Heating consumption | <800mw |
Sensing resistance | 10kΩ -60kΩ |
Concentration Scope | 200-10000ppm |
Preheat Time | Over 24 h |
Structure:
The structure of the sensor is important since we are talking about measuring volatile gasses, and that its done with a heated component, we don't want to ignite the gas, for that reason the covering of the sensor which is a stainless steel mesh prevents that from happening. In addition it prevents large particles from entering and clogging the sensor. The device can both detect a gas but also measure its concentration, for our purposes we want to measure it. Furthermore, as illustrated in Figure 2.2, the actual sensing unit is placed in suspension, this is to make sure the sensor is reading passing air. There are 6 wire connections from the sensing unit. Denominated A,H and B, they are 2 H wires made out of Nickel and Chromium with the purpose of heating the unit,, and 4 A and B wires that are made out of Platinum and are used for the output signals. The base is composed of bakelite which is plastic material that is resistant to high levels of heat and also has very low conductivity properties.
Figure 2.2 MQ2 Sensor, Inside View. Source: https://lastminuteengineers.com/mq2-gas-senser-arduino-tutorial/}}
Figure 2.3 MQ2 Sensing Unit. Source: https://lastminuteengineers.com/mq2-gas-senser-arduino-tutorial/}}
Chemical Reaction:
The sensing unit has two important characteristics. It's base structure is a ceramic composed of Aluminum Oxide (AL2O3), and it's coated with Tin Dioxide (SnO2). This ceramic, when heated, ionizes the surrounding air. The oxygen in the air gets attached to the surface via the electrons present in the Tin Dioxide. The bond created acts as a resistor to the current flow and as the system stabilizes there is going to be a precise voltage output. However when a combustible gas is present, the chemical reaction between that gas and the oxygen molecules attached will allow the free movement of electrons within the sensing unit, thus increasing both current and voltage.
1) The process is well illustrated in Figure 2.4, shown below.
Figure 2.4 Chemical process altering the resistance in the module which causes a change in voltage output. Source: http://lastminuteengineers.com}}
Reading the Data:
The MQ-2 sensor functions as a voltage divider. The analog voltage output varies accordingly with the concentration of combustible gasses and its interaction with the oxygen, thus yielding a higher voltage proportional to the quantity of the present gas. The sensor cannot determine which gas is present, however the interaction with any of the possible measurable gasses creates a distinct pattern that has been provided by the manufacturers, shown in Figure 2.5. By creating a code that follows the guidelines set by the manufacturer design we can then measure with a small margin of error, the concentration of distinct types of gasses in the air simply by analyzing the resistance ratio of the sensor (RS/R0). 2)
- RS is the value given by the resistance change on the sensor due to the presence of a type of combustible gas.
- R0 is the value given or base number of the resistance found on the sensor for fresh air.
- For the MQ-2 sensor the ratio given by the manufacturer of RS/R0 is 9.8.
- Specified in Figure 2.5 and in the specifications of the manufacturer, the sensor can only read gas concentrations between 200 and 10000ppm.
Figure 2.5 MQ2 Sensitivity characteristics. Source: https://www.mouser.com/datasheet/2/321/605-00008-MQ-2-Datasheet-370464.pdf}}
Calculating R0
$$RS = \frac{(Vin - Vout)}{ Vout } $$
Vin is 3.3V
Vout is the voltage reading via the analog pin
$$ \frac{RS}{R0} = 9.8$$ $$R0 = \frac{RS}{ 9.8}$$
We first get the RS value according to the readings from the controller and apply it on the formula above, then using that value we plug it into the second formula thus giving us the R0 value.
Calculating PPM for glasses
Since the graph is in Log values, the relationship between the gas concentration according to the resistance ratio is exponential. However we are going to combine a linear equation with a log scale to get the values needed.
Linear equation
$$ y = mx + b $$
For log scale
$$ log(y) = m \cdot log (x ) + b $$
m = Slope of the line
b = Y intercept
By choosing 2 points in the graph [200, 1.6 & 10000, 0.27] and plugging in the values to find m
$$ m= \left[\frac{log(y)-log(y0)}{log(x)-log(x0)}\right]$$
and after the logarithmic quotient rule:
$$ m= \frac{log\frac{y}{y0}}{log\frac{x}{x0}}$$
Therefore:
$$ m = \frac{log\frac{0.27}{1.6}}{log\frac{10000}{200}}$$
m = -0.473
Once we have the slope we can calculate the y- intercept and this is done using any point the graph, for example [5000, 0.46]
$$log(y) = m \cdot log(x) + b$$
$$b = log(y) - \left[ m\cdot log(x)\right]$$
$$b = log(0.46) - \left[(-0.473) \cdot log(5000) \right]$$
b = 1.413
With both the slope and the y- intercept we can find the GAS CONCENTRATION for any ratio with the formula
$$log(x) = \frac{ log(y) - b }{ m}$$ But to get a real value and not a log value we need
$$ x = 10 ^ \left[\frac{log(y) - b}{ m}\right]$$
Table 1 provides the different m and b values for the different gasses according to the formulas and the graph provided.
Table 1 Table with m and b values for different gassess. MQ-2 Sensor | |||||
---|---|---|---|---|---|
Gas | Value at 200 | Value at 10000 | Value at 5000 | m | b |
H2 | 2.1 | 0.33 | 0.46 | -0.47305447 | 1.412572126 |
LPG | 1.6 | 0.27 | 0.37 | -0.454838059 | 1.25063406 |
Methane | 3 | 0.7 | 0.94 | -0.372003751 | 1.349158571 |
CO | 5.1 | 1.35 | 1.8 | -0.33975668 | 1.512022272 |
Alcohol | 2.8 | 0.65 | 0.85 | -0.373311285 | 1.310286169 |
Smoke | 3.4 | 0.6 | 0.95 | -0.44340257 | 1.617856412 |
Propane | 1.7 | 0.28 | 0.385 | -0.461038681 | 1.290828982 |
The specifications are also available in the interfacing-mq-2-gas-sensor-with-evive.