MQ135 Air Quality Sensor : Pin Configuration, Working & Its Applications

A device that is used to detect or measure or monitor the gases like ammonia, benzene, sulfur, carbon dioxide, smoke, and other harmful gases are called as an air quality gas sensor. The MQ135 air quality sensor, which belongs to the series of MQ gas sensors, is widely used to detect harmful gases, and smoke in the fresh air. This article gives a brief description of how to measure and detect gases by using an MQ135 air quality sensor.

The alternatives for the MQ135 air quality sensor/detector are MQ-2 (methane, LPG, butane, and smoke), MQ-3 (alcohol, smoke, and ethanol), MQ-4 (CNG gas and methane), MQ-5 (natural gas, and LPG), MQ-6 (butane and LPG), MQ-7 (CO), MQ-8 (Hydrogen), MQ-9 (CO, and flammable gases), MQ131 (ozone), MQ136 (Hydrogen sulfide gas), MQ137 (ammonia), MQ138 (benzene, alcohol, propane, toluene, formaldehyde gas, and hydrogen), MQ214 (methane, and natural gas), MQ303A (alcohol, smoke, Ethanol), MQ306A (LPG and butane), MQ307A(CO), MQ309A(CO and flammable gas).

What is an MQ135 Air Quality Sensor?

An MQ135 air quality sensor is one type of MQ gas sensor used to detect, measure, and monitor a wide range of gases present in air like ammonia, alcohol, benzene, smoke, carbon dioxide, etc. It operates at a 5V supply with 150mA consumption. Preheating of 20 seconds is required before the operation, to obtain the accurate output.

MQ135 Air Quality Sensor
MQ135 Air Quality Sensor

It is a semiconductor air quality check sensor suitable for monitoring applications of air quality. It is highly sensitive to NH3, NOx, CO2, benzene, smoke, and other dangerous gases in the atmosphere. It is available at a low cost for harmful gas detection and monitoring applications.

If the concentration of gases exceeds the threshold limit in the air, then the digital output pin goes high. The threshold value can be varied by using the potentiometer of the sensor. The analog output voltage is obtained from the analog pin of the sensor, which gives the approximate value of the gas level present in the air.

Pin Configuration:

The MQ135 air quality sensor is a 4-pin sensor module that features both analog and digital output from the corresponding pins. The MQ135 air quality sensor pin configuration is shown below.

For MQ135 Air Quality Sensor Module:

The MQ135 air quality sensor module is shown below.

MQ135 Air Quality Sensor Pin Configuration
MQ135 Air Quality Sensor Pin Configuration

Pin 1: VCC: This pin refers to a positive power supply of 5V that power up the MQ135 sensor module.

Pin 2: GND (Ground): This is a reference potential pin, which connects the MQ135 sensor module to the ground.

Pin 3: Digital Out (Do): This pin refers to the digital output pin that gives the digital output by adjusting the threshold value with the help of a potentiometer. This pin is used to detect and measure any one particular gas and makes the MQ135 sensor work without a microcontroller.

Pin 4: Analog Out (Ao): This pin generates the analog output signal of 0V to 5V and it depends on the gas intensity. This analog output signal is proportional to the gas vapor concentration, which is measured by the MQ135 sensor module. This pin is used to measure the gases in PPM. It is driven by TTL logic, operates with 5V, and is mostly interfaced with microcontrollers.

For the MQ135 Air Quality Sensor:

The MQ135 air quality sensor is shown below.

MQ135 Air Quality Sensor
MQ135 Air Quality Sensor

H-pins: There are 2 H-pins, where one is connected to the voltage supply and the other is connected to the ground.

A-pins: Here A-pins and B-pins can be interchanged. These are connected to the voltage supply.

B-pins: Here A-pins and B-pins can be interchanged. One pin is used to generate output while the other pin is connected to the ground.

Specifications and Features:

The MQ135 air quality sensor specifications and features are listed below.

  • It has a wide detection scope.
  • High sensitivity and faster response.
  • Long life and stability.
  • The operating voltage: +5V.
  • Measures and detects NH3, alcohol, NOx, Benzene, CO2, smoke etc.
  • Range of analog output voltage: 0V-5V.
  • Range of digital output voltage: 0V-5V (TTL logic).
  • Duration of preheating: 20 seconds.
  • Used as an analog or digital sensor.
  • The potentiometer is used to vary the sensitivity of the digital pin.
  • Heating Voltage: 5V±0.1.
  • Load resistance is adjustable.
  • Heater resistance: 33ohms±5%.
  • Heating consumption:<800mW.
  • Operating temperature: -10°C to -45°C.
  • Storage temperature: -20°C to -70°C.
  • Related humidity: <95%Rh.
  • Oxygen concentration: 21% (affects the sensitivity).
  • Sensing resistance: 30kiloohms to 200kiloohms.
  • Concentration slope rate: ≤0.65.
  • Preheat time: over 24 hrs.
  • Simple drive circuit.

How to Detect and Measure Gases using the MQ135 Air Quality Sensor:

