The MQ-2 gas sensor is widely used because of its ability to detect multiple flammable gases and smoke using a simple operating principle and minimal external circuitry. This article will discuss the MQ-2 gas sensor’s working principle, pin configuration, internal structure, hardware components, specifications, and more.

The MQ-2 gas sensor is a low-cost device used to detect flammable gases and smoke in the air. It is commonly applied in gas leakage alarms, fire detection systems, and microcontroller-based projects due to its simple design and wide availability. The sensor responds to gases such as LPG, methane, propane, hydrogen, alcohol vapor, carbon monoxide, and smoke, making it suitable for general gas and safety monitoring.
Most MQ-2 sensor modules provide both analog and digital outputs. The analog output indicates relative gas concentration, while the digital output triggers when gas levels exceed a preset threshold. A short preheating period is required to ensure stable and reliable readings.
The MQ-2 operates using a metal-oxide semiconductor (MOS) sensing mechanism. Its sensing element is made of tin dioxide (SnO₂) deposited on an aluminum-oxide ceramic substrate and heated by an internal heater. In clean air, oxygen molecules are adsorbed on the heated SnO₂ surface, capturing free electrons and increasing the sensor’s resistance.
When combustible or reducing gases are present, they react with the adsorbed oxygen and release the trapped electrons back into the sensing material. This reduces the sensor’s resistance and increases current flow, producing a measurable rise in output voltage. These voltage changes allow external circuits to detect gas presence and estimate relative gas concentration.

| Pin Label | Pin Name | Description |
| H | Heater Pin 1 | Supplies power to the internal heater element |
| H | Heater Pin 2 | Heater return pin |
| A | Electrode A | Sensing electrode (connected internally) |
| A | Electrode A | Duplicate sensing electrode |
| B | Electrode B | Output electrode (connected internally) |
| B | Electrode B | Duplicate output electrode |
| Pin No. | Pin Name | Description |
| 1 | VCC (+5V) | Power supply input |
| 2 | GND | Ground |
| 3 | DOUT | Digital output (threshold-based) |
| 4 | AOUT | Analog output (gas concentration level) |

• Clamp Ring- The clamp ring secures the metal mesh and internal parts of the sensor. It keeps the structure stable and ensures all components stay aligned during operation.
• Anti-Explosion Network (Metal Mesh) - This stainless-steel mesh prevents sparks inside the sensor from igniting flammable gases outside. It also works as a protective filter against dust and debris.
• Connecting Legs (Pins) - The pins provide electrical connections between the MQ-2 sensor and the external circuit. They include heater pins (H) and signal pins (A and B) for gas sensing output.
• Sensing Element - The sensing element is the core of the MQ-2 sensor. It changes electrical resistance when exposed to gases such as LPG, methane, or smoke, enabling gas detection.
• Aluminum Oxide (Al₂O₃) Based Ceramic - This ceramic tube supports the sensing element and heater. It offers excellent electrical insulation and can withstand high temperatures during operation.
• Tin Dioxide (SnO₂) Coating - The SnO₂ layer is the gas-sensitive material. When gas molecules interact with this coating, its conductivity changes, which the sensor converts into an electrical signal.
• Nickel-Chromium Heating Coil - The heating coil raises the temperature of the sensing element to its optimal working range. Proper heating is essential for accurate and stable gas detection.
• Platinum Wires - Platinum wires connect the sensing layer and heater to the external pins. Platinum is used because it is highly stable and resistant to heat and corrosion.

This is the main sensor that detects gases such as LPG, methane, hydrogen, and smoke. It changes resistance when gas is present, which the module converts into output signals.
This small adjustable knob lets you set how sensitive the sensor is to gas. Turning it changes the gas threshold level for the digital output.
The LM393 compares the sensor signal with the set threshold from the potentiometer. When the gas level exceeds the set limit, it triggers the digital output.
This LED turns on when the module is properly powered. It simply shows that voltage is supplied to the board.
This LED lights up when the gas concentration crosses the preset threshold. It gives a quick visual alert without needing a microcontroller.
The analog pin outputs a continuous voltage that changes based on gas concentration. It is useful for measuring relative gas levels.
The digital pin outputs HIGH or LOW depending on whether the gas level is above the set threshold. It is commonly used for alarms and simple detection.
Supplies power to the module, typically 5V. This powers both the heater and the onboard electronics.
Provides the ground reference for the module and must be connected to the system ground.