Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use MQ-2: Examples, Pinouts, and Specs

Image of MQ-2
Cirkit Designer LogoDesign with MQ-2 in Cirkit Designer

Introduction

The MQ-2, manufactured by Zanefac (Part ID: MQ-2), is a versatile gas sensor designed to detect a variety of gases, including LPG, propane, methane, and smoke. It operates on the principle of resistive change when exposed to target gases, providing an analog output proportional to the gas concentration. This sensor is widely used in applications such as gas leak detection, air quality monitoring, and safety systems.

Explore Projects Built with MQ-2

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Battery-Powered Gas Detection Alarm with MQ2 Sensor and Buzzer
Image of smoke detection: A project utilizing MQ-2 in a practical application
This circuit is a gas detection alarm system that uses an MQ2 gas sensor to detect gas levels. When gas is detected, the sensor outputs a signal that triggers a buzzer to sound an alarm. The circuit is powered by a 2 x AA battery mount.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered MQ-2 Gas Sensor with Alert Buzzer
Image of gas detect: A project utilizing MQ-2 in a practical application
This is a simple gas detection alarm system that uses an MQ-2 sensor to detect gas presence and sound a buzzer when gas is detected. It is powered by a rechargeable 18650 battery, with a TP4056 module for battery management and charging. A rocker switch is used to control the power to the system.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Mega 2560 and ESP32-Based Smart Smoke and Gas Detection System with Solar Power
Image of schamtic dooor lock: A project utilizing MQ-2 in a practical application
This circuit is an automated safety system that detects smoke or gas using an MQ2 sensor and activates a solenoid lock and buzzer in response. It includes a voice recognition module, an ESP32 for additional functionalities, and is powered by a 12V battery and solar panel with a charge controller. The system is controlled by an Arduino Mega 2560, which also manages multiple relays to control exhaust fans and other components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Mega 2560 Based Automatic Smoke Detection and Alert System with Solar Charging
Image of schamtic dooor lock: A project utilizing MQ-2 in a practical application
This circuit is designed for an automatic safety and alert system that detects smoke or gas using an MQ2 sensor, and in response, unlocks a solenoid lock and activates a buzzer. It features an Arduino Mega 2560 for control logic, a DFPlayer Mini for audio output, a voice recognition module for voice commands, and an ESP32 for additional functionalities. The system is powered by a 12V battery, supported by a solar panel through a charge controller, and uses relays to control exhaust fans.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MQ-2

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of smoke detection: A project utilizing MQ-2 in a practical application
Battery-Powered Gas Detection Alarm with MQ2 Sensor and Buzzer
This circuit is a gas detection alarm system that uses an MQ2 gas sensor to detect gas levels. When gas is detected, the sensor outputs a signal that triggers a buzzer to sound an alarm. The circuit is powered by a 2 x AA battery mount.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of gas detect: A project utilizing MQ-2 in a practical application
Battery-Powered MQ-2 Gas Sensor with Alert Buzzer
This is a simple gas detection alarm system that uses an MQ-2 sensor to detect gas presence and sound a buzzer when gas is detected. It is powered by a rechargeable 18650 battery, with a TP4056 module for battery management and charging. A rocker switch is used to control the power to the system.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of schamtic dooor lock: A project utilizing MQ-2 in a practical application
Arduino Mega 2560 and ESP32-Based Smart Smoke and Gas Detection System with Solar Power
This circuit is an automated safety system that detects smoke or gas using an MQ2 sensor and activates a solenoid lock and buzzer in response. It includes a voice recognition module, an ESP32 for additional functionalities, and is powered by a 12V battery and solar panel with a charge controller. The system is controlled by an Arduino Mega 2560, which also manages multiple relays to control exhaust fans and other components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of schamtic dooor lock: A project utilizing MQ-2 in a practical application
Arduino Mega 2560 Based Automatic Smoke Detection and Alert System with Solar Charging
This circuit is designed for an automatic safety and alert system that detects smoke or gas using an MQ2 sensor, and in response, unlocks a solenoid lock and activates a buzzer. It features an Arduino Mega 2560 for control logic, a DFPlayer Mini for audio output, a voice recognition module for voice commands, and an ESP32 for additional functionalities. The system is powered by a 12V battery, supported by a solar panel through a charge controller, and uses relays to control exhaust fans.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications:

  • Gas leak detection systems for homes and industries
  • Air quality monitoring devices
  • Smoke detection in fire alarm systems
  • IoT-based environmental monitoring projects

Technical Specifications

The MQ-2 sensor is designed for ease of use and integration into various electronic systems. Below are its key technical details:

Key Specifications:

