Stufin
Home Quick Cart Profile

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

Buy Now on Stufin

Component Name

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

Overview

The MQ-2 gas sensor is a highly sensitive and reliable device designed to detect the presence of various combustible gases, including H2, LPG, CH4, CO, smoke, and propane. This sensor is widely used in various applications, such as industrial automation, home security systems, and air quality monitoring devices.

Functionality

The MQ-2 gas sensor detects the concentration of target gases in the surrounding air and outputs an analog signal corresponding to the gas concentration. The sensor uses a sensitive material that changes its resistance when exposed to the target gases, which is then converted into an electrical signal.

Key Features

  • Detection Range: The MQ-2 sensor can detect a wide range of gas concentrations, from 100 ppm to 10,000 ppm, depending on the specific gas type.
  • Fast Response Time: The sensor responds quickly to changes in gas concentrations, typically within 10-30 seconds.
  • High Sensitivity: The MQ-2 sensor has a high sensitivity to the target gases, ensuring accurate detection even at low concentrations.
  • Stability and Reliability: The sensor is designed to provide stable and reliable performance over a long period, with minimal drift or false alarms.
  • Low Power Consumption: The sensor operates at a low voltage ( Typically 5V) and consumes minimal power (Typically 150mA), making it suitable for battery-powered devices.
  • Analog Output: The sensor outputs an analog signal that can be easily connected to an analog-to-digital converter (ADC) or a microcontroller for further processing.
  • Simple Interface: The sensor has a simple interface with four pins: VCC, GND, and two output pins (OUT and AOUT).
  • Compact Size: The sensor is compact and lightweight, making it suitable for use in a wide range of applications where space is limited.
  • Operating Temperature: The sensor operates accurately over a wide temperature range of -20C to 50C.
  • RoHS Compliance: The sensor is RoHS-compliant, ensuring it meets the environmental regulations for electronic devices.

Applications

  • Industrial automation: monitoring gas levels in industrial processes and detecting leaks.
  • Home security systems: detecting gas leaks and alerting homeowners.
  • Air quality monitoring devices: monitoring indoor and outdoor air quality.
  • Breath analysis devices: detecting the presence of combustible gases in exhaled breath.
  • Portable gas detectors: creating handheld devices for on-site gas detection.
The MQ-2 gas sensor is suitable for a wide range of applications, including

Operating Voltage

5V

Operating Current

150mA

Detection Range

100 ppm to 10,000 ppm (depending on the gas type)

Response Time

10-30 seconds

Output Signal

Analog signal (0-5V)

Sensitivity

High sensitivity to target gases

Temperature Range

-20C to 50C

Humidity Range

5-90% RH

Dimension

20mm x 15mm x 10mm

Weight

10g

Note

The technical specifications may vary depending on the specific vendor and version of the MQ-2 gas sensor. Always refer to the datasheet provided by the manufacturer for specific details.

Pin Configuration

  • MQ-2 Gas Sensor Documentation
  • Overview
  • The MQ-2 Gas Sensor is a versatile and widely used sensor for detecting various gases, including Hydrogen (H2), Liquefied Petroleum Gas (LPG), Methane (CH4), Carbon Monoxide (CO), Smoke, and Propane. This sensor is highly sensitive and has a fast response time, making it suitable for various applications, including industrial, domestic, and environmental monitoring.
  • Pinouts and Connections
  • The MQ-2 Gas Sensor has 6 pins, which are explained below:
  • 1. VCC (Power Supply)
  • Pin location: Top-left pin
  • Description: This pin is used to connect the power supply (typically 5V) to the sensor.
  • Connection: Connect to a 5V power source, such as an Arduino board or a breadboard power supply.
  • 2. GND (Ground)
  • Pin location: Top-right pin
  • Description: This pin is used to connect the ground of the sensor.
  • Connection: Connect to a common ground point, such as the GND pin on an Arduino board or a breadboard.
  • 3. DOUT (Digital Output)
  • Pin location: Bottom-left pin
  • Description: This pin provides a digital output signal indicating the presence of gas. The output is HIGH when the gas concentration exceeds the set threshold.
  • Connection: Connect to a digital input pin on a microcontroller, such as an Arduino board, to read the output signal.
  • 4. AOUT (Analog Output)
  • Pin location: Bottom-center pin
  • Description: This pin provides an analog output signal proportional to the gas concentration.
  • Connection: Connect to an analog input pin on a microcontroller, such as an Arduino board, to read the analog output signal.
  • 5. HEATER (Heating Element)
  • Pin location: Bottom-right pin
  • Description: This pin is used to connect the heating element, which is required for the sensor to operate.
  • Connection: Connect to a power supply (typically 5V) and a current limiting resistor (e.g., 1 k) to ensure stable heating.
  • 6. No Connection (NC)
  • Pin location: Top-center pin
  • Description: This pin is not connected internally and should be left unconnected.
  • Connection Diagram
  • Here is a sample connection diagram for the MQ-2 Gas Sensor:
  • ```
  • +---------------+
  • | Power Supply |
  • | (5V, 1A) |
  • +---------------+
  • |
  • |
  • v
  • +---------------+
  • | MQ-2 Gas Sensor |
  • | (VCC) |
  • +---------------+
  • |
  • |
  • v
  • +---------------+
  • | Microcontroller |
  • | (e.g., Arduino) |
  • +---------------+
  • |
  • |
  • v
  • +---------------+
  • | Breadboard/Alias |
  • | (GND) |
  • +---------------+
  • +---------------+
  • | MQ-2 Gas Sensor |
  • | (DOUT) |
  • +---------------+
  • |
  • |
  • v
  • +---------------+
  • | Microcontroller |
  • | (Digital Input) |
  • +---------------+
  • +---------------+
  • | MQ-2 Gas Sensor |
  • | (AOUT) |
  • +---------------+
  • |
  • |
  • v
  • +---------------+
  • | Microcontroller |
  • | (Analog Input) |
  • +---------------+
  • +---------------+
  • | MQ-2 Gas Sensor |
  • | (HEATER) |
  • +---------------+
  • |
  • |
  • v
  • +---------------+
  • | Power Supply |
  • | (5V, 1A) |
  • +---------------+
  • |
  • |
  • v
  • +---------------+
  • | Resistor (1 k) |
  • +---------------+
  • ```
  • Note: The connection diagram above is for illustrative purposes only. Please ensure proper connections and voltage levels according to the specific requirements of your project.

