air-quality
Interfacing MQ 135 with Arduino Uno
What is the MQ 135?
An air-quality sensor commonly used in indoor air monitors, capable of sensing CO2, ammonia, benzene, and smoke. The MQ-135 is a metal-oxide semiconductor gas sensor whose surface resistance shifts in response to a broad mix of harmful gases and vapors, producing a single combined analog signal that rises with overall air-quality degradation — a popular, low-cost way to add general indoor air-quality monitoring to a home automation or environmental logging project, though it reports relative pollutant load rather than any single gas's precise concentration.
Specifications
| Sensor type | MQ-135 metal-oxide semiconductor (MOS) gas sensor, tuned for air-quality/pollutant gases |
| Operating voltage | 5 V DC |
| Detectable gases | NH3 (ammonia), NOx, benzene, CO2, alcohol vapor, smoke — broad-spectrum air-quality sensing rather than a single specific gas |
| Detection range | ~10-300 ppm depending on the target gas |
| Warm-up time | Requires several minutes of heater warm-up (some sources recommend a longer burn-in period) before readings stabilize |
| Output | Analog voltage proportional to overall detected gas concentration, plus a digital threshold output (DO) on breakout modules |
| Sensitivity adjustment | Onboard potentiometer sets the digital-output trigger threshold |
| Interface | 1 analog pin (AO) + 1 digital pin (DO, breakout-dependent) |
MQ 135 Pinout
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power, 5V DC (powers both the internal heater and sensing circuit) |
| 2 | GND | Ground |
| 3 | AO | Analog output — voltage proportional to combined air-quality gas concentration |
| 4 | DO | Digital output — threshold-triggered HIGH/LOW based on the onboard potentiometer setting |
Allow several minutes of heater warm-up before trusting readings, and treat the analog output as a general relative air-quality trend rather than a precise ppm reading for any single gas, since the sensor responds to a broad mix of gases simultaneously; results also drift with ambient humidity and temperature over time.
Setting Up MQ 135 with Arduino Uno
Library
—
No library required — this sensor outputs a plain analog voltage
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| VCC | 5V | MQ-135's heating element draws ~150mA — fine on Uno's 5V pin |
| GND | GND | — |
| AOUT | A0 | Analog output — raw ratio, not a calibrated ppm value |
Example code
Needs a 24–48 hour burn-in before readings stabilize, and the raw analog value is not ppm — converting to an actual gas concentration requires calibrating against a known-clean-air baseline (RZERO) per the datasheet's resistance curve. Treat the raw number as relative air-quality trend data unless you do that calibration.
Related Guides & Projects

Arduino Uno R3 Pinout: Every Pin Explained (Digital, Analog, PWM, Power)
Complete Arduino Uno R3 pinout reference: all 14 digital pins, 6 analog inputs, PWM, UART, SPI, I2C, AREF, and power rails explained with wiring tips and common mistakes.

Ultimate Arduino Mega 2560 Pinout Guide: Complete Power & I/O Reference
Master the Arduino Mega 2560 pinout. Detailed reference for all 54 digital pins, 16 analog inputs, PWM, UARTs, SPI, I2C, interrupts, and power. Includes a printable table and practical wiring tips.

Interfacing HC-SR04 Ultrasonic Sensor with Arduino
Measure distance accurately using ultrasonic sound waves and an Arduino Uno — no complex math, no expensive hardware.
HC‑SR04 Ultrasound Distance Measurement with Arduino – Parking Alert (LCD & Buzzer)
Learn HC‑SR04 ultrasound distance measurement with Arduino Uno. Build a parking alert system with 16x2 LCD and buzzer – shows distance and beeps faster as you approach.