To measure or detect the gases, use analog pins or digital pins. Just apply 5V to the module and you can observe that the module’s power LED turns ON (glows) and the output LED turns OFF when no gas is detected by the module. This means that the output of the digital pin is 0V. Note that the sensor must be kept for preheating time for 20seconds (as mentioned in the specifications) before the actual operation.

Now, once when the MQ135 sensor is operated to detect, then the LED output goes high along with the digital output pin. Otherwise, use the potentiometer until the output increases. Whenever the sensor detects a certain gas concentration, the digital pin goes high (5V), otherwise it stays low (0V).

We can also use analog pins to get the same result. The output analog values ​​(0-5V) are read from the microcontroller. This value is directly proportional to the gas concentration detected by the sensor. By the experimental values, we can observe the working and reaction of the MQ135 sensor with different gas concentrations and the programming developed accordingly.

How to Measure PPM (parts per million) using the MQ135 Air Quality Sensor:

The MQ-135 gas sensor uses SnO2, a gas-sensitive material that has higher resistance in clean air. An increase in the number of harmful gases decreases the resistance of the gas MQ135 sensor. To measure PPM with the MQ-135 air quality sensor, observe the graph between (Rs/Ro) and PPM shown below.

MQ135 Air Quality Sensor - PPM Graph
MQ135 Air Quality Sensor – PPM Graph
  • The typical sensitivity characteristics of the MQ135 sensor are shown in the above graph.
  • Temperature is 20°C, humidity is 65%, the concentration of O2 is 21% and load resistance RL is 20kilo ohms.
  • Here Ro refers to the resistance value of the sensor at 100ppm of NH3 in clean air or fresh air.
  • Rs refers to the resistance of the sensor at several gas concentrations.
  • We can calibrate the MQ135 sensor by determining the Rs value from the below formula,
  • Resistance of sensor Rs = (Vc/VRL-1)RL
  • After calculating the Ro and Rs values, the ratio is found, and using the above graph we can calculate the PPM value of the particular gas, which is to be measured.

How to Interface the MQ135 Air Quality Sensor with Arduino:

The circuit diagram of interfacing the MQ135 air quality sensor with Arduino is shown below. The components required are,

MQ135 Air Quality Sensor Interface with Arduino
MQ135 Air Quality Sensor Interface with Arduino
  • MQ135 air quality sensor
  • Arduino UNO
  • The power supply of 5V
  • Connecting wires.

Connections are made as per the circuit diagram shown above. The MQ135 sensor’s VCC pin is connected to the Arduino’s 5V pin. This power ups the MQ135 sensor. The analog output pin Ao and digital output pin Do of the MQ135 sensor are connected to the Ao and pin 2 of the Arduino. Finally, the ground pins of the MQ135 and the Arduino are connected to a common ground. This interfacing circuit gives both digital and analog outputs of the MQ135 air quality sensor.

When the Ao (analog output) of the MQ135 is higher than the 400, then the LED turns ON, which is connected to pin 2 of the Arduino board. Else the LED turns OFF. Observe the readings of both digital and analog outputs of the sensor on the LCD or monitor.

Upload the Arduino code as shown below for gas detection.

int sensorValue; (int variable to read analogue output reading)

int digitalValue; (int variable to read digital output reading)

void setup()


Serial.begin(9600); // sets the serial port to 9600 (sets the serial communication to 9600 baud rate)

pinMode(13, OUTPUT); (pin 13 is connected to the anode terminal of the LED as an output)

pinMode(2, INPUT); (pin 2 of Arduino is connected to the Do pin of the MQ135 as an input)


void loop()


sensorValue = analogRead(0); // read analogue input pin 0 (to read the analogue input on Ao)

digitalValue = digitalRead(2); (to read and save the digital output on pin 2 of Arduino)

if (sensorValue > 400)


digitalWrite(13, HIGH); (if the analogue reading is greater than 400, then the LED turns ON)



digitalWrite(13, LOW); (if the analogue reading is less than 400, the LED turns OFF)

Serial.println(sensorValue, DEC); // prints the value read

Serial.println(digitalValue, DEC);

delay(1000); // wait 100ms for the next reading   (analogue and digital output readings are displayed on the monitor)


Where to Use/Applications of MQ135 Air Quality Sensor:

The applications of the MQ135 quality sensor are,

  • Used in the detection of excess or leakage of gases like nitrogen oxide, ammonia, alcohol, aromatic compounds, smoke, and sulfide.
  • Used as air quality monitors.
  • Used in air quality equipment for offices and buildings.
  • Used as a domestic air pollution detector.
  • Used as an industrial air pollution detector.
  • Works as a portable air pollution detector.

Please refer to this link for MQ135 Air Quality sensor Datasheet

Thus, this is all about an overview of the MQ135 air quality sensor. There are different types of MQ series air quality gas sensors available in the market based on the type of gas detection. Check the datasheet and select the required air quality sensor for the gas monitoring application.

Add Comment