Blog

MQ-2 Smoke & Combustible Gas Sensor – Complete Guide

Gas & Smoke Sensor

MQ-2 Smoke & Combustible Gas Sensor

Analog Detection for LPG, Smoke, Butane, Propane & Hydrogen

The MQ-2 detects gas using a small tin dioxide (SnO2) sensing element whose electrical conductivity changes when combustible or reducing gas molecules interact with its heated surface. In clean air, the SnO2 layer sits at a relatively low, stable conductivity; when it comes into contact with gases like LPG, methane, or smoke particles, that conductivity rises roughly in proportion to the concentration present, and the module's onboard circuit converts that resistance change into an analog voltage you can read directly. A small heating coil built into the sensor keeps its surface at the correct operating temperature for this reaction to work at all, which is why the MQ-2 needs a warm-up period every time it powers on, and why a full burn-in period of 24-48 hours is recommended before its readings are considered stable and comparable between sessions. It's worth understanding that this is a broad-spectrum sensor: it responds to a whole family of related combustible gases at once rather than identifying which specific gas is present, so it functions best as a general early-warning trigger rather than a precise gas-identifying instrument.

LPG, Smoke, Butane, H2, Propane
Detects
Analog + Digital
Output
20–60s
Preheat Time

Key features

Wide Gas Detection Range

Sensitive to LPG, butane, propane, methane, alcohol, hydrogen, and smoke.

Dual Output

An analog voltage proportional to concentration, plus a digital threshold trigger output.

Adjustable Digital Threshold

An onboard potentiometer sets the trip point for the digital output.

High Sensitivity

Detects gas concentrations across a wide range, roughly 300 to 10,000 ppm.

Long Operating Life

A simple, durable sensing element rated for years of continuous duty.

Low-Cost Gas Screening

An inexpensive first line of detection for hobbyist safety and monitoring projects.

Technical specifications

Supply Voltage 5V DC
Sensing Element SnO2 (tin dioxide)
Detection Range ~300 – 10,000 ppm
Output Analog (AO) + Digital threshold (DO)
Preheat Time 20s initial; 24–48h for full stability
Digital Threshold Adjustable via onboard potentiometer
Operating Current ~150mA (heater draws most of this)
Detects LPG, Propane, Butane, Methane, Hydrogen, Smoke, Alcohol
Package 4-pin module with onboard LM393 comparator

Pinout

PinFunction
VCC 5V power supply
GND Ground
AO Analog output - voltage proportional to gas concentration
DO Digital output - trips when concentration crosses the potentiometer threshold

Applications

Gas leak alarm systems Kitchen smoke/gas detector projects Air quality screening projects Industrial safety monitoring prototypes Greenhouse ventilation triggers Educational combustible-gas demonstrations

What's in the box

1x MQ-2 gas sensor module

Downloads

