Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

MQ Gas sensors

Using the MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, etc. gas sensors.

Navigation

(Photo by Krodal, Public Domain)


Introduction

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.

The output is an analog signal and can be read with an analog input of the Arduino.


Read the datasheet

Try to find a few datasheets for the sensor, and read them careful.

Since there are no electronic components inside, therefor most sensors can be used with AC and DC voltages.

Be careful when connecting it for the first time. If the pins are connected wrong, the sensor could get damaged, or it could be broken instantly. There are also shields available with these sensors pre-installed.


Wiring

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.

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.


Load-resistor

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.


Burn-in

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.


Interesting links


List of sensors

MQ-2

Sensitive for Methane, Butane, LPG, smoke.
This sensor is sensitive for flamable and combustible gasses.
The heater uses 5V.
The MQ-2 at seeed: http://www.seeedstudio.com/wiki/Grove_-_Gas_Sensor%28MQ2%29

Search for datasheet: http://duckduckgo.com/?q=%22mq-2%22+gas+sensor+filetype%3Apdf

MQ-3

Sensitive for Alcohol, Ethanol, smoke
The heater uses 5V
The Arduino blog about the "breathalyzer" using a MQ-3 : http://arduino.cc/blog/2010/09/23/arduino-breathalyzer-calibrating-the-mq-3-alcohol-sensor/
The MQ303A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-3%22+gas+sensor+filetype%3Apdf

MQ-4

Sensitive for Methane, CNG Gas
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq-4%22+gas+sensor+filetype%3Apdf

MQ-5

Sensitive for Natural gas, LPG
The heater uses 5V.
The MQ-5 at seeed: http://www.seeedstudio.com/wiki/Electronic_brick_-_Gas_sensor%28MQ5%29 and http://www.seeedstudio.com/wiki/Gas_Sensor_-_MQ5

Search for datasheet: http://duckduckgo.com/?q=%22mq-5%22+gas+sensor+filetype%3Apdf

MQ-6

Sensitive for LPG, butane gas
The heater uses 5V.
The MQ-6 at seeed: http://www.seeedstudio.com/wiki/Electronic_brick_-_Gas_sensor%28MQ6%29
The MQ306A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-6%22+gas+sensor+filetype%3Apdf

MQ-7

Sensitive for Carbon Monoxide
The heater uses an alternating voltage of 5V and 1.4V.
A library for the MQ-7 : http://thesis.jmsaavedra.com/prototypes/software/mq-7-breakout-arduino-library/
The MQ307A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-7%22+gas+sensor+filetype%3Apdf

MQ-8

Sensitive for Hydrogen Gas
The heater uses 5V.

Search for datasheet: http://duckduckgo.com/?q=%22mq-8%22+gas+sensor+filetype%3Apdf

MQ-9

Sensitive for Carbon Monoxide, flammable gasses.
The heater uses an alternating voltage of 5V and 1.5V. It depends on the gases how to use that alternating voltage. If only Carbon Monoxide is tested, the heater can be set at 1.5V.
The MQ309A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-9%22+gas+sensor+filetype%3Apdf

MQ131

Sensitive for Ozone
The heater uses 6V.

The load-resistor is 100k...200k, which is a lot higher than for other sensors. This sensor is also very sensitive. It measures in ppb (parts per billion) where other sensors measure in ppm (parts per million).

Search for datasheet: http://duckduckgo.com/?q=%22mq131%22+gas+sensor+filetype%3Apdf

MQ135

For Air Quality
Sensitive for Benzene, Alcohol, smoke.
The heater uses 5V.
An example how to use it: http://wiring.org.co/learning/basics/airqualitymq135.html

An example with calculation of the CO2 value: http://davidegironi.blogspot.it/2014/01/cheap-co2-meter-using-mq135-sensor-with.html

Search for datasheet: http://duckduckgo.com/?q=%22mq135%22+gas+sensor+filetype%3Apdf

MQ136

Sensitive for Hydrogen Sulfide gas.
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq136%22+gas+sensor+filetype%3Apdf

MQ137

Sensitive for Ammonia.
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq137%22+gas+sensor+filetype%3Apdf

MQ138

Sensitive for Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde gas, Hydrogen gas.
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq138%22+gas+sensor+filetype%3Apdf

MQ214

Sensitive for Methane, Natural gas.
The heater uses 6V.
Search for datasheet: http://duckduckgo.com/?q=%22mq214%22+gas+sensor+filetype%3Apdf

MQ216

Sensitive for Natural gas, Coal gas.

Search for datasheet: http://duckduckgo.com/?q=%22mq216%22+gas+sensor+filetype%3Apdf

MQ303A

Sensitive for Alcohol, Ethanol, smoke (just like the MQ-3)
The heater uses 0.9V
An example for the MQ302A http://insapio.com/2011/12/27/mq3-or-mq303a-alcohol-sensor/
It detects the same gasses as the MQ-3, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq303a%22+gas+sensor+filetype%3Apdf

MQ306A

Sensitive for LPG, butane gas
The heater uses 0.9V.
It detects the same gasses as the MQ-6, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq306a%22+gas+sensor+filetype%3Apdf

MQ307A

Sensitive for Carbon Monoxide
The heater uses an alternating voltage of 0.2V and 0.9.
It detects the same gasses as the MQ-7, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq307a%22+gas+sensor+filetype%3Apdf

MQ309A

Sensitive for Carbon Monoxide, flammable gasses.
The heater uses an alternating voltage of 0.2V and 0.9V. It depends on the gases how to use that alternating voltage.
It detects the same gasses as the MQ-9, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq309a%22+gas+sensor+filetype%3Apdf

MG811

Sensitive for Carbon Dioxide (CO2).
The heater uses 6V.
The signal from this gas sensor can be connected to the Arduino, but it's better to amplifly the signal with a OpAmp.
An example of this sensor (without an OpAmp) : http://itp.nyu.edu/physcomp/sensors/Reports/MG811

Search for datasheet: http://duckduckgo.com/?q=%22mg811%22+gas+sensor+filetype%3Apdf

AQ-104

For air quality

Search for datasheet: http://duckduckgo.com/?q=%22aq-104%22+gas+sensor+filetype%3Apdf

AQ-2

Sensitive for Flamable gasses, smoke

Search for datasheet: http://duckduckgo.com/?q=%22aq-2%22+gas+sensor+filetype%3Apdf

AQ-3

Sensitive for Alcohol, Benzine

Search for datasheet: http://duckduckgo.com/?q=%22aq-3%22+gas+sensor+filetype%3Apdf

AQ-7

Sensitive for Carbon Monoxide

Search for datasheet: http://duckduckgo.com/?q=%22aq-7%22+gas+sensor+filetype%3Apdf