Parameter Value
Operating Voltage 5V DC
Load Resistance (RL) Adjustable (typically 10 kΩ)
Heater Voltage (VH) 5V ± 0.2V
Heater Power Consumption ≤ 800 mW
Detection Range 200 ppm – 10,000 ppm
Preheat Time ≥ 24 hours for stable output
Output Signal Analog (voltage proportional to gas concentration)
Operating Temperature -20°C to 50°C
Humidity Range 35% – 95% RH
Response Time ≤ 10 seconds
Recovery Time ≤ 30 seconds

Pin Configuration:

The MQ-2 sensor typically comes with four pins or terminals. Below is the pinout description:

Pin Name Description
VCC Power supply pin (5V DC)
GND Ground pin
AOUT Analog output pin (provides gas concentration)
DOUT Digital output pin (threshold-based signal)

Usage Instructions

The MQ-2 sensor is straightforward to use in a circuit. Follow the steps below to integrate it into your project:

Circuit Connection:

  1. Power Supply: Connect the VCC pin to a 5V DC power source and the GND pin to ground.
  2. Analog Output: Connect the AOUT pin to an analog input pin of your microcontroller (e.g., Arduino UNO) to read gas concentration levels.
  3. Digital Output: Optionally, connect the DOUT pin to a digital input pin of your microcontroller. Use the onboard potentiometer to set the gas concentration threshold for triggering the digital output.

Important Considerations:

  • Preheating: Allow the sensor to preheat for at least 24 hours before taking accurate readings. This ensures the internal heater stabilizes.
  • Calibration: Calibrate the sensor in a clean air environment to establish a baseline reading.
  • Placement: Place the sensor in a well-ventilated area for accurate gas detection.
  • Load Resistor: Use a load resistor (RL) of 10 kΩ for typical applications. Adjust as needed for specific use cases.

Example Code for Arduino UNO:

Below is an example code snippet to interface the MQ-2 sensor with an Arduino UNO and read the analog output:

// MQ-2 Gas Sensor Example Code
// Manufacturer: Zanefac
// Part ID: MQ-2
// This code reads the analog output of the MQ-2 sensor and prints the value to the Serial Monitor.

const int analogPin = A0; // Connect AOUT pin of MQ-2 to Arduino analog pin A0
int sensorValue = 0;      // Variable to store the sensor reading

void setup() {
  Serial.begin(9600); // Initialize serial communication at 9600 baud
  Serial.println("MQ-2 Gas Sensor Test");
}

void loop() {
  sensorValue = analogRead(analogPin); // Read the analog value from the sensor
  Serial.print("Gas Concentration (Analog Value): ");
  Serial.println(sensorValue); // Print the sensor value to the Serial Monitor
  delay(1000); // Wait for 1 second before the next reading
}

Best Practices:

  • Avoid exposing the sensor to high concentrations of corrosive gases, as this may damage the sensing element.
  • Use a stable 5V power supply to ensure consistent readings.
  • Regularly clean the sensor to remove dust or debris that may affect performance.

Troubleshooting and FAQs

Common Issues and Solutions:

  1. No Output or Incorrect Readings:

    • Ensure the sensor is properly connected to the power supply and ground.
    • Verify that the sensor has been preheated for at least 24 hours.
    • Check the load resistor value and adjust if necessary.
  2. Fluctuating Readings:

    • Ensure the sensor is placed in a stable environment without sudden changes in temperature or humidity.
    • Use a decoupling capacitor (e.g., 0.1 µF) across the power supply pins to reduce noise.
  3. Digital Output Not Triggering:

    • Adjust the onboard potentiometer to set the desired gas concentration threshold.
    • Verify the digital pin connection to the microcontroller.

FAQs:

Q1: Can the MQ-2 detect multiple gases simultaneously?
A1: Yes, the MQ-2 can detect multiple gases such as LPG, propane, methane, and smoke. However, it does not differentiate between them; it provides a combined analog output based on the total gas concentration.

Q2: How do I calibrate the MQ-2 sensor?
A2: To calibrate, expose the sensor to clean air and record the baseline analog output. Use this value as a reference for detecting gas concentrations.

Q3: Can the MQ-2 be used outdoors?
A3: The MQ-2 is not designed for outdoor use as it may be affected by extreme temperatures, humidity, and environmental contaminants. Use it in controlled indoor environments for best results.

Q4: What is the lifespan of the MQ-2 sensor?
A4: The typical lifespan of the MQ-2 sensor is around 2–3 years under normal operating conditions. Regular maintenance can help extend its life.

By following this documentation, users can effectively integrate and utilize the MQ-2 gas sensor in their projects.