MQ gas sensors explained for practical smoke, LPG and air quality projects

nature, animals, butterfly, insect, flying, wing, sensor, isolated, butterfly, butterfly, butterfly, butterfly, butterfly

What MQ gas sensors are and what they actually measure

MQ gas sensors are low-cost heated metal-oxide semiconductor sensors used to detect gases such as LPG, methane, hydrogen, alcohol vapor, smoke-related gases, carbon monoxide and broad indoor air pollutants. They are common in Arduino, Raspberry Pi and IoT prototypes because the interface is simple and the modules are widely available. The key limitation is that most MQ sensors do not identify one gas with laboratory accuracy. They respond to a change in the resistance of a heated sensing layer, and that response can be affected by gas mixtures, temperature, humidity, aging, airflow and calibration quality.

For practical projects, MQ sensors are best treated as relative gas presence sensors unless the design includes controlled calibration and compensation. They are useful for learning, comparative monitoring and non-certified warning prototypes. They should not be presented as replacements for listed household carbon monoxide alarms, certified combustible gas detectors or workplace safety instruments.

nature, animals, butterfly, insect, flying, wing, sensor, isolated, butterfly, butterfly, butterfly, butterfly, butterfly

In the wider sensors and modules category, MQ devices sit between simple threshold modules and more application-specific technologies such as electrochemical, NDIR infrared, photoionization and industrial catalytic sensors. Their main advantages are cost and availability; the trade-off is selectivity.

How an MQ sensor works

Most MQ gas sensors use a tin dioxide sensing layer, often written as SnO₂ in datasheets, wrapped around or placed near a small heater. In clean air, the sensing layer has a baseline resistance. When reducing gases or vapors reach the hot surface, surface reactions change the conductivity of the layer. The circuit then converts that resistance change into a measurable voltage.

A bare MQ sensor is usually a six-pin can-style component with heater pins and sensing electrodes. A common breakout module adds a load resistor, power pins, an analog output and often a comparator-based digital output. The analog output gives a continuously varying signal that can be read by an ADC. The digital output simply switches when the adjustable potentiometer threshold is crossed. That digital pin is useful for demonstrations, but it is not a calibrated gas concentration reading.

The heater is not a minor design detail. Many MQ devices are built around a 5 V heater and can consume close to 900 mW or 950 mW, depending on the model. That is high compared with many modern digital environmental sensors. It affects battery life, enclosure temperature, power supply selection and warm-up behavior. Designers using ESP32, Raspberry Pi Pico or other 3.3 V boards also need to remember that many MQ modules are powered at 5 V and may output a voltage that exceeds a 3.3 V ADC input unless a divider or level-safe interface is used.

Choosing the right MQ model

Different MQ part numbers are tuned for different target gases, but tuned does not mean exclusive. A methane-oriented sensor may still respond to other combustible gases. An air-quality sensor may react to several vapors at the same time. Manufacturer datasheets from Winsen, Hanwei and module vendors commonly publish target gases, detection ranges and sensitivity curves, but those curves are usually measured under specified temperature, humidity, oxygen and test-gas conditions.

Model Common target use Typical published range or note Practical interpretation
MQ-2 Smoke, LPG, propane, methane, hydrogen and combustible gas projects Often listed around 300–10000 ppm for flammable gases Good general-purpose combustible gas sensor, but not selective for one gas
MQ-3 / MQ-3B Alcohol vapor Commonly listed around 25–500 ppm alcohol for MQ-3B Useful for alcohol vapor detection demonstrations and breath-related experiments, not a certified breathalyzer by itself
MQ-4 Methane and natural gas Often listed around 300–10000 ppm methane Better fit than MQ-2 when methane is the main target
MQ-5 / MQ-6 LPG, propane, butane and methane-related leak projects Many sheets list combustible gas ranges in the hundreds to 10000 ppm region Often chosen for kitchen gas or cylinder leak prototypes
MQ-7 / MQ-7B Carbon monoxide Some current MQ-7B sheets list 10–500 ppm CO and specify heater cycling CO-focused, but a module is not the same as a listed CO alarm
MQ-8 Hydrogen Some manufacturer sheets list 100–1000 ppm H₂ Appropriate when hydrogen is the target gas and the range matches the project
MQ-9 / MQ-9B Carbon monoxide plus methane or other combustible gases Common MQ-9B data lists CO and methane ranges separately Useful when both CO and combustible gas response are desired, but cross-response still matters
MQ-135 Broad air-quality and harmful gas indication Often associated with ammonia, sulfide, benzene-series vapors, hydrogen and smoke Good for relative air-quality trend projects; weak choice for accurate CO₂ measurement