Datasheet (PDF) Arduino Gas-Alarm Example Sketch
🔌
Pin Connections
1 Table
Pin Connections Table 1
BoardSensor PinConnection
MQ-2VCC/GND/AOUT5V / GND / board analog pin (see per-board note)
📟
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module
7 Examples • C/C++ | Boards: Arduino Uno, Arduino Nano, Arduino Mega, ESP32, ESP8266, STM32, Raspberry Pi Pico
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module - Arduino Uno
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module - Arduino Nano
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module - Arduino Mega
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module - ESP32
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module - ESP8266
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module - STM32
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module - Raspberry Pi Pico
📄 File: mq-2_smoke_lpg_butane_hydrogen_gas_sensor_detector_module_-_arduino_uno.inoArduino Uno
579 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin: A0 on Arduino Uno (ADC range 0-1023, reference 5.0V)
6#define MQ_PIN A0
7
8void setup() {
9 Serial.begin(115200);
10 Serial.println("Warming up sensor (needs ~20-60s to stabilize)...");
11}
12
13void loop() {
14 int raw = analogRead(MQ_PIN);
15 float voltage = raw * 5.0 / 1023.0;
16
17 Serial.print("MQ-2 (smoke/LPG) raw ADC: "); Serial.print(raw);
18 Serial.print(" Voltage: "); Serial.print(voltage);
19 Serial.println(" V (higher = more gas detected; calibrate a clean-air baseline for real ppm)");
20
21 delay(1000);
22}
📄 File: mq-2_smoke_lpg_butane_hydrogen_gas_sensor_detector_module_-_arduino_nano.inoArduino Nano
580 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin: A0 on Arduino Nano (ADC range 0-1023, reference 5.0V)
6#define MQ_PIN A0
7
8void setup() {
9 Serial.begin(115200);
10 Serial.println("Warming up sensor (needs ~20-60s to stabilize)...");
11}
12
13void loop() {
14 int raw = analogRead(MQ_PIN);
15 float voltage = raw * 5.0 / 1023.0;
16
17 Serial.print("MQ-2 (smoke/LPG) raw ADC: "); Serial.print(raw);
18 Serial.print(" Voltage: "); Serial.print(voltage);
19 Serial.println(" V (higher = more gas detected; calibrate a clean-air baseline for real ppm)");
20
21 delay(1000);
22}
📄 File: mq-2_smoke_lpg_butane_hydrogen_gas_sensor_detector_module_-_arduino_mega.inoArduino Mega
580 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin: A0 on Arduino Mega (ADC range 0-1023, reference 5.0V)
6#define MQ_PIN A0
7
8void setup() {
9 Serial.begin(115200);
10 Serial.println("Warming up sensor (needs ~20-60s to stabilize)...");
11}
12
13void loop() {
14 int raw = analogRead(MQ_PIN);
15 float voltage = raw * 5.0 / 1023.0;
16
17 Serial.print("MQ-2 (smoke/LPG) raw ADC: "); Serial.print(raw);
18 Serial.print(" Voltage: "); Serial.print(voltage);
19 Serial.println(" V (higher = more gas detected; calibrate a clean-air baseline for real ppm)");
20
21 delay(1000);
22}
📄 File: mq-2_smoke_lpg_butane_hydrogen_gas_sensor_detector_module_-_esp32.inoESP32
799 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin: 34 on ESP32 (ADC range 0-4095, reference 3.3V)
6// SAFETY: this module can output up to 5V, but ESP32's ADC input max is 3.3V.
7// Power the module from the board's 3.3V pin instead of 5V, OR add a simple
8// resistor voltage divider on the analog output before wiring it in.
9#define MQ_PIN 34
10
11void setup() {
12 Serial.begin(115200);
13 Serial.println("Warming up sensor (needs ~20-60s to stabilize)...");
14}
15
16void loop() {
17 int raw = analogRead(MQ_PIN);
18 float voltage = raw * 3.3 / 4095.0;
19
20 Serial.print("MQ-2 (smoke/LPG) raw ADC: "); Serial.print(raw);
21 Serial.print(" Voltage: "); Serial.print(voltage);
22 Serial.println(" V (higher = more gas detected; calibrate a clean-air baseline for real ppm)");
23
24 delay(1000);
25}
📄 File: mq-2_smoke_lpg_butane_hydrogen_gas_sensor_detector_module_-_esp8266.inoESP8266
803 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin: A0 on ESP8266 (ADC range 0-1023, reference 3.3V)
6// SAFETY: this module can output up to 5V, but ESP8266's ADC input max is 3.3V.
7// Power the module from the board's 3.3V pin instead of 5V, OR add a simple
8// resistor voltage divider on the analog output before wiring it in.
9#define MQ_PIN A0
10
11void setup() {
12 Serial.begin(115200);
13 Serial.println("Warming up sensor (needs ~20-60s to stabilize)...");
14}
15
16void loop() {
17 int raw = analogRead(MQ_PIN);
18 float voltage = raw * 3.3 / 1023.0;
19
20 Serial.print("MQ-2 (smoke/LPG) raw ADC: "); Serial.print(raw);
21 Serial.print(" Voltage: "); Serial.print(voltage);
22 Serial.println(" V (higher = more gas detected; calibrate a clean-air baseline for real ppm)");
23
24 delay(1000);
25}
📄 File: mq-2_smoke_lpg_butane_hydrogen_gas_sensor_detector_module_-_stm32.inoSTM32
801 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin: PA0 on STM32 (ADC range 0-4095, reference 3.3V)
6// SAFETY: this module can output up to 5V, but STM32's ADC input max is 3.3V.
7// Power the module from the board's 3.3V pin instead of 5V, OR add a simple
8// resistor voltage divider on the analog output before wiring it in.
9#define MQ_PIN PA0
10
11void setup() {
12 Serial.begin(115200);
13 Serial.println("Warming up sensor (needs ~20-60s to stabilize)...");
14}
15
16void loop() {
17 int raw = analogRead(MQ_PIN);
18 float voltage = raw * 3.3 / 4095.0;
19
20 Serial.print("MQ-2 (smoke/LPG) raw ADC: "); Serial.print(raw);
21 Serial.print(" Voltage: "); Serial.print(voltage);
22 Serial.println(" V (higher = more gas detected; calibrate a clean-air baseline for real ppm)");
23
24 delay(1000);
25}
📄 File: mq-2_smoke_lpg_butane_hydrogen_gas_sensor_detector_module_-_raspberry_pi_pico.inoRaspberry Pi Pico
823 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin: 26 on Raspberry Pi Pico (ADC range 0-4095, reference 3.3V)
6// SAFETY: this module can output up to 5V, but Raspberry Pi Pico's ADC input max is 3.3V.
7// Power the module from the board's 3.3V pin instead of 5V, OR add a simple
8// resistor voltage divider on the analog output before wiring it in.
9#define MQ_PIN 26
10
11void setup() {
12 Serial.begin(115200);
13 Serial.println("Warming up sensor (needs ~20-60s to stabilize)...");
14}
15
16void loop() {
17 int raw = analogRead(MQ_PIN);
18 float voltage = raw * 3.3 / 4095.0;
19
20 Serial.print("MQ-2 (smoke/LPG) raw ADC: "); Serial.print(raw);
21 Serial.print(" Voltage: "); Serial.print(voltage);
22 Serial.println(" V (higher = more gas detected; calibrate a clean-air baseline for real ppm)");
23
24 delay(1000);
25}
Analog gas sensor - reads a voltage proportional to smoke/LPG/butane/hydrogen concentration. Needs ~20-60s warm-up for a stable baseline.
Important: the MQ-2 is a hobbyist screening sensor, not a certified safety device - never rely on it as your only protection against a real gas leak or fire risk; use it for learning, monitoring, and early-warning projects, not as a substitute for certified detectors in a home or workplace. Technically, give it at least 20-60 seconds to warm up after every power-on before trusting a reading, and understand that its raw analog output is relative, not an absolute ppm value out of the box - take a baseline reading in known clean air first, since that baseline is what meaningful gas-concentration comparisons are measured against.