Methane and natural gas leaks pose serious safety risks in residential, commercial, and industrial environments, making reliable gas detection an essential part of modern safety systems. The MQ-4 methane gas sensor is widely used for this purpose. This article will discuss the MQ-4 gas sensor’s definition, working principle, pinout, internal structure, sensitivity characteristics, and more.

The MQ-4 gas sensor is a semiconductor-based sensing device designed to detect methane (CH₄) and natural gas in the surrounding environment. It is commonly used in gas leak detection systems, safety alarms, and monitoring applications for homes, commercial buildings, and industrial settings. The sensor uses a gas-sensitive material that reacts when exposed to combustible gases, allowing changes in gas concentration to be converted into an electrical signal.
One of the main reasons the MQ-4 is widely adopted is its balance of high methane sensitivity, stable performance, and low cost. It is available as a bare sensor or as a complete module with supporting circuitry, making it suitable for both professional system designs and beginner-friendly projects. Its simple operating requirements and long service life make it a practical choice for continuous gas monitoring applications.
The working principle of the MQ-4 gas sensor is based on the change in electrical resistance of its sensing material when methane gas is present. Inside the sensor, a built-in heater raises the temperature of the tin dioxide (SnO₂) sensing layer to the proper operating range. In clean air, oxygen molecules attach to the surface of the sensing material and capture free electrons, which increases the sensor’s resistance.
When methane enters the sensor, it reacts with the absorbed oxygen on the heated surface. This reaction releases the trapped electrons back into the sensing layer, causing the resistance to decrease. The change in resistance is directly related to the gas concentration. By using an external load resistor, this resistance change is converted into a measurable voltage output. This output can be read by microcontrollers or monitoring circuits to detect methane presence and trigger alarms or control actions when gas levels exceed safe limits.

| Pin Label | Pin Type | Description |
| H | Heater | Heater pins used to heat the sensing element. These pins must be powered to activate the sensor. |
| H | Heater | Second heater pin (both H pins are internally connected to the heater coil). |
| A | Signal Electrode | One side of the sensing resistor output. Used to measure resistance change due to methane gas. |
| A | Signal Electrode | Duplicate electrode connected internally (either A pin can be used). |
| B | Signal Electrode | Other side of the sensing resistor output. Works with A pins to form the sensing circuit. |
| B | Signal Electrode | Duplicate electrode connected internally (either B pin can be used). |

| Pin Name | Pin Type | Description |
| VCC | Power | Supplies 5 V power to the sensor module and heater circuit. |
| GND | Ground | Common ground connection for the module. |
| DO | Digital Output | Outputs HIGH or LOW based on a preset gas threshold (adjustable via onboard potentiometer). |
| AO | Analog Output | Outputs a variable voltage proportional to the detected methane concentration. |
• MQ-2
• MQ-3
• MQ-4
• MQ-5
• MQ-6
• MQ-7
• MQ-8
• MQ-9
• MQ-131
• MQ-135
• MQ-136
• MQ-137
• MQ-138
• MQ-214
• MQ-216
• MQ-303A
• MQ-306A

The image illustrates the internal construction of the MQ-4 gas sensor and the materials used in each component. It shows the gas-sensing layer made of tin dioxide (SnO₂), which changes resistance when exposed to methane. The heater coil, typically made from a nickel-chromium alloy, provides the required operating temperature for proper sensing. Other parts such as the ceramic tube, electrodes, anti-explosion mesh, and resin base support stable operation, safety, and durability, helping the sensor maintain reliable performance over long periods.

• MQ-4 Gas Sensor Element – Detects methane and natural gas through resistance changes
• Voltage Comparator IC – Converts analog signal into a digital output
• Sensitivity Adjustment Potentiometer – Sets the gas detection threshold
• Power LED – Indicates the module is powered on
• Output LED – Shows digital output status when gas is detected
• Analog Output (AO) – Provides variable voltage based on gas concentration
• Digital Output (DO) – Outputs HIGH/LOW signal when threshold is reached
• VCC Pin – Supplies power to the module
• GND Pin – Ground connection for the circuit
• PCB Mounting Holes – Allows secure installation on enclosures or boards
The MQ-4 gas sensor internal connection diagram explains how the sensor is powered and how its output signal is generated. Inside the sensor, a built-in heater coil is connected to the H–H terminals and supplied with a stable 5 V AC or DC voltage. This heater raises the temperature of the sensing material, allowing it to react properly when methane or natural gas is present.

