MQ-9 Carbon Monoxide, Methane, and LPG Gas Sensor Interfacing
with Arduino, Node MCU and ESP32
Working principle of Oxide based gas sensors: Tin oxide SnO2-based gas sensors have been widely used for detecting typical fault characteristic gases extracted from power transformer oil, namely, H2, CO, CO2, CH4, C2H2, C2H4, and C2H6, due to the remarkable advantages of high sensitivity, fast response, long-term stability, and so on.
Gas sensing layer: It is the main component in the sensor which can be used to sense the variation in the concentration of the gases and generate the change in electrical resistance. The gas sensing layer is basically a chemiresistor which changes its resistance value based on the concentration of particular gas in the environment. Here the sensing element is made up of a Tin Dioxide (SnO2) which is, in general, has excess electrons (donor element). So whenever toxic gases are being detected the resistance of the element changes and the current flows through it varies which represents the change in concentration of the gases.
Heater coil: The purpose of the heater coil is to burn-in the sensing element so that the sensitivity and efficiency of the sensing element increases. It is made of Nickel-Chromium which has a high melting point so that it can stay heated up without getting melted.
Electrode line: As the sensing element produces a very small current when the gas is detected it is more important to maintain the efficiency of carrying those small currents. So Platinum wires come into play where it helps in moving the electrons efficiently.
Electrode: It is a junction where the output of the sensing layer is connected to the Electrode line. So that the output current can flow to the required terminal. An electrode here is made of Gold (Au –Aurum) which is a very good conductor.
Tubular ceramic: In between the Heater coil and Gas sensing layer, the tubular ceramic exists which is made of Aluminum oxide (Al2O3). As it has high melting point, it helps in maintaining the burn-in (preheating) of the sensing layer which gives the high sensitivity for the sensing layer to get efficient output current.
Mesh over the sensing element: In order to protect the sensing elements and the setup, a metal mesh is used over it, which is also used to avoid/hold the dust particles entering into the mesh and prevent damaging the gas sensing layer from corrosive particles.
The MQ-9 Gas Sensor can detect Carbon Monoxide, Methane, and LPG. MQ name is from Metal Oxide Semiconductor (MOS) type Gas Sensor. It is also known as Chemiresistor since the detection is dependent on a change in the sensing material’s resistance when the Gas comes into contact with it.
Let us look at the Pin configuration of MQ-9 gas sensor and connection to Arduino:
VCC and GND of the sensor are connected to 5volt DC and ground of Arduino board.
Digital OUT of the Sensor is connected to any Digital Pin of Arduino say Pin 7.
Analog OUT of the Sensor may be connected to any Analog Pin of Arduino A0 to A5 let us say A0 Pin.
Apart from the above we need two LEDs and one buzzer to be connected to Arduino. Green LED is used as a power on indicator. When the gas threshold is reached or exceeded by the sensor then the Dout will trigger the Arduino Digital input and that switches the Red LED ON until the gas level comes below the threshold value. The buzzer also sounds whenever the threshold is reached or exceeded. Green LED is connected tp Pin 2, Red LED to Pin 3 and Buzzer to Pin 4. All the 3 circuits are connected through 220 ohms current limiting resistors and connected to ground circuit of Arduino.
Let us look at the Pin configuration of MQ-9 gas sensor and connection to Node MCU:
VCC and GND of the sensor are connected to 3.3volt DC and ground of Node MCU board.
Digital OUT of the Sensor is connected to any Digital Pin of Node MCU say Pin GPIO7.
Analog OUT of the Sensor may be connected to any Analog Pin of Node MCU ADC0.
Apart from the above we need two LEDs and one buzzer to be connected to Arduino. Green LED is used as a power on indicator. When the gas threshold is reached or exceeded by the sensor then the Dout will trigger the Arduino Digital input and that switches the Red LED ON until the gas level comes below the threshold value. The buzzer also sounds whenever the threshold is reached or exceeded. Green LED is connected tp Pin GPIO2, Red LED to Pin GPIO3 and Buzzer to Pin GPIO4. All the 3 circuits are connected through 220 ohms current limiting resistors and connected to ground circuit of Node MCU.
Let us look at the Pin configuration of MQ-9 gas sensor and connection to ESP32:
VCC and GND of the sensor are connected to 3.3volt DC and ground of ESP32 board.
Digital OUT of the Sensor is connected to any Digital Pin of ESP32 say Pin GPIO7.
Analog OUT of the Sensor may be connected to any Analog Pin of ESP32 ADC0.
Apart from the above we need two LEDs and one buzzer to be connected to ESP32. Green LED is used as a power on indicator. When the gas threshold is reached or exceeded by the sensor then the Dout will trigger the ESP32 Digital input and that switches the Red LED ON until the gas level comes below the threshold value. The buzzer also sounds whenever the threshold is reached or exceeded. Green LED is connected to Pin GPIO2, Red LED to Pin GPIO3 and Buzzer to Pin GPIO4. All the 3 circuits are connected through 220 ohms current limiting resistors and connected to ground circuit of Arduino.