Arduino Projects

Explain MQ2, MQ3, MQ7 and MQ135 Gas Sensor With Arduino Tutorials

In this tutorial, we will be interfacing Gas Sensors MQ2, MQ3, MQ7, and MQ135 Gas Sensor With Arduino board to build a gas leakage detector. The gas sensor is a widely used sensor for detecting a number of gases, including carbon monoxide and methane gas.

[the_ad id=”5035″]

Thank You NextPCB:

This project is successfully finished because of the service and support from NextPCB. NextPCB is one of the most professional PCB manufacturers in Global and has specialized in the PCB and assembly industry for over 16 years. Not only could NextPCB deliver the most creative printed circuit boards and assembly technologies in the most elevated quality standards, but the fastest delivery turnaround was also as fast as 24 hours.

Guys if you have a PCB project, please visit their website and get exciting discounts and coupons. if you sign-up using this link you will get free coupons worth $100. Checkout out NextPCB now and get amazing discounts on your first order.

The MQ series gas sensors are analog sensors so they are easy to implement with any microcontroller.

MQ2-Gas-Sensor

MQ series sensors are electrochemical and change their resistance when exposed to specific gases, internally it has a heater responsible for increasing the internal temperature and with this, the sensor can react with the gases pushing a change in the resistance value. Depending on the model, the heater may need a voltage between 5 and 2 volts, the sensor behaves like a resistor and needs a load resistor (RL) to close the circuit and with this make a voltage divider and be able to read it from a microcontroller:

The internal structure of the MQ Series Sensor

Internal structure of MQ2 Gas Sensor

Due to the heater, it is necessary to wait for a heating time so that the output is stable and has the features that the works show in its datasheets, this time, depending on the model, can be between 12 and 48 hours.

In the market, MQ sensors are generally found in modules, which facilitates the connection part and makes it more comfortable for us to use, it is enough to power the module and starts reading the sensor, these modules also have a digital output that internally It works with a comparator and with the help of a potentiometer we can calibrate the threshold and thus be able to interpret the digital output as the presence or absence of gas.

Different Types of MQ Gas Sensor With Arduino

MQ2 gas sensor

The difference between the various types of MQ series sensors is the sensitivity to a specific range of gases, more sensitive to some gases than others, but they always detect more than one gas, so it is necessary to review the datasheets to choose the right sensor for our applications. The MQ2 gas sensor is a popular choice for multiple applications, including home protection, industrial monitoring, and environmental monitoring. The MQ2 gas sensor is a reliable and inexpensive, gas sensor that can be used in a variety of applications.

[the_ad id=”5035″]

MQ Gas Sensor Series

MQ gas sensor series are the most standard gas sensors. These sensors have different models for detecting different gases, some of which are listed in the following table:

gas sensor datasheet

Model Object detected Heater
MQ-2 Methane, butane, LPG, humus 5V
MQ-3 alcohol, ethanol, smoke 5V
MQ-303A alcohol, ethanol, smoke 0.9V
MQ-4 Methane, compressed natural gas (CNG) 5V
MQ-5 Gas natural, GLP 5V
MQ-6 Butano, GLP 5V
MQ-306A Butano, GLP 0.9V
MQ-7 Carbon monoxide Alternate 5V and 1.4V
MQ-307A Carbon monoxide Alternate 0.2 and 0.9V
MQ-8 Hydrogen 5V
MQ-9 Carbon monoxide, flammable gases Alternate 5V and 1.5V
MQ-309A Carbon monoxide, flammable gases Alternate 0.2 and 0.9V
MQ-131 Ozone 6V
MQ-135 benzene, alcohol, smoke, air quality 5V
MQ-136 hydrogen sulfide 5V
MQ-137 Ammonia 5V
MQ-138 benzene, toluene, alcohol, acetone,
propane, formaldehyde, hydrogen
5V
MQ-214 Methane, natural gas 5V
MQ-216 natural gas, coal gas 6V
MG-811 Carbone dioxide 6V
AQ-104 Air quality *
AQ-2 Flammable gases, smoke
AQ-3 Alcohol, Benzene
AQ-7 Carbon monoxide

Below we detail the main MQ sensors

[the_ad id=”5038″]

1. MQ-2 Smoke and Flammable

MQ2 Gas Sensor
MQ2 Gas Sensor

The MQ2 sensor can be used to create a gas leakage detector that can be used to alert of potentially dangerous gas leaks. This is a powerful Gas sensor suitable for detecting LPG, Smoke, Alcohol, Propane, Hydrogen, Methane, and Carbon Monoxide concentrations anywhere from 200 to 10000ppm. Being more sensitive to LPG and propane.

2. MQ3 Alcohol Sensor

MQ-3-Alcohol-Gas-Sensor
MQ3 Alcohol Sensor

MQ3 sensor is very sensitive to alcohol and less sensitive to benzine, it is also sensitive to gases such as LPG, Hexane, CO, and CH4 but with very low sensitivity, which can be ignored if there is little concentration of these. It is a highly sensitive sensor that can detect even very low concentrations of alcohol.