The most common selection mistake is to search for a gas name and buy the first module that mentions it. A better approach is to start with the target gas, expected concentration range, operating environment, power budget and safety requirement. If the project needs an approximate change indicator, an MQ sensor may be reasonable. If it needs a reliable ppm value, legal compliance or life-safety alarm behavior, the sensor choice must be more conservative.

Calibration, warm-up and environmental effects

MQ sensors need warm-up time because the heater and sensing surface must reach a stable chemical and thermal condition. Some datasheets specify a long initial preheat period, often more than 24 hours or more than 48 hours depending on the exact model and manufacturer. After that, many projects still need a shorter warm-up period at each power-on before readings are meaningful.

Calibration is the dividing line between a simple gas-reactive circuit and a measurement instrument. A credible ppm estimate requires readings in clean air and in known concentrations of the target gas, ideally across the range of interest. Application notes for metal-oxide sensors commonly emphasize that each sensor can have a different baseline and a different response slope. Copying a formula from another module, another batch or an online sketch can produce numbers that look precise but are not valid for the hardware in front of you.

Temperature and humidity also shift readings. A sensor tested at about room temperature and moderate humidity may not behave the same way inside a hot enclosure, near steam, near cleaning chemicals or in an outdoor box. Airflow matters because gas must reach the sensing element. Dust, silicone vapors, sulfur compounds and other contaminants can poison or desensitize gas sensors. Aging can move the baseline over months or years, so designs that depend on absolute thresholds need periodic checks.

For a prototype, a reasonable workflow is to record a baseline after warm-up, expose the sensor to controlled and safe test conditions, store the clean-air resistance value, and then use relative change or a calibrated curve. For a deployed device, the workflow should also include documentation, repeat testing and a plan for sensor replacement.

Where MQ sensors fit well

MQ gas sensors fit well in education, early hardware evaluation and low-cost environmental experiments. They are also useful in projects that need a relative alert, such as detecting that a combustible vapor event has occurred compared with the normal background level. Their analog behavior makes them easy to plot, log and combine with other sensor data.

  • Learning projects: MQ modules are easy to connect, and the signal change is visible enough for beginners to understand gas sensing concepts.
  • Trend monitoring: They can show relative changes over time, especially when the environment is stable and the same unit is used consistently.
  • Multi-sensor prototypes: Pairing MQ sensors with temperature, humidity, particulate matter or ventilation data can help interpret indoor air events.
  • Early feasibility tests: They can show whether a gas event produces a detectable response before a project moves to a more specialized sensor.

A strong design does not rely on the MQ sensor alone when other context is available. For example, an indoor air-quality logger should separate particulate monitoring, CO₂ ventilation measurement and gas-reactive VOC indication rather than asking one MQ-135 module to represent all of indoor air quality. See also: device architecture.

Where MQ sensors are not enough

The biggest limitation is selectivity. A single MQ sensor usually cannot prove which gas caused the signal change. If a sensor responds to LPG, methane, alcohol vapor and smoke, the microcontroller sees a voltage change, not a confirmed chemical identity. A table of sensitivity curves can help, but real environments contain mixtures.

