The MQ series of gas sensors from Henan Hanwei Electronics are among the most popular components in the Arduino and maker community worldwide. Affordable (₹80–₹300 each), easy to use, and available for detecting dozens of different gases, they power everything from homemade smoke alarms to air quality monitors, LPG leak detectors to methane sensors for biogas plants. But with so many MQ sensor variants—MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9, MQ-131, MQ-135, MQ-136—choosing the right one is confusing.
This comprehensive comparison focuses on the three most popular models for air quality monitoring: MQ-135 (multi-gas air quality), MQ-7 (carbon monoxide), and MQ-4 (methane/natural gas). We explain how each works, what gases they actually detect, how to wire and calibrate them with Arduino, and which one to choose for your specific application.
How MQ Gas Sensors Work
All MQ series sensors use a metal oxide semiconductor (MOS) operating principle. Inside each sensor is a small ceramic tube coated with a sensing material (typically tin dioxide, SnO2, or other metal oxides) wound with heating coils:
- Heating element: A nichrome coil heats the sensing material to 200–450°C. This is why MQ sensors draw significant current (150–300mA) and become hot during operation—this is normal and expected.
- Sensing mechanism: At elevated temperatures, oxygen from air adsorbs onto the SnO2 surface, removing free electrons and increasing resistance. When target gas molecules (CO, methane, alcohol, etc.) contact the hot surface, they react with the adsorbed oxygen, releasing electrons back into the material and decreasing resistance.
- Output: Lower resistance = more target gas present. This is read as a voltage change via a voltage divider with an external load resistor (RL).
The key equation:
Vout = Vcc × RL / (RS + RL) RS (sensor resistance) decreases as target gas concentration increases → Vout increases as gas concentration increases Calibration ratio: Rs/R0 R0 = sensor resistance in clean air (calibration baseline) RS = current sensor resistance Lower Rs/R0 ratio = more gas detected
Important Limitations of All MQ Sensors
- Cross-sensitivity: Every MQ sensor responds to multiple gases. The graphs in datasheets show relative sensitivity, not exclusive detection.
- Humidity and temperature effects: Both affect readings significantly. All MQ sensors become more sensitive in high humidity.
- Warm-up time: Allow 24–48 hours burn-in for a new sensor, and 2–5 minutes warm-up before each reading session.
- Calibration required: Fresh air calibration (R0 determination) must be done in known clean air before use.
- Drift: Sensor resistance changes over months of use. Recalibrate every 3–6 months.
MQ-135: Air Quality Sensor
What Does the MQ-135 Detect?
The MQ-135 is designed as a general-purpose air quality sensor. Its sensing material (activated carbon + alumina) is sensitive to a broad range of gases:
- Primary targets: Ammonia (NH3), sulphur dioxide (SO2), benzene vapour, alcohol, smoke
- Secondary response: CO2 at high concentrations, NOx, hydrogen
- Often misused as CO2 sensor: The MQ-135 is NOT a reliable CO2 sensor. Its CO2 sensitivity is very low compared to true NDIR CO2 sensors like the MH-Z19. It cannot distinguish between CO2 and other volatile organic compounds (VOCs).
MQ-135 Specifications
| Parameter | Value |
|---|---|
| Operating Voltage | 5V DC |
| Heater Voltage | 5V DC |
| Load Resistance (RL) | 20kΩ (typical) |
| Heater Consumption | 0.8–1.0W (160–200mA at 5V) |
| Detection Range | 10–300 ppm (NH3), 10–1000 ppm (benzene) |
| Operating Temperature | -10°C to +70°C |
| Operating Humidity | Less than 95% RH |
| Preheat Time | >24h (first use), >3min (subsequent) |
Best Use Cases for MQ-135
- Indoor air quality index (IAQ) monitoring as a general pollution indicator
- Ammonia detection in chicken farms, livestock sheds, toilets
- Alcohol vapour detection (breathalyser-type projects)
- Chemical lab safety monitoring for benzene, sulphur compounds
- Smoke alarm complement (better for chemical smoke than wood smoke)
NOT Good For
- Precise CO2 measurement (use MH-Z19B NDIR sensor instead)
- CO detection (use MQ-7 for better CO selectivity)
- Methane/LPG detection (use MQ-4 or MQ-5 for better selectivity)
MQ-135 Air Quality / Gas Detector Sensor Module
The MQ-135 is India’s most popular air quality sensor for Arduino. Detects ammonia, benzene, alcohol, and general air quality degradation in indoor environments.
MQ-7: Carbon Monoxide Sensor
What Does the MQ-7 Detect?
The MQ-7 is specifically optimised for carbon monoxide (CO) detection. CO is the “silent killer”—an odourless, colourless gas produced by incomplete combustion of fuels. In India, CO poisoning from generators run indoors during power cuts, improperly vented kerosene and LPG stoves, and coal-fired heating is a significant cause of preventable death every year.
- Primary target: Carbon monoxide (CO), 20–2000 ppm
- Secondary response: Hydrogen gas (H2), methane (high concentrations)
- Low sensitivity to: Alcohol, LPG, propane (the MQ-7 is relatively selective for CO)
MQ-7 Unique Feature: Dual Voltage Operation
The MQ-7 requires a special two-phase heating cycle for accurate CO detection—this distinguishes it from all other MQ sensors:
- High voltage phase (5V, 60 seconds): Burns off interfering gases and oxidised CO compounds from sensor surface
- Low voltage phase (1.4V, 90 seconds): CO absorption and measurement phase
Reading must be taken at the end of the low-voltage phase (just before switching back to high). Attempting to use the MQ-7 with constant 5V like other MQ sensors gives incorrect readings with significant drift.
MQ-7 Specifications
| Parameter | Value |
|---|---|
| Operating Voltage | 5V DC (high) / 1.4V DC (low) |
| CO Detection Range | 20–2000 ppm |
| Sensitivity | Rs/R0 = 0.1–0.9 (at 100ppm CO) |
| Heater Consumption | 350mW (5V phase) |
| CO danger threshold | 70 ppm (headache), 150 ppm (serious risk), 400+ ppm (life-threatening) |
Best Use Cases for MQ-7
- Indoor CO alarm—generator rooms, garages, boiler rooms
- Cooking area safety monitor for enclosed kitchens with LPG or coal stoves
- Vehicle cabin air quality monitoring
- Industrial factory floor CO safety system
MQ-4: Methane / Natural Gas Sensor
What Does the MQ-4 Detect?
The MQ-4 is optimised for methane (CH4) and natural gas (CNG/PNG) detection. Methane is the primary component of natural gas used in Indian homes for cooking, and also the major gas produced in biogas digesters, landfills, sewage treatment plants, and coal mines.
- Primary target: Methane (CH4), 200–10000 ppm
- Secondary response: Propane, butane, LPG, hydrogen
- Low sensitivity to: CO, alcohol, benzene (compared to MQ-2 and MQ-135)
MQ-4 vs MQ-2 for LPG Detection
This is a common confusion. Both MQ-2 and MQ-4 detect flammable gases, but:
- MQ-2: More sensitive to propane/butane (LPG), hydrogen, and smoke. Best for general LPG leak alarms in Indian kitchens.
- MQ-4: More selective for methane (PNG/CNG/biogas). Better for biogas plant monitoring and natural gas leak detection.
- If your application is household LPG detection (liquefied petroleum gas = mainly propane + butane), the MQ-2 or MQ-5 is actually better than the MQ-4.
MQ-4 Specifications
| Parameter | Value |
|---|---|
| Operating Voltage | 5V DC |
| Methane Detection Range | 200–10,000 ppm |
| Heater Consumption | 0.8–1.0W |
| Methane LEL in air | 5% (50,000 ppm) — sensor well below LEL range |
| Load Resistance | 20kΩ |
Best Use Cases for MQ-4
- Biogas plant methane monitoring and yield measurement
- PNG (piped natural gas) line leak detection in apartments and commercial kitchens
- Landfill gas monitoring
- Sewage treatment plant safety monitoring (methane buildup in confined spaces)
- Coal mine methane early warning systems
MQ-131 Ozone Gas Detection Sensor
For outdoor air quality monitoring, add MQ-131 ozone detection to complement your MQ-135 indoor air quality data for a comprehensive AQI monitoring station.
Head-to-Head Comparison Table
| Property | MQ-135 | MQ-7 | MQ-4 |
|---|---|---|---|
| Primary Target Gas | NH3, benzene, alcohol, smoke | Carbon Monoxide (CO) | Methane (CH4) |
| Detection Range | 10–1000 ppm | 20–2000 ppm | 200–10,000 ppm |
| Selectivity | Low (broad range) | Medium (CO selective) | Medium (methane selective) |
| Heating Mode | Constant 5V | Alternating 5V/1.4V cycles | Constant 5V |
| Warm-up Time | 2–3 minutes | 2.5 minutes (one cycle) | 2–3 minutes |
| Power Draw | ~900mW | ~350mW (avg) | ~900mW |
| CO Detection | Poor | Excellent | Poor |
| Methane Detection | Poor | Poor | Excellent |
| Ammonia Detection | Excellent | Poor | Poor |
| Typical India Price | ₹80–200 (module) | ₹100–250 (module) | ₹100–230 (module) |
| Arduino Complexity | Simple | Moderate (PWM needed) | Simple |
Wiring MQ Sensors to Arduino
All MQ sensor breakout modules have the same 4-pin interface:
- VCC: 5V power
- GND: Ground
- AO (Analog Out): Analog voltage proportional to gas concentration
- DO (Digital Out): Digital HIGH/LOW based on onboard potentiometer threshold
| Module Pin | Arduino (MQ-135/MQ-4) | Arduino (MQ-7) |
|---|---|---|
| VCC | 5V | 5V (use transistor switching for 1.4V phase) |
| GND | GND | GND |
| AO | A0 | A0 |
| DO | D2 (optional threshold alert) | D2 (optional) |
MQ-7 note: For proper dual-voltage operation, use a PWM-driven NPN transistor (2N2222 or BC547) to switch between 5V (full) and a 1.4V equivalent (using PWM at ~28% duty cycle). Alternatively, use a 5V-to-1.4V regulator on a separate switched line.
Arduino Code for All Three Sensors
MQ-135: Air Quality Index Code
#include <MQUnifiedsensor.h> // Install from Arduino Library Manager
#define Board "Arduino UNO"
#define Pin A0
#define Type "MQ-135"
#define Voltage_Resolution 5
#define ADC_Bit_Resolution 10
#define RatioMQ135CleanAir 3.6 // Rs/Ro ratio in clean air (from datasheet)
MQUnifiedsensor MQ135(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
Serial.begin(9600);
MQ135.setRegressionMethod(1); // Exponential regression
MQ135.init();
Serial.println("Calibrating MQ-135 in clean air...");
float calcR0 = 0;
for (int i = 1; i <= 10; i++) {
MQ135.update();
calcR0 += MQ135.calibrate(RatioMQ135CleanAir);
Serial.print(".");
}
MQ135.setR0(calcR0 / 10);
Serial.println(" Done!");
Serial.print("R0 = "); Serial.println(calcR0 / 10);
}
void loop() {
MQ135.update();
// Set parameters for NH3 detection
MQ135.setA(102.2); MQ135.setB(-2.473);
float NH3_ppm = MQ135.readSensor();
// Set parameters for benzene detection
MQ135.setA(44.947); MQ135.setB(-3.445);
float Benzene_ppm = MQ135.readSensor();
// Set parameters for alcohol/acetone
MQ135.setA(77.255); MQ135.setB(-3.18);
float Alcohol_ppm = MQ135.readSensor();
Serial.print("NH3: "); Serial.print(NH3_ppm); Serial.print(" ppm | ");
Serial.print("Benzene: "); Serial.print(Benzene_ppm); Serial.print(" ppm | ");
Serial.print("Alcohol: "); Serial.print(Alcohol_ppm); Serial.println(" ppm");
// Simple Air Quality Index
float aqi_raw = analogRead(A0);
String quality;
if (aqi_raw < 200) quality = "Excellent";
else if (aqi_raw < 400) quality = "Good";
else if (aqi_raw < 600) quality = "Fair";
else if (aqi_raw < 800) quality = "Poor";
else quality = "Very Poor";
Serial.print("Air Quality: "); Serial.println(quality);
delay(1000);
}
MQ-7: Carbon Monoxide with Dual Voltage Cycling
const int heaterPin = 9; // PWM pin for heater voltage control
const int analogPin = A0;
const int alarmPin = 13;
const int HIGH_PWM = 255; // 5V = full duty cycle
const int LOW_PWM = 72; // 1.4V ≈ 28% of 5V (72/255 = 0.28)
const long HIGH_TIME = 60000; // 60 seconds at high voltage
const long LOW_TIME = 90000; // 90 seconds at low voltage
bool highPhase = true;
unsigned long phaseStart = 0;
float lastCO_ppm = 0;
float R0 = 27.0; // Calibrate this in clean air
void setup() {
Serial.begin(9600);
pinMode(alarmPin, OUTPUT);
analogWrite(heaterPin, HIGH_PWM);
phaseStart = millis();
Serial.println("MQ-7 CO Sensor - Initializing...");
Serial.println("Note: Takes 2.5min per measurement cycle");
}
void loop() {
unsigned long elapsed = millis() - phaseStart;
if (highPhase) {
if (elapsed >= HIGH_TIME) {
// Switch to low voltage phase
analogWrite(heaterPin, LOW_PWM);
highPhase = false;
phaseStart = millis();
Serial.println("→ Low voltage measurement phase");
}
} else {
if (elapsed >= LOW_TIME - 5000) { // Read 5s before end of low phase
int adcValue = analogRead(analogPin);
float voltage = adcValue * (5.0 / 1023.0);
float RS = (5.0 - voltage) / voltage * 20.0; // RL = 20kΩ
float ratio = RS / R0;
// CO ppm from datasheet curve: CO = 100 × (ratio / 1.0)^(-1.52)
float CO_ppm = 100.0 * pow(ratio / 1.0, -1.52);
lastCO_ppm = CO_ppm;
Serial.print("CO: "); Serial.print(CO_ppm, 1); Serial.print(" ppm");
if (CO_ppm > 70) {
Serial.print(" ⚠ WARNING: DANGEROUS CO LEVEL");
digitalWrite(alarmPin, HIGH);
} else {
Serial.print(" (Safe)");
digitalWrite(alarmPin, LOW);
}
Serial.println();
}
if (elapsed >= LOW_TIME) {
// Switch back to high voltage
analogWrite(heaterPin, HIGH_PWM);
highPhase = true;
phaseStart = millis();
}
}
}
MQ-4: Methane Leak Detector
const int MQ4_PIN = A0;
const int BUZZER_PIN = 8;
const int LED_PIN = 13;
float R0 = 9.83; // Calibrate in clean air (Rs in clean air / typical ratio)
const float RL = 20.0; // Load resistance in kΩ
const float METHANE_ALARM_PPM = 1000; // Alert at 1000 ppm (2% of LEL)
float readMethane() {
// Average 50 readings for stability
long total = 0;
for (int i = 0; i METHANE_ALARM_PPM) {
Serial.println("!!! METHANE LEAK DETECTED - VENTILATE IMMEDIATELY !!!");
// Pulse alarm
for (int i = 0; i < 5; i++) {
digitalWrite(BUZZER_PIN, HIGH);
digitalWrite(LED_PIN, HIGH);
delay(200);
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(LED_PIN, LOW);
delay(200);
}
} else {
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(LED_PIN, LOW);
}
delay(1000);
}
Calibration: Rs/R0 Ratio Explained
Calibration is the most important—and most often skipped—step when working with MQ sensors. Without calibration, readings are meaningless numbers.
Understanding R0
R0 is the sensor resistance measured in clean air (fresh outdoor air with approximately 400 ppm CO2, low VOCs). R0 is the baseline from which all gas concentration calculations are derived. Different individual sensors of the same model have different R0 values due to manufacturing variation—always measure your specific sensor’s R0.
Step-by-Step Calibration
- Place sensor outdoors in fresh air (away from traffic, cooking, or other pollutants)
- Power on the sensor and wait at least 5 minutes for full warm-up
- Record 100 analog readings and calculate the average
- Calculate RS (sensor resistance): RS = RL × (Vcc – Vout) / Vout
- R0 = RS / expected_ratio_in_clean_air (from datasheet, e.g., 3.6 for MQ-135, 27 for MQ-7 in clean air at 150 ppm CO, 9.8 for MQ-4)
- Store R0 in EEPROM or as a constant in your sketch
7 Pin Universal Sensor Socket for MQ Series
This universal socket fits MQ-4, MQ-7, MQ-135 and other MQ series sensors — perfect for socketing your sensors for easy swap and testing without resoldering.
Which Sensor Should You Choose?
Choose MQ-135 if:
- You want a general indoor air quality indicator (IAQ) without needing to identify specific gases
- Ammonia monitoring is important (poultry farming, livestock shed, toilet areas)
- Alcohol breath testing (approximate, not legal accuracy)
- Benzene/solvent vapour detection in workshops and paint areas
- You want one sensor for a general “air is bad/good” indication
Choose MQ-7 if:
- Carbon monoxide safety is your primary concern
- You have a generator, petrol vehicle, or gas heating appliance indoors
- Kitchen safety monitoring for enclosed spaces with incomplete combustion risk
- You can implement the dual-voltage cycling in your firmware
- Life safety is involved—CO is immediately dangerous. Do not substitute MQ-135 for CO detection.
Choose MQ-4 if:
- Methane (natural gas / CNG / PNG) leak detection is needed
- You are building a biogas plant monitoring system
- Landfill or sewage gas monitoring
- You need better selectivity for methane vs. LPG (MQ-2 or MQ-5 for LPG)
Use All Three Together for a Complete Air Quality Station
For a comprehensive indoor air quality monitor, combine:
- MQ-135 for ammonia, benzene, VOC index
- MQ-7 for CO (carbon monoxide safety)
- MQ-4 for methane/natural gas leak
- BME280 or DHT22 for temperature + humidity (needed for sensor correction)
- OLED or LCD display + WiFi (ESP8266/ESP32) for cloud logging
Air Quality Project Ideas
1. Smart Kitchen Safety Monitor
Mount MQ-7 (CO) and MQ-4 (methane/PNG) in an Indian kitchen above the stove. Alert when CO exceeds 70 ppm or gas exceeds 500 ppm via buzzer + SMS (SIM800L module). Many Indian kitchen fires and CO poisoning incidents are preventable with basic monitoring.
2. Indoor Air Quality Dashboard
ESP32 + MQ-135 + BME280 + OLED creates a wall-mounted air quality panel. Display temperature, humidity, and a colour-coded air quality index (green/yellow/red). Push data to a ThingSpeak or Blynk dashboard for historical trending.
3. Poultry Farm Ammonia Alarm
Broiler chicken houses need ammonia below 25 ppm for bird health. MQ-135 detects ammonia buildup from litter fermentation. Trigger exhaust fans automatically when NH3 exceeds threshold, reducing mortality and improving feed conversion ratios.
4. Biogas Plant Methane Monitor
Track methane production from a household biogas digester using MQ-4. Monitor daily production patterns, detect membrane leaks, and log data to estimate cooking energy yield. Relevant for rural homes, agricultural waste biogas systems, and college lab demonstrations.
5. Parking Garage CO Monitor
Underground parking garages require ventilation systems triggered by CO concentration. MQ-7 sensors at multiple points trigger fans and issue audible warnings, ensuring safe CO levels for vehicle operators and pedestrians.
Tips for Reliable Readings
Essential Practices
- 48-hour burn-in: New MQ sensors need 24–48 hours of continuous power before calibration and use. The heating element stabilises the sensing material through initial oxidation cycles.
- Always run from 5V: MQ heaters draw 150–300mA. Powering from Arduino’s 5V pin is marginal—the pin can only source 500mA total. Use a separate 5V power supply for the sensor if you have other loads.
- Humidity correction: MQ sensors read higher in humid conditions. At 65% RH vs 33% RH, sensitivity can increase 30–50%. For precision work, apply humidity correction using DHT11/DHT22 data.
- Avoid poisoning: High concentrations of silicone vapours (from RTV sealant, silicone sprays) and halogen gases permanently damage MQ sensor elements. Keep sensors away from silicone curing and soldering fluxes.
- Protect from wind: Sudden air currents cause momentary false readings. Install sensors in a housing with small holes for gas ingress, not directly in moving air streams.
Frequently Asked Questions
No. Despite many tutorials claiming MQ-135 can measure CO2 in ppm, it has very low sensitivity to CO2 and its response to CO2 is easily masked by other gases present (VOCs, humidity changes). For accurate CO2 measurement, use an NDIR (Non-Dispersive Infrared) sensor like the MH-Z19B or SCD40. These respond specifically and quantitatively to CO2 absorption of infrared light, unlike metal oxide sensors which respond to any reducing gas.
When cold, the SnO2 sensing element has adsorbed moisture and VOCs from the environment during power-off. When heated, these desorb rapidly, causing a temporary high reading. This initial surge can last 3–10 minutes. Always wait for the sensor to stabilize before taking readings. Some applications ignore readings during the first 3 minutes using a startup timer.
The most common causes: (1) You are reading during the high-voltage phase instead of the low-voltage phase—readings are only valid at the end of the 1.4V phase. (2) Your 1.4V generation via PWM is not stable—use a proper voltage regulator instead. (3) Insufficient warm-up time. (4) Power supply noise—add a 100μF capacitor across the sensor VCC-GND pins. Implement the timing cycle carefully and ensure readings happen only in the last 10 seconds of the 90-second low phase.
A continuously powered MQ sensor typically has a lifespan of 1–5 years under normal conditions. Heater element failure (open circuit) and sensing material degradation are the main failure modes. Exposure to high concentrations of silicone vapours, acid gases (HCl, HF), or alkali fumes accelerates failure. Sensors used intermittently (powered only when needed) last considerably longer as heat cycling degrades the ceramic element over time.
MQ sensors can provide a useful first-level alert but should not be the sole protection in life-safety applications. For certified CO alarms in homes, use UL-listed or BIS-certified CO detectors. For industrial safety systems, use ATEX/IECEx certified sensor systems. MQ sensors are excellent for educational projects, prototyping, and supplemental monitoring, but their ±15–25% accuracy, drift, and cross-sensitivity make them inappropriate as primary safety devices in situations where false negatives could cause injury or death.
All four detect combustible gases but with different sensitivities. MQ-2 is the most versatile—it detects LPG, propane, butane, methane, hydrogen, and smoke. MQ-4 is most selective for methane (natural gas). MQ-5 is optimised for LPG and natural gas with less smoke interference. MQ-6 is specifically tuned for LPG/propane/butane. For a household LPG leak detector in India (where LPG = propane + butane mixture), the MQ-2 or MQ-6 is the better choice over MQ-4.
Conclusion
The MQ-135, MQ-7, and MQ-4 each occupy a distinct niche in gas sensing. The MQ-135 gives you a broad sweep of indoor air quality indicators; the MQ-7 provides the critical CO detection that can save lives in any enclosed space with combustion appliances; and the MQ-4 keeps you safe from methane accumulation whether in a biogas plant, natural gas kitchen, or any methane-prone environment.
The key to success with any MQ sensor is the same: proper 48-hour burn-in, careful R0 calibration in fresh air, temperature and humidity awareness, and—most critically—understanding that these sensors detect entire categories of gases, not single compounds. Used with realistic expectations and proper calibration, MQ sensors are remarkable value. A comprehensive three-sensor air quality station costs under ₹700 in components and gives you monitoring capability that was expensive industrial equipment just a decade ago.
Build Your Air Quality Monitor Today
Get MQ-135, MQ-7, MQ-4 and all the sensor accessories you need at Zbotic — India’s trusted source for maker electronics.
Add comment