Arduino gas sensor MQ2, Smoke Detector, Programming & Circuit

gas sensor mq2

Gas Sensor MQ2- In this Tutorial, you will learn how to use the Smoke/Gas sensor Mq2 with Arduino. MQ2 Sensor is one of the most commonly used Sensors throughout the world. This Sensor is most commonly used for the Smoke and Gas detection.

gas sensor mq2

This Gas Sensor mq2 Module features an MQ-2 sensor. The MQ-2 sensor is a versatile gas sensor capable of detecting a wide range of gases including alcohol, carbon monoxide, hydrogen, isobutene, liquefied petroleum gas, methane, propane, and smoke. This module is provided with male header interface and can be easily interfaced with Arduino/Mega using male to female type jumper wires.

In this tutorial, we will cover.

  • MQ2 Sensor Pinout
  • MQ2 sensor interfacing with Arduino
  • Mq2 sensor Programming and finally
  • Testing

Amazon Links:

Other Tools and Components:

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Gas Sensor MQ2 Pinout:

gas sensor mq2

The 4 male headers are labeled with

  • A0
  • D0
  • GND, and
  • VCC

A0 is the Analog output of the sensor and should be connected with the analog pin of the Arduino Uno or Mega.

D0 is the digital output in the form of 5v or Gnd. The level can be adjusted using the variable resistor.

GND pin of this module will be connected with GND of the Arduino or mega.

VCC should be connected with 5 volts of Arduino or mega.

Gas Sensor MQ2 Applications:

They are used in gas leakage detecting equipment in family and industry, are suitable for detecting of LPG, i-butane, propane, methane, alcohol, Hydrogen and smoke. MQ2 Gas/Smoke sensor is a very user-friendly Sensor and it can be easily interfaced with the Arduino Uno or Mega using Male to Female type Jumper wires.

Gas Sensor MQ2 Interfacing with Arduino Uno:

gas sensor mq2

As you can see I have already connected 3 jumper wires, red is connected with VCC of the sensor module, black is connected with the Ground of the sensor module and white is connected with the analog output(A0) of the sensor Module. I selected A0 for the Smoke or Gas detection as this way I get more control over the MQ2 Gas/Smoke sensor. Because this way I can make accurate decisions depending on the threshold value.

gas sensor mq2

So connect the red wire with the Arduino’s 5V.

Connect the Black wire with the Arduino’s Ground.

Finally, connect the white wire with analog pin A1 of the Arduino Uno.

So that’s all about the Interfacing of the MQ-2 sensor with the Arduino. The same connections can also be used with the Mega board. One more thing that I want to share with you guys is that any program which is written for the Arduino can also run on Mega except some special cases which I will discuss in my future tutorials.

Gas Sensor MQ2 Arduino Programming:

This is a very basic program written for the SMOKE/GAS SENSOR MODULE MQ-2. The purpose of this program is to show you how you can read this sensor. I have also used the same sensor in some advance level projects which are given below.

Gas leakage detector and Automatic Solenoid Valve shut down using Arduino and MQ-2 Sensor

Arduino Gas leakage detection and SMS alert

First of all, lets start by defining a pin for the A0 pin of the MQ2 Sensor. I Selected A1 pin of the Arduino Uno.


Источник: www.electroniclinic.com