Code Examples

MQ-2 Gas Sensor Module Documentation
Overview
The MQ-2 Gas Sensor is a widely used module for detecting various types of gases, including H2, LPG, CH4, CO, smoke, and propane. This module is sensitive to a wide range of gases and is often used in applications such as gas leakage detection, industrial automation, and home safety systems.
Pinout and Wiring
The MQ-2 Gas Sensor module has a total of 5 pins:
VCC: Power supply pin (typically 5V)
 GND: Ground pin
 DOUT: Digital output pin
 AOUT: Analog output pin
 Heating Pin: Used to heat the sensor element (typically connected to a digital pin)
Operating Principle
The MQ-2 Gas Sensor works on the principle of catalytic combustion, where the gas molecules react with the sensor material to produce a varying resistance. The sensor element is heated to increase its sensitivity and accuracy.
Code Examples
### Example 1: Basic Gas Detection using Digital Output
In this example, we will connect the MQ-2 Gas Sensor to an Arduino board and use the digital output 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 gasValue = digitalRead(gasSensorPin);
  if (gasValue == HIGH) {
    Serial.println("Gas detected!");
  } else {
    Serial.println("No gas detected.");
  }
  delay(1000);
}
```
### Example 2: Gas Concentration Measurement using Analog Output
In this example, we will connect the MQ-2 Gas Sensor to an ESP32 board and use the analog output to measure the concentration of gas.
```c
const int gasSensorPin = 32; // Connect AOUT to analog pin 32
void setup() {
  Serial.begin(9600);
}
void loop() {
  int gasValue = analogRead(gasSensorPin);
  float voltage = gasValue  (5.0 / 4095.0);
  float Rs = 10000  (5.0 / voltage - 1);
  float ratio = Rs / 2200.0;
  Serial.print("Gas concentration: ");
  Serial.print(ratio);
  Serial.println(" ppm");
  delay(1000);
}
```
### Example 3: Gas Detection with Heating Element Control (Advanced)
In this example, we will connect the MQ-2 Gas Sensor to a Raspberry Pi board and use the heating pin to control the sensor element temperature.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
gasSensorPin = 17
heatingPin = 23
GPIO.setup(gasSensorPin, GPIO.IN)
GPIO.setup(heatingPin, GPIO.OUT)
while True:
    GPIO.output(heatingPin, GPIO.HIGH) # Heat the sensor element
    time.sleep(1)
    gasValue = GPIO.input(gasSensorPin)
    if gasValue == GPIO.HIGH:
        print("Gas detected!")
    else:
        print("No gas detected.")
    GPIO.output(heatingPin, GPIO.LOW) # Turn off the heating element
    time.sleep(1)
```
Note: The above code examples are for illustration purposes only and may require modifications to suit your specific application. Additionally, it is recommended to use the MQ-2 Gas Sensor in a well-ventilated area and follow proper safety precautions when working with gas detection applications.