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

How to Use MQ2: Examples, Pinouts, and Specs

Image of MQ2
Cirkit Designer LogoDesign with MQ2 in Cirkit Designer

Introduction

The MQ2 is a versatile gas sensor designed to detect a variety of gases, including methane, propane, hydrogen, carbon monoxide, and smoke. It operates on the principle of resistive change, where the sensor's resistance varies in the presence of target gases. This change is converted into an analog output signal, which can be easily read by microcontrollers or other electronic systems.

Explore Projects Built with MQ2

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino Mega 2560 and ESP32-Based Smart Smoke and Gas Detection System with Solar Power
Image of schamtic dooor lock: A project utilizing MQ2 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 MQ2 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
Battery-Powered Gas Detection Alarm with MQ2 Sensor and Buzzer
Image of smoke detection: A project utilizing MQ2 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
Arduino UNO and A9G GSM/GPRS GPS-Based Air Quality Monitoring System
Image of A9G Smoke Sensor: A project utilizing MQ2 in a practical application
This circuit features an Arduino UNO microcontroller interfaced with an A9G GSM/GPRS+GPS module and an MQ2 gas sensor. The Arduino communicates with the A9G module via digital pins D11 and D10 for data transmission, and it reads analog gas concentration levels from the MQ2 sensor through analog pin A5. Both the A9G module and the MQ2 sensor are powered by the Arduino's 5V output, and all components share a common ground.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MQ2

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 schamtic dooor lock: A project utilizing MQ2 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 MQ2 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
Image of smoke detection: A project utilizing MQ2 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 A9G Smoke Sensor: A project utilizing MQ2 in a practical application
Arduino UNO and A9G GSM/GPRS GPS-Based Air Quality Monitoring System
This circuit features an Arduino UNO microcontroller interfaced with an A9G GSM/GPRS+GPS module and an MQ2 gas sensor. The Arduino communicates with the A9G module via digital pins D11 and D10 for data transmission, and it reads analog gas concentration levels from the MQ2 sensor through analog pin A5. Both the A9G module and the MQ2 sensor are powered by the Arduino's 5V output, and all components share a common ground.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Gas leak detection in homes and industries
  • Smoke detection in fire alarm systems
  • Air quality monitoring
  • Safety systems in automotive and industrial environments

Technical Specifications

The MQ2 sensor is a compact and reliable device with the following key specifications:

Parameter Value
Operating Voltage 5V DC
Load Resistance (RL) Adjustable (typically 4.7kΩ - 10kΩ)
Heater Voltage (VH) 5V ± 0.2V DC or AC
Heating Current < 150mA
Detection Range 200 - 10,000 ppm (parts per million)
Preheat Time ≥ 24 hours for optimal performance
Output Signal Analog voltage
Operating Temperature -20°C to 50°C
Humidity Range 35% - 95% RH
Dimensions 32mm x 20mm x 22mm (approx.)

Pin Configuration and Descriptions

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

Pin Name Description
1 VCC Power supply pin (5V DC)
2 GND Ground pin
3 AOUT Analog output pin (provides voltage proportional to gas concentration)
4 DOUT Digital output pin (high/low signal based on threshold)

Usage Instructions

How to Use the MQ2 in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 5V DC power source and the GND pin to ground.
  2. Read the Output:
    • Use the AOUT pin to read the analog signal. This pin outputs a voltage proportional to the gas concentration.
    • Alternatively, use the DOUT pin for a digital high/low signal. Adjust the onboard potentiometer to set the threshold for the digital output.
  3. Preheat the Sensor: Allow the sensor to preheat for at least 24 hours before taking accurate measurements. This ensures the internal heater stabilizes.
  4. Connect to a Microcontroller: The MQ2 can be interfaced with microcontrollers like Arduino UNO to process the output signal.

Important Considerations and Best Practices

  • Preheating: Always preheat the sensor for the recommended duration to ensure accurate readings.
  • Placement: Install the sensor in a well-ventilated area to avoid saturation or false readings.
  • Calibration: Calibrate the sensor in a controlled environment with known gas concentrations for precise measurements.
  • Power Supply: Use a stable 5V power source to avoid fluctuations in the output signal.
  • Avoid Contamination: Keep the sensor away from water, dust, and corrosive gases to maintain its longevity.

Example: Connecting MQ2 to Arduino UNO

Below is an example of how to connect and read data from the MQ2 sensor using an Arduino UNO:

Circuit Connections

  • Connect the MQ2's VCC pin to the Arduino's 5V pin.
  • Connect the GND pin to the Arduino's GND pin.
  • Connect the AOUT pin to the Arduino's A0 analog input pin.

Arduino Code

// MQ2 Gas Sensor Example with Arduino UNO
// Reads analog output from MQ2 and prints gas concentration to Serial Monitor

const int MQ2_AOUT = A0; // Analog pin connected to MQ2 AOUT
int sensorValue = 0;     // Variable to store sensor reading

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

void loop() {
  sensorValue = analogRead(MQ2_AOUT); // Read analog value from MQ2
  float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage
  
  // Print sensor value and voltage to Serial Monitor
  Serial.print("Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" | Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");
  
  delay(1000); // Wait 1 second before next reading
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Ensure the sensor is properly powered (5V to VCC and GND connected).
    • Check for loose or incorrect wiring.
    • Verify that the sensor has been preheated for at least 24 hours.
  2. Inaccurate Readings:

    • Calibrate the sensor in a controlled environment with known gas concentrations.
    • Ensure the sensor is not exposed to extreme temperatures or humidity.
  3. Fluctuating Output:

    • Use a stable power supply to avoid voltage fluctuations.
    • Place the sensor in a stable environment, away from strong air currents.
  4. Digital Output Not Triggering:

    • Adjust the onboard potentiometer to set the correct threshold for the DOUT pin.
    • Verify that the target gas concentration exceeds the set threshold.

FAQs

Q: Can the MQ2 detect multiple gases simultaneously?
A: Yes, the MQ2 can detect multiple gases, but it does not differentiate between them. The output signal represents the combined concentration of all detectable gases.

Q: How long does the MQ2 sensor last?
A: The MQ2 sensor typically lasts for 2-3 years under normal operating conditions. Proper care and maintenance can extend its lifespan.

Q: Can I use the MQ2 with a 3.3V microcontroller?
A: The MQ2 is designed for 5V operation. If using a 3.3V microcontroller, you will need a level shifter or a separate 5V power supply for the sensor.

Q: Is the MQ2 suitable for outdoor use?
A: The MQ2 is not designed for outdoor use as it is sensitive to humidity, temperature, and environmental contaminants. Use it in controlled indoor environments for best results.