3. MQ-5 Natural Gas Detector Sensor

MQ-5 Natural Gas Detector Sensor
MQ-5 Natural Gas Detector Sensor

The MQ-5 Natural Gas Detector Sensor is a low-cost, reliable sensor that can detect the presence of natural gas in the environment, The MQ-5 Natural Gas Detector Sensor is a valuable tool for anyone who needs to monitor the presence of natural gas in their environment.

4. MQ7 Carbon Monoxide Sensor

MQ7 Carbon Monoxide Sensor
MQ7 Carbon Monoxide Sensor

MQ7 Carbon Monoxide Sensor is a semiconductor sensor that is used to detect the presence of carbon monoxide in the air. MQ7 sensor is highly sensitive to carbon monoxide (CO) but is also sensitive to H2.

5. MQ-9 Combustible Gas Detector

MQ-9 Combustible Gas Detector
MQ-9 Combustible Gas Detector

The MQ-9 Combustible Gas Detector is a reliable and cost-effective way to detect the presence of combustible gases. The MQ-9 is able to detect a wide range of combustible gases, including methane, propane, and butane. MQ-9 sensor is also able to detect hydrogen gas.

6. MQ135 Air Quality Sensor

MQ135 Air Quality Sensor
MQ135 Air Quality Sensor

The MQ135 sensor is a popular and inexpensive sensor that can be used to measure air quality. This sensor is placed in the air inlet of air conditioners and air purifiers to monitor the air quality. The MQ135 sensor measures the concentration of carbon monoxide, nitrogen dioxide, and ozone in the air.

How does MQ Sensor work?

The most common use for the MQ type of sensor is to detect the presence of methane, but it can also be used to detect other gases such as carbon monoxide and hydrogen sulfide. The MQ2 sensor is a very sensitive device, and it can be used to detect very small concentrations of gas in the air. This makes it an ideal tool for use in gas leak detection applications. The sensor is able to produce a voltage output that is proportional to the concentration of the gas present in the air. Check lastminuteengineers Gas sensor Tutorial

Scaling MQ sensors

The characteristic curve of sensitivity of temperature: In the example below, we use the analog reading to determine the gas concentration, usually in ppm (parts per million), but some sensors use other units such as mg/L or bpm (parts per billion).

Characteristic curve of sensitivity

The MQ modules are sensitive to more than one gas and in a different proportion to each one, so if the objective is to obtain the values ​​in units corresponding to the concentration of the measured gas, it is necessary to carry out a scaling process through software based on the sensitivity characteristic curve.

For example, the following image shows the concentration curves of each gas measured in an MQ-2 sensor

[the_ad id=”5035″]

MQ Sensor Pinout

  • Now let’s have a look at the pinout.MQ2 Sensor Pinout
  • A/O provides an analog output voltage that is proportional to the concentration of gas.
  • D/O provides a digital representation of the presence of gases.
  • GND is the Ground Pin and needs to be connected to the GND pin on the microcontroller.
  • VCC supplies power for the module. You can connect it to 5V output from your microcontroller board.

Wiring Diagram For DIGITAL READING

MQ Sensor circuit diagram

Wiring Diagram For ANALOG READING

MQ Sensor circuit analog read e1654491919783

MQ Gas sensor with Arduino working code

  1. MQ_Sensor Calibration
  2. DIGITAL READING
  3. ANALOG READING 

1.  MQ_Sensor Calibration Code

2. Digital reading of the MQ Gas Sensor With Arduino

The same MQ sensor data can be read on two different types, whose operation is the same but they have a different order of pins:

Connections

The connection to read the digital output would be as follows:

Arduino –> Sensor Gas Sensor With Arduino

  • 5V –> VCC
  • GND –> GND
  • D8–> D0

In the example, we will use an MQ-2 (Gas sensor) but the program is the same for any MQ module if the digital output is used since this output acts as 1 or 0. Note that this output is negated, 1 for no Gas and 0 for the presence of Gas.

3. Analog reading of MQ Gas Sensor With Arduino

For this case we must connect the analog output of the module to an analog input of the Arduino board:  The difference between using the digital output is that using the analog output we can work with different levels of gas presence and scale it according to the requirements of our application.

Connections Gas Sensor With Arduino

Arduino –> Sensor

  • 5V –> VCC
  • GND –> GND
  • A0 –> A0

As this is an analog output, the code is the same for whatever type of MQ sensor you are working with.

Because the module has a heating chamber where the gas has to enter or exit, the response time is slow, and the sensor will continue to detect the gas residues that remain inside the heating partition until they disappear.

Below we show values ​​that were obtained for the MQ Gas sensor without exposure to gas.

And when we expose to air with alcohol the data obtained are the following:

Gas Sensor With Arduino

[the_ad id=”5035″]

Related Articles

Leave a Reply

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

Ad
Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker