MQ2 Gas Sensor Module – Smoke & Flammable Gas Detection
1. What Is an MQ2 Gas Sensor Module?
The MQ2 Gas Sensor Module is an electronic gas detection module designed to respond to smoke and various combustible gases in the surrounding environment.
It uses an MQ-2 semiconductor sensing element that changes its electrical resistance when exposed to certain gases.
The module provides analog and digital outputs, allowing microcontrollers to monitor changes in the sensor response and detect when a selected threshold is exceeded.
It is commonly used in Arduino, ESP32, IoT, robotics and educational electronics projects.
2. What Can You Build With an MQ2 Gas Sensor Module?
The MQ2 Gas Sensor Module is suitable for experimental applications such as:
- LPG gas leakage detection prototypes
- Smoke detection alarm projects
- IoT gas monitoring systems
- Smart kitchen monitoring prototypes
- Gas detection robots
- Wireless gas monitoring projects
- Gas-triggered LED indicators
- Environmental monitoring experiments
- School and engineering projects
- Smart home automation prototypes
This module is intended for experimentation and should not be used as the sole safety device in residential, commercial or industrial environments.
3. Who Is It For?
The MQ2 Gas Sensor Module is suitable for:
- Beginners learning electronics
- School and engineering students
- Arduino and ESP32 enthusiasts
- Robotics hobbyists
- IoT project developers
- STEM educators and trainers
- DIY electronics makers
4. How Does an MQ2 Gas Sensor Work?
The MQ-2 sensor uses a heated tin dioxide (SnO₂) semiconductor sensing material.
Its electrical conductivity changes when exposed to certain combustible gases and smoke. The module converts this resistance change into an electrical signal that can be read by a microcontroller.
Analog Output (AO)
The analog output provides a variable voltage related to the sensor’s response to its surrounding environment.
Digital Output (DO)
The digital output changes state when the sensor signal crosses the threshold configured using the onboard potentiometer.
Working principle:
Gas or Smoke Exposure → Change in Sensor Resistance → Signal Processing → Analog or Digital Output → Microcontroller → Action
The sensor responds to multiple gases and cannot independently identify which specific gas is present.
5. Technical Specifications
| Specification | Details |
|---|---|
| Product Type | Gas Detection Sensor Module |
| Sensor Model | MQ-2 |
| Sensing Technology | Heated semiconductor |
| Sensing Material | Tin dioxide (SnO₂) |
| Operating Supply | Typically 5V DC |
| Reference Detection Range | 300–10,000 ppm for combustible gases |
| Detectable Substances | LPG, propane, methane, hydrogen and smoke |
| Output Type | Analog and Digital |
| Analog Output | AO |
| Digital Output | DO |
| Detection Threshold | Adjustable |
| Number of Pins | 4 |
| PCB Colour | Blue |
| PCB Marking | Flying-Fish |
| Mounting Holes | 4 |
| Reference Heater Consumption | Up to 950mW |
| Application | Gas and smoke detection experiments |
The detection range and heater consumption are reference specifications from standard MQ-2 sensor documentation. Actual module characteristics may vary by manufacturer.
Preheating requirements:
The MQ-2 sensing element requires preheating and stabilisation before reliable measurements can be obtained. Standard manufacturer testing specifies an initial preconditioning period of at least 48 hours.
Additional warm-up time may be required after each power cycle.
Reference datasheet: MQ-2 Gas Sensor – Winsen Electronics
6. MQ2 Gas Sensor Module Pinout
The standard MQ2 Gas Sensor Module features four connection pins.
| Pin | Function |
|---|---|
| VCC | 5V power supply |
| GND | Ground |
| AO | Analog sensor output |
| DO | Digital threshold-based output |
AO can be used to observe changes in the sensor response, while DO provides a threshold-based HIGH or LOW signal.
Always follow the pin labels printed on the actual PCB, as the physical pin sequence may vary between manufacturers.
7. How to Connect an MQ2 Gas Sensor to Arduino
The MQ2 Gas Sensor Module can be connected to an Arduino Uno using its analog and digital output pins.
Required components:
- MQ2 Gas Sensor Module
- Arduino Uno
- Regulated 5V power supply with sufficient current capacity
- Jumper wires
- Breadboard
Wiring connections:
| MQ2 Gas Sensor | Arduino / Power Supply |
|---|---|
| VCC | Regulated 5V supply |
| GND | Common GND |
| AO | Analog Pin A0 |
| DO | Digital Pin D2 |
The MQ-2 sensor contains a heating element that requires considerably more current than many other sensor modules.
Do not power the sensor directly from an Arduino GPIO pin.
When using an external power supply, connect its ground to Arduino GND.
8. Arduino Example Code
The following program reads both the analog and digital outputs of the MQ2 Gas Sensor Module.
const int gasAnalogPin = A0;
const int gasDigitalPin = 2;
void setup() {
pinMode(gasDigitalPin, INPUT);
Serial.begin(9600);
}
void loop() {
int analogValue = analogRead(gasAnalogPin);
int digitalValue = digitalRead(gasDigitalPin);
Serial.print("Gas Sensor Reading: ");
Serial.print(analogValue);
Serial.print(" | Digital Output: ");
Serial.println(digitalValue);
delay(500);
}
How to use the program:
- Connect the MQ2 Gas Sensor Module to Arduino.
- Supply the module with suitable regulated power.
- Allow the sensor to preheat and stabilise.
- Upload the program using Arduino IDE.
- Open the Serial Monitor at 9600 baud.
- Observe the analog and digital readings.
The analog reading is a raw ADC value, not a direct measurement of gas concentration in ppm.
Accurate concentration estimation requires appropriate calibration, known reference conditions and gas-specific response data.
9. Beginner Project: MQ2 Gas Detection Alert Prototype
Build an educational gas detection indicator using an MQ2 Gas Sensor Module and Arduino.
Components required:
- 1 × MQ2 Gas Sensor Module
- 1 × Arduino Uno
- 1 × Red LED
- 1 × 330Ω resistor
- Regulated 5V power supply
- Breadboard
- Jumper wires
Wiring connections:
- MQ2 VCC → Regulated 5V supply
- MQ2 GND → Common GND
- MQ2 AO → Arduino A0
- LED anode → Arduino D8 through a 330Ω resistor
- LED cathode → GND
Example code:
const int gasPin = A0;
const int ledPin = 8;
// Example threshold for demonstration only
const int threshold = 400;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int gasValue = analogRead(gasPin);
Serial.println(gasValue);
if (gasValue > threshold) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
delay(200);
}
When the analog sensor reading exceeds the programmed threshold, the Arduino turns on the LED.
The threshold of 400 is an illustrative programming value, not a verified hazardous gas concentration or safety limit.
For an additional learning exercise, a 5V Passive Buzzer with a suitable driver circuit can be added to generate audible notifications.
This project teaches analog inputs, sensor calibration, conditional programming and electronic indicators.
Do not deliberately release LPG or other combustible gases to test the project. Use simulated sensor readings for classroom demonstrations.
10. Related Products
Complete your electronics project with:
- Arduino Uno R3 Compatible Programmable Board
- ESP32 Development Board
- Flame Sensor Module
- Water Level Sensor Module
- SW-420 Vibration Sensor Module
- 4 Pin Sound Sensor Module
- 5V Passive Buzzer
- RGB LED Module
- TM1637 4-Digit Display Module
- 5mm RGB LED
- Breadboard
- Jumper Wires
11. Related Tutorials
Explore these electronics learning topics:
- How to Use an MQ2 Gas Sensor Module with Arduino
- How to Connect an MQ2 Gas Sensor to ESP32
- Understanding Analog and Digital Gas Sensor Outputs
- How to Build an Arduino Gas Detection Alert Prototype
- MQ2 Gas Sensor Calibration Explained
- How Semiconductor Gas Sensors Work
- How to Build an IoT Gas Monitoring Prototype
- Understanding MQ Series Gas Sensors
12. Frequently Asked Questions
What is an MQ2 Gas Sensor Module?
The MQ2 Gas Sensor Module is a semiconductor-based electronic sensor used to detect the presence of smoke and various combustible gases.
Which gases can the MQ2 sensor detect?
The MQ-2 responds to gases such as LPG, propane, methane and hydrogen, as well as smoke. It is sensitive to multiple substances and cannot reliably distinguish between individual gases.
Can the MQ2 sensor detect LPG leakage?
It can respond to LPG and is suitable for educational leakage detection prototypes. It should not replace a certified LPG gas detector.
Can the MQ2 Gas Sensor Module detect smoke?
Yes. The MQ-2 is sensitive to smoke and can be used in experimental smoke detection projects.
What is the operating voltage of the MQ2 module?
Standard MQ2 Gas Sensor Modules typically require a regulated 5V power supply.
Does the MQ2 sensor require preheating?
Yes. Its internal heating element must reach stable operating conditions. Initial preconditioning and subsequent warm-up are necessary for consistent readings.
What is the difference between AO and DO?
AO provides a variable analog signal related to the sensor response. DO provides a digital signal based on an adjustable detection threshold.
Can I use the MQ2 Gas Sensor with ESP32?
Yes, with a suitable 5V power supply and appropriate voltage-level conversion. The module’s outputs must remain within the ESP32’s GPIO and ADC voltage limits.
Can the MQ2 sensor measure gas concentration in ppm?
It can be used to estimate concentration under suitable calibrated conditions. Raw analog readings do not directly represent ppm.
Why does the MQ2 sensor become warm?
The sensor contains a heating element required for its semiconductor sensing operation. Warming during operation is normal.
Can the MQ2 sensor detect carbon dioxide?
The MQ2 is not designed for accurate CO₂ measurement. Use a dedicated CO₂ sensor for that purpose.
Can I use the MQ2 sensor as a permanent household gas alarm?
No. This development module is intended for educational and experimental projects. Use a properly certified gas alarm for household safety.
Where can I buy an MQ2 Gas Sensor Module in Surat?
You can purchase the MQ2 Gas Sensor Module online from Yagobotix with same-day delivery and pickup available in Surat.
13. What Is Included?
- 1 × MQ2 Gas Sensor Module – Blue Flying-Fish PCB
Microcontroller boards, power supplies, buzzers, LEDs, resistors, breadboards and jumper wires are not included.
14. Compatibility
The MQ2 Gas Sensor Module can be used in suitable electronic circuits involving:
- Arduino Uno
- Arduino Nano
- Arduino Mega
- ESP32 development boards
- ESP8266 NodeMCU
- Raspberry Pi
- Other compatible microcontroller boards
- Custom electronic circuits
The module requires a suitable 5V power supply.
When using 3.3V microcontrollers, use appropriate voltage dividers or level-shifting circuitry wherever required.
Raspberry Pi requires an external ADC to read the analog output.
15. Buy MQ2 Gas Sensor Module Online in India
Add gas and smoke detection functionality to your next electronics project with the MQ2 Gas Sensor Module from Yagobotix.
With its semiconductor sensing element, analog and digital outputs and adjustable detection threshold, this module is suitable for educational gas monitoring experiments, robotics, IoT applications and DIY electronics projects.
Order online with shipping across India and same-day delivery or pickup available in Surat, subject to stock availability and applicable order cut-off times.
Add to cart and start building your next electronics project with Yagobotix!







There are no reviews yet.