MQ2 Gas Sensor Pinout

The MQ2 is an analog gas sensor by Hanwei Electronics that detects flammable gases and smoke by measuring changes in electrical resistance across a heated tin dioxide element. It outputs both an analog voltage proportional to gas concentration and a digital threshold signal, making it straightforward to wire into any microcontroller project without needing a dedicated library. It is widely used in home gas leak detectors, fire alarm systems, industrial safety equipment, and ventilation controllers.

What is MQ2?

MQ2 sensor

The MQ2 is suitable for detecting LPG, iso-butane, propane, methane, alcohol, hydrogen, and smoke. It belongs to the MQ series of metal oxide semiconductor gas sensors — a family that covers everything from carbon monoxide to ammonia — with each member tuned to a different target gas profile through its sensing layer chemistry and heater temperature.

The MQ2 is not a precision instrument. It does not tell you exactly which gas is present, and it does not output concentration in ppm directly. What it gives you is a resistance shift that correlates to gas concentration — useful for detecting the presence of a gas, triggering alarms, and monitoring concentration trends. For applications that need to distinguish between specific gases or measure absolute concentrations accurately, a more specialised sensor is needed.

MQ2 Overview

ParameterValue
Sensor TypeMetal Oxide Semiconductor (MOS) Gas Sensor
Circuit Voltage (VC)5V ±0.1
Heater Voltage (VH)5V ±0.1
Heater Resistance33Ω ±5%
Heater Power Consumption<800mW
Sensing Resistance (RS)3kΩ – 30kΩ (at 1000ppm isobutane)
Output TypeAnalog (AO) + Digital (DO)
Detectable GasesLPG, propane, butane, methane, H₂, alcohol, smoke
Operating Temperature−20°C to +50°C
CommunicationAnalog Voltage / Digital Threshold
Mounting TypeThrough Hole (6-pin bare sensor)
Compatible BoardsArduino Uno, ESP32, Raspberry Pi

Pinout

MQ2 pinout

Breakout Module Pinout (4-pin)

PinTypeDescription
VCCPowerModule supply — 5V
GNDPowerGround
AOOutputAnalog output — voltage proportional to gas concentration (0V to 5V)
DOOutputDigital output — LOW when gas exceeds threshold, HIGH otherwise

Note: The threshold for the DO pin is set by a built-in potentiometer on the module. Turning it adjusts the concentration level at which DO switches from HIGH to LOW. AO and DO can be used simultaneously.

Working principle

The MQ2 sensor is composed of a micro Al₂O₃ ceramic tube with a tin dioxide (SnO₂) sensitive layer, measuring electrodes, and a heater coil, all fixed into a crust made of plastic and stainless steel mesh.

SnO₂ is a semiconductor whose electrical resistance drops when it adsorbs flammable or reducing gas molecules on its surface. The heater coil raises the sensing layer to its optimal operating temperature — typically around 200–300°C — which is necessary for the adsorption reaction to occur at a useful rate.

The resistance change is read through a simple voltage divider circuit using a load resistor (RL):

VOUT = VC × RL / (RS + RL)

As gas concentration increases, RS decreases, and VOUT rises. The microcontroller reads this rising voltage on the AO pin and correlates it to gas concentration. The DO pin uses an onboard LM393 comparator to convert the same signal into a HIGH/LOW threshold output.

The MQ2’s sensing resistance is different for various gases and concentrations, so sensitivity adjustment is necessary. Calibration against 1000ppm LPG or iso-butane with a load resistance of approximately 20kΩ is recommended.

Detection ranges per gas:

GasDetection Range
LPG / Propane200 – 5000 ppm
Butane300 – 5000 ppm
Methane (CH₄)5000 – 20000 ppm
Hydrogen (H₂)300 – 5000 ppm
Alcohol100 – 2000 ppm

Warm-up requirement: When first used after a long period of storage (a month or more), the sensor must be warmed up for 24–48 hours for maximum accuracy. If recently used, 5–10 minutes is sufficient. During warm-up, the sensor typically reads high and gradually decreases until it stabilises.

Hardware overview

The MQ2 breakout module adds signal conditioning and interface components around the bare sensor element.

MQ2 Sensor Element The domed metal cap with a stainless steel mesh at the top. The mesh is a 100-mesh SUS316 stainless steel gauze that acts as an anti-explosion network — it allows gas to diffuse into the sensing chamber while preventing any ignition from the internal heater from propagating outward. The SnO₂ sensing layer and Ni-Cr heater coil are inside.

LM393 Voltage Comparator Converts the analog signal from the sensor into a digital output. It compares the sensor’s voltage against the reference threshold set by the potentiometer and outputs a HIGH or LOW signal on the DO pin accordingly.

Sensitivity Adjustment Potentiometer A trimmer resistor that sets the reference voltage for the LM393 comparator, which directly controls the gas concentration level at which DO switches state. Turning it clockwise increases sensitivity; counter-clockwise decreases it.

Power LED Illuminates when 5V is applied to VCC, confirming the module is powered and the heater is active.

Threshold LED Turns on when the DO pin triggers — indicating the gas concentration has crossed the threshold set by the potentiometer. Useful for quick visual confirmation without needing a microcontroller connected.

Decoupling Capacitors Filter high-frequency noise on the supply rail. The heater draws up to 150mA continuously — a significant load that can cause voltage dips on the 5V rail and introduce noise into the analog output without proper decoupling.

Specifications

The detailed specifications of the MQ2 sensor are listed below.

ParameterValue
Circuit Voltage (VC)5V ±0.1
Heater Voltage (VH)5V ±0.1
Heater Resistance33Ω ±5% (at room temperature)
Heater Power Consumption<800mW
Heater Current~150mA (typical)
Sensing Resistance (RS)3kΩ – 30kΩ (at 1000ppm isobutane)
Concentration Slope Rate (α)≤0.6 (3000/1000ppm isobutane)
LPG / Propane Range200 – 5000 ppm
Butane Range300 – 5000 ppm
Methane Range5000 – 20000 ppm
Hydrogen Range300 – 5000 ppm
Alcohol Range100 – 2000 ppm
Preheat Time (first use)24 – 48 hours
Preheat Time (reuse)5 – 10 minutes
Analog Output (AO)0V – 5V
Digital Output (DO)LOW = gas detected, HIGH = clear
DO ThresholdAdjustable via onboard potentiometer
Comparator ICLM393
Operating Temperature−20°C to +50°C
Storage Temperature−20°C to +70°C
Operating Humidity<95% RH (non-condensing)
Oxygen DependencyMinimum O₂ concentration >2%
Recommended RL20kΩ (5kΩ – 47kΩ range)
Module Supply5V DC
Sensor Package6-pin through hole (TO-5 metal can)

Helpful resources

Leave a Comment