Another limitation is safety certification. Government and safety guidance for gas detection usually focuses on tested instruments, known calibration gas, bump testing, maintenance records and approved alarm behavior. OSHA guidance for direct-reading gas monitors, for example, emphasizes calibration and testing with known gas concentrations. EPA consumer guidance treats carbon monoxide alarms as important safety devices and points users toward certified alarms, while also noting that alarms are not a replacement for proper installation and maintenance of fuel-burning appliances. An MQ module built into a hobby circuit does not automatically meet those expectations.

Carbon monoxide deserves special caution. Although MQ-7 and MQ-9 variants can respond to CO, a safe residential CO alarm must meet the relevant alarm standard and be installed according to local requirements and manufacturer instructions. A DIY MQ circuit may fail silently because of power loss, drift, wrong threshold settings, cross-sensitivity, blocked airflow or code errors. It can be a learning tool or secondary indicator, not the primary safety device.

Accuracy claims should also be restrained. Without a calibration gas setup, stable test chamber and compensation data, a displayed ppm value is usually an estimate. For many content and maker projects, it is more honest to show a raw ADC value, voltage, resistance ratio or calibrated relative index than to display precise ppm numbers.

Practical design checklist

Before adding an MQ sensor to a board or module, define the role of the measurement. Is the device a classroom demonstrator, a data logger, a threshold indicator or a safety-related alarm? The answer changes the design standard.

  • Check the datasheet for the exact model: MQ-2, MQ-2B and different vendor modules may not share identical specifications.
  • Budget for heater power: Confirm that the 5 V rail can support the heater current without voltage drop or excess enclosure heating.
  • Protect the ADC input: If the microcontroller is 3.3 V, do not feed a 5 V analog output directly into the ADC.
  • Allow warm-up: Ignore readings until the sensor has stabilized enough for the intended use.
  • Use analog readings for analysis: The digital output is a threshold switch, not a concentration measurement.
  • Calibrate with the target gas when ppm matters: Clean-air baselines are not enough for accurate gas concentration claims.
  • Compensate or record environment: Temperature and humidity data help explain drift and sudden shifts.
  • Design for airflow: Do not bury the sensor behind sealed plastic, dust filters that block gas flow or heat sources that distort readings.
  • Avoid life-safety claims: Use certified alarms and instruments where people depend on the result for safety decisions.

The best practical use of MQ gas sensors is realistic: they are affordable indicators that can make gas-related changes visible to a small embedded system. When a project needs selectivity, trace-level accuracy, compliance or long-term stability, the design should move toward a sensor technology and calibration process matched to that requirement.

Frequently asked questions

Can MQ gas sensors measure exact ppm?

They can be calibrated to estimate ppm under controlled conditions, but an uncalibrated module should not be trusted for exact concentration. For many hobby modules, the raw analog value or resistance ratio is more honest than a precise ppm display.

Why do two identical MQ modules show different readings?

Sensor-to-sensor variation is normal. Differences can come from manufacturing tolerance, heater temperature, load resistor value, preheat history, contamination, humidity and airflow. Each unit should be calibrated individually if the reading matters.

Is MQ-135 a CO₂ sensor?

MQ-135 is widely used in air-quality projects, but it is not a selective CO₂ sensor in the way an NDIR CO₂ module is. It responds to several gases and vapors, so it is better described as a broad gas or air-pollution indicator.

Which MQ sensor is best for LPG?

MQ-2, MQ-5 and MQ-6 are commonly used in LPG or combustible gas prototypes. The better choice depends on the expected gas mixture, range, module design and calibration plan. For a certified leak alarm, use a listed product designed for that purpose.

Do MQ sensors work with 3.3 V microcontrollers?

They can be used with 3.3 V microcontrollers, but many modules still need 5 V heater power. The analog output must be checked and scaled so it does not exceed the microcontroller ADC voltage limit.