Working Principle
The MQ-2 uses a heated tin dioxide (SnO2) semiconductor. In clean air, oxygen adsorbs on the surface, creating a high-resistance depletion layer. When combustible gases (methane, propane, hydrogen, smoke) contact the surface, they react with adsorbed oxygen, releasing electrons and lowering resistance. The resistance change is proportional to gas concentration.
Analogy: Imagine a sponge (SnO2) that soaks up oxygen and swells (high resistance). Gas molecules squeeze the oxygen out, making the sponge shrink (low resistance).
Electrical Characteristics
| Parameter | Value |
|---|---|
| Heater Voltage | 5 V ± 0.1 V |
| Heater Current | ~150 mA |
| Detectable Gases | LPG, methane, propane, hydrogen, smoke |
| PPM Range | 200 – 10,000 ppm |
| Warm-up Time | > 24 hours (full), > 2 min (functional) |
| Output | Analog (voltage divider) + digital (comparator threshold) |
Calibration & PPM Calculation
The key calibration value is R0 — the sensor resistance in clean air. Measure it after the sensor has warmed up for 24+ hours:
R_s = R_load * (V_cc - V_out) / V_out
R_0 = R_s / 9.8 (clean air ratio from datasheet)
Code Example
/*
* MQ-2 Gas Sensor — Arduino
* Wiring: A0 → Analog out, VCC → 5V, GND → GND
* IMPORTANT: Allow 2+ min warm-up before trusting readings
*/
#define MQ2_PIN A0
#define R_LOAD 10000.0 /* 10kΩ load resistor on module */
#define R0_CLEAN 9.8 /* Rs/R0 ratio in clean air */
float R0 = 10000.0; /* Will be calibrated */
float readRs() {
int adc = analogRead(MQ2_PIN);
float voltage = adc * (5.0 / 1023.0);
if (voltage < 0.01) voltage = 0.01; /* Prevent divide-by-zero */
return R_LOAD * (5.0 - voltage) / voltage;
}
void calibrate() {
Serial.println("Calibrating in clean air...");
float rsSum = 0;
for (int i = 0; i < 50; i++) {
rsSum += readRs();
delay(100);
}
R0 = (rsSum / 50.0) / R0_CLEAN;
Serial.print("R0 = "); Serial.println(R0);
}
void setup() {
Serial.begin(9600);
delay(3000); /* Warm-up delay */
calibrate();
}
void loop() {
float rs = readRs();
float ratio = rs / R0;
/* Approximate LPG ppm from datasheet curve (log-log) */
float ppm = pow(10, ((log10(ratio) - 0.26) / -0.47) + 2.3);
Serial.print("Rs/R0: "); Serial.print(ratio, 2);
Serial.print(" | ~PPM: "); Serial.println(ppm, 0);
if (ratio < 2.0) {
Serial.println("⚠ WARNING: Elevated gas level detected!");
}
delay(1000);
}
MQ-Series Gas Sensor Family
The MQ series shares the same SnO&sub2; MOX architecture but with different doping and heater profiles tuned for specific gases. All use the same load-resistor + heater circuit:
| Model | Target Gas | Range | Use Case |
|---|---|---|---|
| MQ-2 | LPG, Methane, Smoke | 300–10,000 ppm | Kitchen gas leak alarm |
| MQ-3 | Alcohol (ethanol) | 25–500 ppm | Breathalyser / BAC |
| MQ-4 | Methane (CH&sub4;) | 200–10,000 ppm | Natural gas pipelines |
| MQ-5 | LPG, Natural gas | 200–10,000 ppm | Gas stove leak detection |
| MQ-6 | LPG, Butane | 200–10,000 ppm | Butane torch/LPG cylinders |
| MQ-7 | Carbon monoxide (CO) | 20–2,000 ppm | CO safety alarm |
| MQ-8 | Hydrogen (H&sub2;) | 100–10,000 ppm | Fuel cell / battery labs |
| MQ-9 | CO + Combustible gas | 10–10,000 ppm | Multi-gas alarm |
| MQ-135 | NH&sub3;, Benzene, CO&sub2;, VOCs | 10–1,000 ppm | Indoor air quality |
Limitations
- Cross-sensitivity: Cannot distinguish between gases; LPG and methane produce similar responses. Use dedicated sensors (MQ-7 for CO, MQ-3 for alcohol) to reduce ambiguity.
- Power hungry: 150 mA heater makes it unsuitable for battery-powered devices.
- Long burn-in: 24+ hours needed for stable R0; casual use gives wildly inaccurate PPM values.
- Not calibrated: All MQ sensors ship uncalibrated; each unit needs individual R0 measurement in clean air.