ExplainerSensor & DevicesSensors

MQ Gas Sensors | Gas Sensors ?

MQ Gas Sensors is most commonly available Gas sensor series. In this article you can find a detail information about MQ Gas Sensors series.

GAS Sensors ?

A GAS sensor or a GAS Detector is a type of chemical sensor which detects/measures the concentration of gas in its vicinity. Gas sensor interacts with a gas to measure in concentration. They are used in various industries ranging from medicine to aerospace. Various technologies are used to measure Gas concentration such as semiconductors, oxidation, catalytic, infrared, etc. The most common types are as follows

  1. Metal Oxide Based GAS Sensor.
  2. Capacitance Based GAS Sensor.
  3. Acoustic Based GAS Sensor.
  4. Calorimetric GAS Sensor.
  5. Optical GAS Sensor.
  6. Electrochemical GAS Sensor.

Over here we will focus on the most commonly available GAS sensor which is Metal Oxide Gas Sensor or  Metal Oxide Semiconductor (MOS) also called as “Chemiresistors”.

Various gas sensors are available in the market but the most commonly available series is the “MQ Series”. Various gasses like, LPG, Carbon Monoxide (CO), Methane, Smoke, Alcohol, etc can be monitored using these sensors.

The MQ series of gas sensors use a small heater inside with an electro-chemical sensor. They are sensitive for a range of gasses and are used indoors at room temperature. They can be calibrated more or less (see the section about “Load-resistor” and “Burn-in”) but a know concentration of the measured gas or gasses is needed for that.

These Sensors used for general purpose only. If someone wants to build an alcohol tester or something similar, you should also be aware that these modules are not absolutely accurate and can not compete with a professional measurement.

How it Work

Here you can find some information about MQ-X Sensors.


The preferred wiring is to connect both ‘A’ pins together and both ‘B’ pins together. It is safer and it is assumed that is has more reliable output results. Although many schematics and datasheets show otherwise, you are advised to connect both ‘A’ pins together and connect both ‘B’ pins together.

wiring mq

In the picture, the heater is for +5V and is connected to both ‘A’ pins. This is only possible if the heater needs a fixed +5V voltage.

The variable resistor in the picture is the load-resistor and it can be used to determine a good value. A fixed resistor for the load-resistor is used in most cases.

The Vout is connected to an analog input of the Arduino.

The Heater

The voltage for the internal heater is very important.
Some sensors use 5V for the heater, others need 2V. The 2V can be created with a PWM signal, using analogWrite() and a transistor or logic-level mosfet.
The heater may not be connected directly to an output-pin of the Arduino, since it uses too much current for that.

Some sensors need a few steps for the heater. This can be programmed with an analogWrite() function and delays. A transistor or logic-level mosfet should also in this situation be used for the heater.

If it is used in a battery operated device, a transistor or logic-level mosfet could also be used to switch the heater on and off.

The sensors that use 5V or 6V for the internal heater do get warm. They can easily get 50 or 60 degrees Celcius.

After the “burn-in time”, the heater needs to be on for about 3 minutes (tested with MQ-2) before the readings become stable.


The sensor needs a load-resistor at the output to ground. Its value could be from 2kOhm to 47kOhm. The lower the value, the less sensitive. The higher the value, the less accurate for higher concentrations of gas.

If only one specific gas is measured, the load-resistor can be calibrated by applying a know concentration of that gas. If the sensor is used to measure any gas (like in a air quality detector) the load-resistor could be set for a value of about 1V output with clean air.

Choosing a good value for the load-resistor is only valid after the burn-in time.


Some datasheets use the term “preheat”, but it is the time to burn-in the sensor. This is meant to make the sensor readings more consistent. A time of 12 or 24 hours is usually used for the burn-in time.

The Burn-in is achieved by applying normal power to the sensor (to the heater and with the ‘A’ and ‘B’ pins connected, and with a load-resistor). In some special cases a specific burn-in is needed. See the datasheet if the sensor needs such a specific burn-in.

How To Read Data ?

You can read data easily if you are using ESP8266 NodeMCU, ESP32 and Arduino. The output is an analog signal and can be read with an analog input of the Arduino.

But We can’t easily read at the Raspberry Pi because mostly MQ-X sensors return analogue signals.but we can also use an analog-to-digital converter (ADC), which can be read out via the I2C bus. In addition, we also need a logic level converter. But some sensors have both A0 and D0 pin .

Types of MQ Gas Sensors

There are also many different sensors, which are already available for a few bucks and are suitable for different gases:

  • MQ-2 (Methane, Butane, LPG, smoke)
  • MQ-3 (Alcohol, Ethanol, smoke)
  • MQ-4 (Methane, CNG Gas)
  • MQ-5 (Natural gas, LPG)
  • MQ-6 (LPG, butane gas)
  • MQ-7 (Carbon Monoxide)
  • MQ-8 (Hydrogen Gas)
  • MQ-9 (Carbon Monoxide, flammable gasses)
  • MQ-131 (Ozone)
  • MQ-135 (Benzene, Alcohol, smoke)
  • MQ-136 (Hydrogen Sulfide gas)
  • MQ-137 (Ammonia)
  • MQ-138 (Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde gas)
  • MQ-214 (Methane, Natural gas)
  • MQ-216 (Natural gas, Coal gas)
  • MQ-303A (Alcohol, Ethanol, smoke)
  • MQ-306A (LPG, butane gas)
  • MQ-307A (Carbon Monoxide)
  • MQ-309A (Carbon Monoxide, flammable gasses)
  • MG811 (Carbon Dioxide (CO2))
  • AQ-104 (air quality)
  • AQ-2 (Flamable gasses, smoke)
  • AQ-3 (Alcohol, Benzine)
  • AQ-7 (Carbon Monoxide)

I recommend to use a sensor with a soldered PCB, because no further cabling and the use of resistors and capacitors is necessary.


Details on the individual Raspberry Pi/other device gas sensors can also be found in the corresponding data sheets. Simply google the name of the sensor including “datasheet”. There is also the voltage at which the sensor operates mentioned.


  • Process control industries
  • Environmental monitoring
  • Boiler control
  • Fire detection
  • Alcohol breath tests
  • Detection of harmful gases in mines
  • Home safety
  • Grading of agro-products like coffee and spices


  • High sensitivity
  • Fast response
  • Wide detection range
  • Stable performance and long life
  • Simple drive circuit

How To Use MQ Gas Sensors

Visit this : Interface MQ135 (Gas Sensor) with NodeMCU

Visit this : Using Mq135 Sensor with InfluxDB

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.



Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

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