Stufin
Home Quick Cart Profile

MQ-2 Gas Sensor Module For H2, LPG, CH4, CO, Smoke or Propane Detector Module

Buy Now on Stufin

Component Name

MQ-2 Gas Sensor Module For H2, LPG, CH4, CO, Smoke or Propane Detector Module

Overview

The MQ-2 Gas Sensor Module is a highly sensitive and reliable gas detection module designed to detect the presence of various combustible gases, including Hydrogen (H2), Liquefied Petroleum Gas (LPG), Methane (CH4), Carbon Monoxide (CO), smoke, and propane. This module is ideal for a wide range of applications, including industrial gas detection, home safety, and environmental monitoring.

Functionality

The MQ-2 Gas Sensor Module uses a metal oxide semiconductor (MOS) sensor to detect changes in the air composition. When a combustible gas is present, the sensor's resistance changes, which is then amplified and processed by the onboard circuitry. The module outputs an analog signal that corresponds to the concentration of the detected gas.

Key Features

  • High Sensitivity: The MQ-2 sensor has a high sensitivity to detect even slight changes in gas concentrations, ensuring accurate and reliable detection.
  • Multiple Gas Detection: The module can detect a variety of combustible gases, including H2, LPG, CH4, CO, smoke, and propane, making it a versatile solution for different applications.
  • Analog Output: The module provides an analog output signal, which can be easily read and processed by microcontrollers, such as Arduino, Raspberry Pi, or other embedded systems.
  • Simple Interface: The module has a simple interface with only three pins: VCC, GND, and OUT, making it easy to integrate into various projects.
  • Low Power Consumption: The MQ-2 Gas Sensor Module operates at a low voltage (5V) and consumes minimal power, making it suitable for battery-powered devices.
  • Compact Design: The module is designed in a compact form factor, making it easy to integrate into small devices or IoT projects.
  • Wide Operating Range: The module can operate in a wide temperature range (-20C to 50C) and humidity range (30% to 80% RH), ensuring reliable performance in various environmental conditions.

Operating Voltage

5V

Operating Current

150mA

Sensing Element

Metal Oxide Semiconductor (MOS)

Sensitivity

0.5-5.0 Volts/Gas Concentration (ppm)

Response Time

<10 seconds

Operating Temperature

-20C to 50C

Operating Humidity

30% to 80% RH

Dimensions

32 x 20 x 10 mm (1.26 x 0.79 x 0.39 inches)

Applications

Industrial gas detection and monitoring

Home safety and security systems

Environmental monitoring and air quality detection

IoT projects and devices

Robotics and automation

Important Notes

The MQ-2 Gas Sensor Module is not suitable for use in explosive environments.

The module should be calibrated before use to ensure accurate results.

The sensor's sensitivity and accuracy may vary depending on the specific gas being detected and environmental conditions.

Overall, the MQ-2 Gas Sensor Module is a reliable and versatile solution for detecting combustible gases in various applications. Its high sensitivity, multiple gas detection capabilities, and simple interface make it an ideal choice for developers, hobbyists, and professionals alike.

Pin Configuration

  • MQ-2 Gas Sensor Module Documentation
  • Overview
  • The MQ-2 Gas Sensor Module is a versatile gas detection module designed to detect various gases, including H2, LPG, CH4, CO, smoke, and propane. This module is widely used in various applications, such as gas leak detection, industrial automation, and environmental monitoring.
  • Pin Description
  • The MQ-2 Gas Sensor Module has 6 pins, which are described below:
  • 1. VCC (Power Supply) Pin
  • Pin Description: Power supply input pin
  • Pin Function: Supplies power to the module
  • Recommended Voltage: 5V DC
  • Connection: Connect to a 5V power source (e.g., Arduino board, breadboard, or a dedicated power supply)
  • 2. GND (Ground) Pin
  • Pin Description: Ground pin
  • Pin Function: Provides a common ground reference for the module
  • Connection: Connect to a common ground point (e.g., Arduino board, breadboard, or a dedicated power supply)
  • 3. OUT (Output) Pin
  • Pin Description: Analog output pin
  • Pin Function: Outputs an analog signal proportional to the detected gas concentration
  • Signal Type: Analog (0-5V)
  • Connection: Connect to an analog input pin on a microcontroller (e.g., Arduino) or an analog-to-digital converter (ADC)
  • 4. DOUT (Digital Output) Pin
  • Pin Description: Digital output pin
  • Pin Function: Outputs a digital signal (HIGH or LOW) based on a set threshold
  • Signal Type: Digital (HIGH or LOW)
  • Connection: Connect to a digital input pin on a microcontroller (e.g., Arduino)
  • 5. AOUT (Analog Output) Pin
  • Pin Description: Alternative analog output pin
  • Pin Function: Same as OUT pin, but with a different output signal
  • Signal Type: Analog (0-5V)
  • Connection: Connect to an analog input pin on a microcontroller (e.g., Arduino) or an analog-to-digital converter (ADC)
  • 6. HEAT (Heater) Pin
  • Pin Description: Heater pin
  • Pin Function: Supplies power to the internal heater element, which is used to heat the sensor
  • Recommended Voltage: 5V DC
  • Connection: Connect to a 5V power source (e.g., Arduino board, breadboard, or a dedicated power supply)
  • Connection Structure
  • To connect the MQ-2 Gas Sensor Module, follow this structure:
  • 1. Connect VCC to a 5V power source.
  • 2. Connect GND to a common ground point.
  • 3. Connect OUT to an analog input pin on a microcontroller (e.g., Arduino) or an analog-to-digital converter (ADC).
  • 4. Connect DOUT to a digital input pin on a microcontroller (e.g., Arduino).
  • 5. Connect AOUT to an analog input pin on a microcontroller (e.g., Arduino) or an analog-to-digital converter (ADC).
  • 6. Connect HEAT to a 5V power source.
  • Note: Ensure proper power supply and ground connections to avoid damage to the module or the connected devices. Additionally, handle the module with care, as it may be sensitive to physical stress or damage.

