Part

Air quality sensor, MQ-135

An MQ-135 air quality sensor on an LM393 board. It reacts to NH3, CO2, alcohol, benzene and more and cannot tell them apart; CO2 is read above the air’s own. It reads high while it warms up. Drag the slider to let gas in.

See every part
  • 4 pins
  • 5 settings
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The Air quality sensor, MQ-135 in brief

What it is, and every setting the properties panel gives it.

The MQ-135 is Hanwei’s air quality sensor: a heated tin dioxide element on the same blue four-pin LM393 board as the MQ-2, with pins VCC, GND, DO and AO. The heater wants 5.0 volts and about 150 mA, so on an Uno it runs from 5 V with AO on an analog pin, and beside an ESP32 from the 5 V (VIN) pin too, with a divider on AO before an ADC pin, because AO can climb toward 5 volts. Mokxi follows the MQUnifiedsensor fits of the datasheet chart, ppm = a x (Rs/R0)^b, with R0 30 k, a 1 k load, clean air at 3.6 R0, and a gas property choosing CO2, NH3, alcohol, toluene, acetone or CO. The slider is 0 to 1000 ppm, and CO2 counts above the air’s own 420 or so. Clean air reads about 46 mV, nine or ten counts on an Uno, and for its 20 second warm-up the board reads high before it sinks. The classic mistake is treating it as a CO2 meter: it cannot tell CO2 from a breath or a solvent. Burn-in, humidity, temperature, the heater’s current draw and mixed gases are not modeled.

Family
Sensors
Pins
4
gas
co2 (or nh3, alcohol, toluene, acetone, co)
r0
30000
rl
1000
threshold
0.1
warmup
20
Pins

4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
Role
What it does
VCC
Input or output
Supply, 5 V. The heaters are specified at 5.0 V and draw about 150 mA. On 3.3 V the board runs with a cool element, as the MQ-2 page describes: lower, flatter readings and a longer warm-up.
GND
Input or output
Ground.
DO
Output
Low when the gas is past the trimmer (the MQ-131: when the ozone is). Open collector with a 10 k pull-up.
AO
Output
The sensor over the load resistor. Higher means more gas, except on the MQ-131.
How to use it

How to use the MQ-135 with an Arduino

Wire VCC to 5 V, GND to GND and AO to an analog pin; DO is optional. In the example the MQ-135 is the first of six MQ sensors on the breadboard, with AO on A0, and the sketch prints analogRead() of all six once a second. More gas lowers the element’s resistance, so the number rises.

Give it time. A cold element reads as if the room were full of gas, so for the first 20 seconds the count starts high and sinks; a sketch that sounds an alarm on its first reading goes off at every power-up. After that, clean air on the board’s 1 k load is only about 46 mV, nine or ten counts, and the whole 0 to 1000 ppm slider of CO2 stays in the bottom tenth of the ADC.

It is not a CO2 meter. Ammonia, alcohol, toluene, acetone and CO all move it too, and it cannot tell them apart; the gas property picks which one this run has in the air.

Part pin
Board pin
AO
A0
VCC
5 V
GND
GND

The heater needs 5 V on every board, so beside an ESP32 run VCC from the 5 V (VIN) pin and put a divider between AO and the ADC pin, since AO can rise toward 5 V in heavy gas.

Arduino Uno: six MQ gas sensors on A0 to A5live0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
How it is modeled

What is true about the Air quality sensor, MQ-135, here

In its help article’s own words: what the simulation gets right, and where it stops.

Not modeled

The MQ-7's and MQ-9's heater cycle. Their sheets run the heater at 5 V for 60 s, then 1.4 V (MQ-7) or 1.5 V (MQ-9) for 90 s, and read CO at the end of the low phase; the CO line is that phase's. The blue boards have no circuit for the cycle and hold the heater at 5 V, where the real element does not follow its CO line at all. This model reads the CO line all the time, and the part's description says so. The cycle is not simulated yet.

CO2 on the MQ-135. The chart's CO2 line runs from 10 to 200 ppm, but the air already holds about 420 ppm, which the sensor reads as part of clean air. The slider is CO2 above that, which is how the library's CO2 example takes it (it adds 400). The MQ-135 cannot tell CO2 from ammonia, alcohol or a breath; one gas at a time is modeled, the one in gas.

Everything the MQ-2 page lists: the 24 to 48 hour burn-in the sheets ask for, the heater's current, humidity and temperature, mixtures of gases.

From MQ gas sensors: MQ-3 to MQ-137, in full.

Projects

See the Air quality sensor, MQ-135 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Air quality sensor, MQ-135 in it.

Wire up the Air quality sensor, MQ-135

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.