Blogs
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)
1 2 3 4 5 6 7 8 9 |
// 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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
1 2 3 4 5 6 7 8 9 10 11 |
// 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
1 2 3 4 5 6 7 8 9 10 |
// 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
1 2 3 4 5 6 7 8 9 10 11 |
// 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// Send SMS alert when gas detected #include <GSM.h> 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