MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module
MQ-2 Gas Sensor Module
Flammable Gas and Smoke Detection for Safety Applications
Introduction
The MQ-2 is a semiconductor gas sensor that detects combustible gases including LPG, propane, methane, hydrogen, alcohol, and smoke. With its high sensitivity and fast response time, it’s widely used in gas leak detectors, fire alarms, and air quality monitors.
Key Features
Multi-Gas Detection
LPG, propane, methane, hydrogen, smoke
Analog & Digital Output
Dual signal output options
Adjustable Sensitivity
Potentiometer for threshold adjustment
Heating Element
Requires pre-heating time (~24h for stabilization)
Technical Specifications
Detection Range | 300-10000ppm (LPG, propane, hydrogen) |
---|---|
Operating Voltage | 5V DC ±0.1V |
Heater Current | ~150mA (heating circuit) |
Output Signal | Analog (0-5V) + Digital (TTL) |
Sensitivity | Rs/R0 = 2-10 (1000ppm LPG) |
Response Time | <10s (to 90% of final value) |
Pin Configuration

Pin | Label | Description | Arduino Connection |
---|---|---|---|
1 | VCC | Power (5V ±0.1V) | 5V |
2 | GND | Ground | GND |
3 | DO | Digital Output | D2 (Digital Input) |
4 | AO | Analog Output | A0 (Analog Input) |
Important: Requires 24-48 hour burn-in period for stable readings
Wiring Diagram (Arduino)
// Basic Connections: // VCC → 5V (must be 5V ±0.1V) // GND → GND // AO → A0 (Analog Input) // DO → D2 (Digital Input - optional) // For best results: // - Allow 24-48 hours for initial stabilization // - Keep sensor away from direct airflow
Basic Gas Detection
const int analogPin = A0; const int digitalPin = 2; void setup() { Serial.begin(9600); pinMode(digitalPin, INPUT); } void loop() { int analogValue = analogRead(analogPin); int digitalValue = digitalRead(digitalPin); Serial.print("Gas Level: "); Serial.print(analogValue); Serial.print(" | Alarm: "); Serial.println(digitalValue); if(digitalValue == LOW) { Serial.println("Gas detected!"); } delay(1000); }
Advanced Applications
Calibration
// Calibrate in clean air
float R0 = 0;
const int cleanAirFactor = 9.83; // Sensor specific
void setup() {
// After 24h warmup in clean air
float sensor_volt = analogRead(A0)*(5.0/1023.0);
float RS_air = (5.0-sensor_volt)/sensor_volt;
R0 = RS_air/cleanAirFactor;
Serial.print("R0 = "); Serial.println(R0);
}
PPM Calculation
// Convert to PPM (LPG example)
float getPPM_LPG(float R0) {
float sensor_volt = analogRead(A0)*(5.0/1023.0);
float RS_gas = (5.0-sensor_volt)/sensor_volt;
float ratio = RS_gas/R0;
// Empirical values for LPG
float ppm = 1000 * pow(10, (log10(ratio)-0.8)/(-0.4));
return ppm;
}
Temperature Compensation
// Add temperature compensation
#include "DHT.h"
DHT dht(DHTPIN, DHT11);
void loop() {
float temp = dht.readTemperature();
float analogValue = analogRead(A0);
// Simple compensation (adjust coefficients)
float compensated = analogValue * (1 + (25 - temp)*0.02);
}
Wireless Alert
// Send SMS alert when gas detected
#include
void sendAlert() {
GSM_SMS sms;
sms.beginSMS("+1234567890");
sms.print("GAS LEAK DETECTED!");
sms.endSMS();
}
void loop() {
if(digitalRead(D2) == LOW) {
sendAlert();
delay(60000); // Prevent SMS flood
}
}
Troubleshooting
Unstable Readings
- Ensure proper warm-up time (24-48 hours)
- Keep sensor away from temperature fluctuations
- Add 10μF capacitor between VCC and GND
No Response to Gas
- Verify heater is working (sensor should get warm)
- Test with known gas source (lighter gas works)
- Check analog output with multimeter
False Alarms
- Adjust sensitivity potentiometer
- Ensure clean air calibration
- Keep away from alcohol, smoke, or solvents
Related Posts
IC 74173 – 4-Bit D-Type Register with 3-State Outputs
IC 74173 - 4-Bit D-Type Register with 3-State Outputs
TTL Quad D Flip-Flop with Asynchronous Clear and Output Enable
...
DIY Metal Detector Kit
DIY Metal Detector Kit
DC 3V-5V Non-Contact Sensor Module with 60mm Detection Range
Introduction
The DIY Metal Detec...
CNC V3 Shield with 4 A4988 Drivers
CNC V3 Shield with 4 A4988 Drivers
Complete Arduino-compatible CNC controller for 3D printers and milling machines
...
CN3791 12V MPPT Solar Charger Module
CN3791 12V MPPT Solar Charger Module
Maximum Power Point Tracking Solar Charge Controller for Lead-Acid/Lithium Batteries
...
CJMCU-TRRS 3.5mm Jack AV Stereo Module
CJMCU-TRRS 3.5mm Jack AV Stereo Module
Compact breakout board for audio/video signal interfacing with TRRS connectors
...
TTP223 Capacitive Touch Sensor Module (Red)
TTP223 Capacitive Touch Sensor Module (Red)
Single-Key Touch Detection with Digital Output for Arduino and DIY Projects
...
Capacitive Soil Moisture Sensor
Capacitive Soil Moisture Sensor
Corrosion-Resistant Humidity Detection for Plants and Agricultural Applications
Intro...
VHM-314 Bluetooth Audio Receiver Board Module
VHM-314 Bluetooth Audio Receiver Board Module
High-fidelity stereo audio receiver with Bluetooth 5.0 and 3.5mm audio output
...
BD243 DIY Mini Tesla Coil Prototyping Kit
BD243 DIY Mini Tesla Coil Prototyping Kit
High-Voltage Wireless Power Demonstration - Build Your Own Spark Gap Tesla Coil
...
BF120-3AA Precision Strain Gauges (120Ω)
BF120-3AA Precision Strain Gauges (120Ω)
High-precision foil strain gauges for load cell applications with 120Ω resistance
...
Recent Comments