Gas / Air-Quality Sensor (MQ)
Sensor
MQ-series gas sensors use a heated tin-oxide surface whose resistance drops in the presence of target gases. Cheap and sensitive but power-hungry, slow to warm up, and only semi-quantitative without careful calibration.
What it looks like
Gas / Air-Quality Sensor (MQ)
A typical sensor — exact shape, colour and markings vary between manufacturers.
Types & variants
Key specs
Target gas & range
ppmEach MQ number targets a different gas family.
Heater power
mW~800 mW at 5 V — dominates the power budget.
Preheat/burn-in time
sMinutes to stabilise; 24–48 h burn-in for repeatable readings.
Load resistor (RL)
kΩForms a divider with the sensing resistance — sets the curve.
Laws that govern it
- Laws of resistanceR = ρ × L / A
The tin-dioxide sensing layer changes resistivity when a target gas adsorbs on it — the whole MQ family is R = ρL/A with ρ as the sensor.
- Kirchhoff's voltage law (KVL)ΣV(loop) = 0
You read it through a load resistor divider, and RL is what sets the sensitivity and the shape of your calibration curve.
- Joule's law of heatingH = I² × R × t
The built-in heater runs the element at a few hundred degrees; that I²Rt is most of the module's power draw and needs a long warm-up.
Each law is stated in full — with its diagram, variables and worked meaning — on the electrical laws page.
Markings
Sensor number stamped on the metal mesh can; breakout boards add AO/DO pins and a threshold pot.
Standard values
MQ-2 and MQ-135 breakouts are the common hobby parts.
How to choose
Match the MQ number to the target gas. For actual safety (CO alarms) use a certified electrochemical detector, not an MQ. For CO₂ specifically, only NDIR sensors truly measure it.
Pinout & package
Breakout: Vcc (5 V), GND, AO (analog), DO (comparator). Bare sensor: 6 pins — heater pair + sensing pair.
Example circuits
- Kitchen LPG leak warning buzzer
- Air-quality logger with MQ-135 + ESP32
- Breath-alcohol novelty tester
Common failures
Heater burnout ends the sensor, contamination (silicone vapours poison the surface), and endless false alarms from humidity/temperature swings on uncalibrated modules.
How to test
After a warm-up, AO should sit stable in clean air and jump when you present a gas source (lighter gas, unlit, for MQ-2). Heater check: resistance across heater pins ~30 Ω cold.
Substitutes
Electrochemical cell for serious CO measurement, NDIR (SCD40/MH-Z19) for CO₂, or a bosch BME688 for general air quality with less power.