Code Examples

MQ-2 Gas Sensor Module Documentation
Overview
The MQ-2 Gas Sensor Module is a highly sensitive and reliable gas detection module capable of detecting various gases, including hydrogen (H2), liquefied petroleum gas (LPG), methane (CH4), carbon monoxide (CO), smoke, and propane. This module is widely used in various applications, such as gas leak detection, industrial process control, and home safety systems.
Pinout and Connections
The MQ-2 Gas Sensor Module has the following pinouts:
VCC: Power supply (5V or 3.3V)
 GND: Ground
 DOUT: Digital output (high/low signal indicating gas presence)
 AOUT: Analog output (voltage signal proportional to gas concentration)
Code Examples
### Example 1: Simple Gas Detection Using Digital Output (Arduino)
In this example, we will use the digital output of the MQ-2 module to detect the presence of gas.
```c++
const int gasSensorPin = 2;  // Connect DOUT to digital pin 2
void setup() {
  pinMode(gasSensorPin, INPUT);
  Serial.begin(9600);
}
void loop() {
  int sensorValue = digitalRead(gasSensorPin);
  if (sensorValue == HIGH) {
    Serial.println("Gas detected!");
  } else {
    Serial.println("No gas detected.");
  }
  delay(1000);
}
```
### Example 2: Analog Gas Concentration Measurement (Python with Raspberry Pi)
In this example, we will use the analog output of the MQ-2 module to measure the concentration of gas.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
gasSensorPin = 18  # Connect AOUT to analog pin 18
def read_gas_concentration():
  sensorValue = 0
  for _ in range(10):  # Take 10 readings and average
    sensorValue += GPIO.input(gasSensorPin)
  sensorValue /= 10
  return sensorValue
try:
  while True:
    gasConcentration = read_gas_concentration()
    print("Gas concentration: {0:.2f}%".format(gasConcentration))
    time.sleep(1)
except KeyboardInterrupt:
  GPIO.cleanup()
```
### Example 3: Gas Level Monitoring with LED Indicators (C with ESP32)
In this example, we will use the analog output of the MQ-2 module to monitor the gas level and indicate the level using LEDs.
```c
#include <WiFi.h>
const int ledPinRed = 18;  // Red LED for high gas level
const int ledPinYellow = 19;  // Yellow LED for medium gas level
const int ledPinGreen = 21;  // Green LED for low gas level
const int gasSensorPin = 32;  // Connect AOUT to analog pin 32
void setup() {
  pinMode(ledPinRed, OUTPUT);
  pinMode(ledPinYellow, OUTPUT);
  pinMode(ledPinGreen, OUTPUT);
  pinMode(gasSensorPin, INPUT);
}
void loop() {
  int sensorValue = analogRead(gasSensorPin);
  if (sensorValue > 500) {
    digitalWrite(ledPinRed, HIGH);
    digitalWrite(ledPinYellow, LOW);
    digitalWrite(ledPinGreen, LOW);
  } else if (sensorValue > 200) {
    digitalWrite(ledPinRed, LOW);
    digitalWrite(ledPinYellow, HIGH);
    digitalWrite(ledPinGreen, LOW);
  } else {
    digitalWrite(ledPinRed, LOW);
    digitalWrite(ledPinYellow, LOW);
    digitalWrite(ledPinGreen, HIGH);
  }
  delay(1000);
}
```
Notes and Precautions
The MQ-2 Gas Sensor Module requires a 24-hour preheat time before use to ensure optimal performance.
 The module is sensitive to temperature and humidity, which may affect its accuracy.
 The analog output of the module is not calibrated, and the output voltage may vary depending on the gas concentration and environmental conditions.
 It is recommended to use a voltage regulator to ensure a stable power supply to the module.
 When working with gas sensors, it is essential to follow proper safety protocols and handle the sensors with care to avoid exposure to hazardous gases.