MQ-135: gas or air quality sensor


In your projects you may need to have precise tools to check the air quality of an environment and detect the presence of harmful agents. He sensor MQ-135 It is what you were looking for, offering reliable and efficient detection of various gases harmful to health.

Here you can learn about features and applications of the MQ-135 sensor, highlighting its ability to detect gases such as ammonia, alcohol, benzene and smoke, and you will learn how to use it with Arduino…

What is MQ-135 sensor?


El MQ-135 module is a sensor indium-doped tin oxide semiconductor (In2O3-SnO2) that has an electrical conductivity that varies depending on the concentration of gases in its environment. This change in conductivity translates into a variation in the electrical resistance of the sensor, which can be measured and used to determine the concentration of gases present.

Among the gases that can be detected in the air are CO2, Alcohol, Nitrogen Oxide (NOx), Carbon Monoxide (CO), Ammonia (NH3), Sulfide, Benzene (C6H6), smoke and other gases harmful to health. Keep in mind that it is not possible to measure the quantity of each gas, it will simply help you determine the quality of the air by checking the existence of this type of gases.

Furthermore, you have to know that sensitivity may vary depending on the gas measured, for example:

  • Ammonia (NH3): 10ppm-300ppm
  • Benzene: 10ppm-1000ppm
  • Alcohol: 10ppm-300ppm

Regarding its operation, the MQ-135 sensor is based on the interaction between the gases present in the air and the sensitive surface of the sensor, composed of tin oxide doped with indium, as I indicated previously. When a gas comes into contact with the sensor surface, The gas molecules react with the oxygen atoms adsorbed on the surface, releasing electrons and modifying the electrical conductivity of the material..

La magnitude of the change in electrical conductivity depends on the concentration of the gas and its affinity by tin oxide doped with indium. Gases such as ammonia, alcohol, benzene and smoke, among others, have a high affinity for this material, which translates into significant changes in the electrical conductivity of the sensor.

MQ-135 Sensor Applications

The MQ-135 sensor finds a wide range of applications in various sectors, including:

  • Environmental monitoring, to detect air quality in a natural environment, for example.
  • Industrial safety to detect gas leaks that may be dangerous to workers.
  • Home automation, controlling air quality in smart homes and buildings, especially those located in large cities or close to factories.
  • Automation, for detecting gases in automated industrial processes and generating an action when the gas is detected.
  • Scientific research, for studies on air quality and the presence of harmful gases in various environments.

It should be added that this sensor is not only very versatile, but it is also cheap, has high sensitivity for various gases, is simple to use, is reliable and withstands adverse environmental conditions. However, it is also true that it has its limitations, since it is not selective only to one gas, it can be sensitive to environmental alterations such as humidity or temperature, its signal is not always linear when it detects the gas, so it is difficult to know the amount present, and its response time is not the fastest, so sudden changes in gas concentration may take time to be reflected...

About the gases detected by the MQ-135


As for the the gases detectedIt must be said that the MQ-135 is sensitive to a good amount of harmful gases. As I mentioned previously, among them are:

  • Carbon dioxide (CO2): This gas, if found in large quantities, can raise the acidity of the blood in oxygen-poor environments; it can also cause headaches, dizziness, drowsiness, nausea, confusion and difficulty breathing. If concentrations and exposure are high, it can cause even other major problems and even death. This is common in wine cellars during the fermentation process, where large quantities of this gas are generated and it has already caused death ("sweet death") to several people...
  • Alcohol (EtOH): These alcohol vapors can also result in poisoning, lung problems, altering the nervous system, causing vomiting, dizziness, etc.
  • Nitrogen oxides (NOx): in this other case we have an acid gas, which can cause irritation to the eyes, skin, respiratory tract, difficulty breathing, chest pain, lung damage, aggravate respiratory diseases, etc.
  • carbon monoxide (CO): Like dioxide, this other gas is quite problematic for health, producing quite similar symptoms, but it could even lead to death in severe cases of poisoning, so it is important to control its presence.
  • Ammonia (NH3): This other gas can also cause irritation to the eyes and respiratory tract, cough, chronic respiratory diseases, lung damage, etc.
  • Sulfide (S): Sulfides can also cause problems similar to ammonia.
  • Benzene (C6H6): This is another of the dangerous gases, which can cause milder effects such as headaches, dizziness, nausea, tissue irritation, but also other long-term problems such as reproductive problems, cancer such as leukemia, etc.
  • Smoke and others: The rest of the gases that the MQ-135 also detects can also cause breathing difficulties, especially for those with COPD, asthma, etc., as well as irritation of the eyes, respiratory tract, cough, chest pain, lung damage, cancer lung due to the particles present, etc.

MQ-135 with Arduino

Arduino IDE, data types, programming

First of all, it is important to know how to connect the MQ-135 module to the motherboard Arduino UNO so that it works correctly and we can start testing our code. To do this, it is very simple, you just have to look at the pinout of your module and connect in this way:

  • GND of the module will be connected to GND of the Arduino board.
  • VCC of the module will be connected to 5V of Arduino.
  • DOUT of the MQ-135 can be connected to an Arduino analog input, for example, pin A0.

On the other hand, you also have to download the MQ-135 library for Arduino IDE from this link. Once installed, we can start with the test code, which may be similar to the following:

#include "MQ135.h"
#define ANALOGPIN A0    
#define RZERO 206.85   
MQ135 gasSensor = MQ135(ANALOGPIN);
void setup()
  float rzero = gasSensor.getRZero();
  Serial.print("MQ135 RZERO Valor de calibración: ");
void loop() {
  float ppm = gasSensor.getPPM();
  Serial.print("Valores de CO2 en ppm: ");

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.