Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

MQ-135 gas sensor module

MQ-135 module pinout, 5 V heater current, burn-in and warm-up time, keeping AO within a 3.3 V ADC, and why it is not a certified alarm.

Analog

Community draft — report a mistake

CategorySensor
InterfaceAnalog
Voltage5 V (heater: about 150 mA)
Typical price₹150

3.3 V or 5 V? The heater needs 5 V. AO can reach about 5 V, so on ESP32 and Pico feed AO through a 10 kΩ / 20 kΩ divider (or similar) to stay under 3.3 V. DO is driven by the comparator from VCC — divide it too on 3.3 V boards.

The MQ-135 is a heated tin-dioxide (SnO₂) sensor whose resistance falls when it meets ammonia, nitrogen oxides, benzene, alcohol, smoke and other air pollutants. It’s used in indoor air-quality indicators.

It is not a true CO₂ sensor. Code that prints “CO₂ ppm” from an MQ-135 is estimating from a general air-quality curve. For real CO₂, use an NDIR sensor such as the SCD40 or MH-Z19.

It needs heat. The element runs at about 5 V and 150 mA — it gets warm, and that’s normal. Give a new sensor a 24–48 hour burn-in, and a few minutes of warm-up after every power-on. The analog value isn’t calibrated in ppm out of the box; treat it as “higher = more gas” relative to clean-air readings.

Not a certified safety device. A DIY MQ alarm is a helpful extra warning, not a replacement for a certified gas or smoke detector. Keep a certified detector, and for LPG leaks: no switches, no flames, open windows, close the cylinder valve.

Prices are indicative (Oct 2026) and vary by seller.

Pinout

PinWhat it does
VCC5 V supply — the heater draws about 150 mA
GNDGround
DOComparator output: changes state when gas concentration crosses the pot setting (about 5 V HIGH)
AOAnalog output rising with gas concentration (0–~5 V)

Use it with

Common errors

Readings drift for the first hours

New sensors need a burn-in of 24–48 hours powered on; every time after, allow a few minutes of warm-up before trusting the value.

ESP32 resets or the USB port cuts out

The heater pulls about 150 mA. Power the module from a proper 5 V supply, not a weak USB port or the 3.3 V pin.

Value changes with weather

Humidity and temperature shift the reading. Compare against a baseline recorded in clean air at similar conditions rather than a fixed number.

ESP32 ADC reads 4095 constantly

AO is above 3.3 V. Add the voltage divider and use an ADC1 pin.

↑↓ to move · Enter to open