The diagram also shows two identical sensing electrodes labeled A and B. These electrodes are connected to the gas-sensitive layer, whose resistance changes as the gas concentration varies. An external load resistor (RL) is connected in series with the sensing element to form a voltage divider.
The output voltage (Vout) is taken across the load resistor. As methane concentration increases, the resistance of the sensing element changes, causing a corresponding change in Vout. This varying voltage is what microcontrollers or analog circuits read to detect and measure methane gas levels.
The MQ-4 Sensitivity Characteristic Curve shows how the sensor responds to different gases by plotting the ratio of sensor resistance (Rs/Ro) against gas concentration measured in parts per million (ppm). The graph uses a logarithmic scale on both axes, which helps illustrate how the sensor behaves across a wide range of gas concentrations. Each line represents a different gas, allowing easy comparison of the sensor’s sensitivity to methane versus other gases.

From the curve, methane (CH₄) produces a more noticeable change in resistance compared to many other gases, confirming that the MQ-4 is optimized for methane detection. As methane concentration increases, the Rs/Ro value decreases, indicating higher sensor conductivity. Other gases such as LPG, hydrogen, alcohol, and smoke also affect the sensor, but with different slopes, showing lower sensitivity or cross-sensitivity.
The air-line remains relatively stable, serving as a reference baseline (Ro). This curve is mainly used for calibration and gas concentration estimation, helping designers understand how the MQ-4 distinguishes methane from other gases under real operating conditions.
| Category | Parameter | Symbol | Specification | Remarks |
| Electrical | Circuit Voltage | Vc | 5 V ±0.1 V | AC or DC |
| Heater Voltage | Vh | 5 V ±0.1 V | AC or DC | |
| Load Resistance | RL | 20 kΩ | Recommended | |
| Heater Resistance | RH | 33 Ω ±5% | Room temperature | |
| Heater Power Consumption | PH | < 750 mW | — | |
| Environmental | Operating Temperature | Tao | −10°C to 50°C | — |
| Storage Temperature | Tas | −20°C to 70°C | — | |
| Relative Humidity | RH | < 95% RH | Non-condensing | |
| Oxygen Concentration | O₂ | 21% (standard) | Minimum > 2%; affects sensitivity | |
| Sensitivity | Sensing Resistance | Rs | 10 kΩ – 60 kΩ (1000 ppm CH₄) | — |
| Concentration Slope Rate | α | ≤ 0.6 (1000–5000 ppm CH₄) | — | |
| Detection Range | — | 200 – 10,000 ppm | Methane, natural gas | |
| Test Conditions | Standard Test Conditions | — | 20°C ±2°C, 65% ±5% RH | Vc = 5 V, Vh = 5 V |
| Usage | Preheat Time | — | ≥ 24 hours | Initial use |
• High Sensitivity to Methane (CH₄) – Optimized for detecting methane and natural gas leaks.
• Low Sensitivity to Alcohol and Smoke – Reduces false triggering from common household vapors.
• Wide Detection Range – Supports methane concentrations from 200 to 10,000 ppm.
• Fast Response Time – Quickly reacts to changes in gas concentration.
• Good Recovery Characteristics – Returns to baseline resistance after gas removal.
• Stable Output Performance – Provides consistent readings under normal conditions.
• Long Operating Life – Designed for extended continuous operation.
• Simple Drive Circuit – Requires minimal external components for operation.
• Analog Output Signal – Easy to interface with microcontrollers and ADCs.
• Built-in Heating Element – Ensures proper sensor activation and sensitivity.
• Low Cost Solution – Suitable for low-budget and mass-production projects.
• Compact and Robust Design – Easy to integrate into various gas-sensing systems.
• Methane gas leak detection systems
• Natural gas monitoring in homes and buildings
• Gas leakage alarms for kitchens and pipelines
• Industrial safety and gas monitoring systems
• Gas detection in mining environments
• Combustible gas detection equipment
• Environmental gas monitoring projects
• Smart home gas safety systems
• IoT-based gas detection and alert systems

The MQ-4 methane gas sensor’s resistance-based sensing principle, combined with a built-in heater and simple output circuitry, allows accurate gas detection when properly powered and calibrated. By understanding its pin configuration, internal structure, sensitivity curve, and operating conditions, you can design safer and more reliable gas monitoring systems. Whether used in standalone alarms, microcontroller-based projects, or industrial safety equipment, the MQ-4 remains a dependable choice for continuous methane detection when applied according to its specifications and best practices.