Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino MQ-135: Print Indoor Air Quality Readings | ShillehTek

May 14, 2026 16 views

Arduino MQ-135: Print Indoor Air Quality Readings | ShillehTek
Project

Build an Arduino MQ-135 indoor air monitor that prints relative air-quality readings to Serial, so you can track changes over time with ShillehTek parts.

15 min Beginner3 parts

Project Overview

Arduino Nano + MQ-135 gas sensor: In this project you will wire an MQ-135 air quality sensor module to an Arduino and print a relative indoor air-quality reading to the Serial Monitor.

The MQ-135 is a tin-dioxide gas sensor that is sensitive to ammonia, NOx, alcohol, benzene, smoke, and CO2. It is a low-cost way to answer “did the air change?” for indoor monitoring.

  • Time: ~15 minutes
  • Skill level: Beginner
  • What you will build: An Arduino that reads the MQ-135 and prints a relative air-quality value.
MQ-135 air quality sensor module used with an Arduino for indoor air monitoring
The MQ-135 module includes the metal-mesh sensor element, a comparator, and analog/digital outputs.

Parts List

From ShillehTek

External

  • USB cable - powers the Arduino and connects to your computer
  • Arduino IDE - uploads the sketch and opens Serial Monitor

Note: The MQ-135 typically needs about 24 hours of burn-in before it settles. First-day readings drift, so let the sensor run through a day before trusting numbers.

Step-by-Step Guide

Step 1 - Inspect the module

Goal: Identify the MQ-135 pins and understand what outputs you will read with the Arduino.

What to do: Locate the sensor element under the metal cap and find the analog (AOUT) and digital (DOUT) outputs on the module.

Front view of an MQ-135 sensor module showing the heater cap, comparator IC, and trim potentiometer
Heater under the metal cap, comparator IC, and trim potentiometer for the digital threshold.
MQ-135 module pinout diagram showing VCC, GND, AOUT analog output, and DOUT digital output
4 pins: VCC, GND, AOUT (analog), DOUT (digital).

Expected result: You know you will use AOUT for the analog reading (and optionally DOUT if you want a threshold output later).

Step 2 - Wire it to the Arduino

Goal: Connect the MQ-135 analog output to an Arduino analog input so you can read it with analogRead().

What to do: Wire VCC to 5V, GND to GND, and AOUT to A0 on the Arduino Nano.

MQ-135 sensor module wired to an Arduino Nano with jumper wires: VCC to 5V, GND to GND, and AOUT to A0
VCC → 5V, GND → GND, AOUT → A0.

Expected result: The module powers on, and the Arduino is ready to sample A0.

Step 3 - Upload the Arduino sketch

Goal: Read the MQ-135 analog value and print both the raw ADC count and the calculated voltage.

What to do: Paste this code into the Arduino IDE, select the correct board and port, then upload.

Code:

const int MQ_PIN = A0;

void setup() {
  Serial.begin(9600);
  Serial.println("MQ-135 warming up... readings drift for 24 h.");
}

void loop() {
  int raw = analogRead(MQ_PIN);
  // Higher voltage = more pollution (lower sensor resistance).
  Serial.print("Raw="); Serial.print(raw);
  Serial.print("  V="); Serial.println(raw * (5.0 / 1023.0), 2);
  delay(1000);
}

Expected result: The Serial Monitor shows a new line each second with Raw= and V= values.

Step 4 - Watch it react in Serial Monitor

Goal: Confirm the sensor responds to changes in nearby air.

What to do: Open the Serial Monitor at 9600 baud. Breathe near the sensor or briefly wave a marker pen near it and watch the values change.

Arduino Serial Monitor displaying changing MQ-135 raw and voltage readings as air conditions change
Breathe near the sensor or wave a marker pen near it and the value spikes immediately.

Expected result: The readings spike or shift noticeably when the air near the sensor changes.

Step 5 - Where to take it next

Goal: Plan how to turn the raw signal into a useful monitoring project.

What to do: Choose one of these common next steps based on your use case.

  • Run a 24-hour log to find your baseline; alerts trigger above baseline + N
  • Combine with a DHT22 to log temperature and humidity alongside air quality
  • Drive a fan via relay above a threshold for auto-ventilation
  • Calibrate against a reference CO2 meter to convert raw counts to ppm

Expected result: You have a clear upgrade path for logging, alerting, and calibration.

Conclusion

You built an Arduino Nano project that reads the MQ-135 air quality sensor and prints a relative indoor air-quality value to the Serial Monitor. While the MQ-135 will not replace a lab-grade station, it is useful for tracking trends and detecting changes once it has burned in.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.