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 is a versatile gas sensor capable of detecting a wide range of gases, including LPG (liquefied petroleum gas), propane, hydrogen, methane, and smoke particles. It is widely used in safety applications such as gas leak detectors and smoke alarms. The sensor's high sensitivity and fast response time make it an essential component in any project involving the detection of combustible gases.

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 and Use Cases

  • Domestic and industrial gas leak detectors
  • Portable gas detectors
  • Air quality monitoring
  • Smoke alarms

Technical Specifications

Key Technical Details

  • Sensor Type: Semiconductor
  • Detection Gases: LPG, propane, hydrogen, methane, smoke
  • Concentration Range: 300 to 10000 ppm (parts per million)
  • Preheat Duration: 20 seconds
  • Supply Voltage: 5V DC
  • Output Voltage: 0.1-0.3V (relative to gas concentration)
  • Operating Temperature: -10 to 50°C
  • Heater Power Consumption: Approx. 800mW

Pin Configuration and Descriptions

Pin Number Pin Name Description
1 VCC Power supply (5V DC)
2 GND Ground
3 DOUT Digital output (TTL logic level)
4 AOUT Analog output (Voltage proportional to gas concentration)

Usage Instructions

How to Use the MQ-2 in a Circuit

  1. Powering the Sensor: Connect the VCC pin to a 5V supply and the GND pin to the ground.
  2. Reading the Sensor:
    • For digital output: Connect the DOUT pin to a digital input pin on your microcontroller.
    • For analog output: Connect the AOUT pin to an analog input pin on your microcontroller.
  3. Calibration: Before using the sensor, it should be calibrated in the environment where it will be used to establish a baseline reading.

Important Considerations and Best Practices

  • Preheating: Allow the sensor to preheat for at least 20 seconds to stabilize the readings.
  • Avoiding Contaminants: Keep the sensor away from organic solvents, paints, and other contaminants.
  • Ventilation: Ensure proper ventilation around the sensor to allow gas diffusion.
  • Temperature and Humidity: Be aware that high humidity and temperature variations can affect sensor performance.

Example Code for Arduino UNO

// MQ-2 sensor example with Arduino UNO
int analogPin = A0; // Analog input pin connected to MQ-2 AOUT pin
int digitalPin = 2; // Digital input pin connected to MQ-2 DOUT pin
int sensorValue = 0; // Variable to store the sensor value

void setup() {
  pinMode(digitalPin, INPUT); // Set the digital pin as input
  Serial.begin(9600); // Start serial communication at 9600 baud
}

void loop() {
  sensorValue = analogRead(analogPin); // Read the analog value from sensor
  Serial.print("Gas concentration (analog): ");
  Serial.println(sensorValue); // Print the analog reading

  if (digitalRead(digitalPin) == HIGH) {
    // Check if the digital output is high
    Serial.println("Gas detected!");
  } else {
    Serial.println("No gas detected.");
  }
  delay(1000); // Wait for 1 second before the next loop
}

Troubleshooting and FAQs

Common Issues Users Might Face

  • Inconsistent Readings: Ensure the sensor has preheated for at least 20 seconds. Check for any environmental factors that may affect the readings.
  • No Response to Gas: Verify that the sensor is properly connected and supplied with 5V. Check if the sensor needs recalibration.
  • False Alarms: Adjust the threshold value in the code for the digital output or recalibrate the sensor.

Solutions and Tips for Troubleshooting

  • Sensor Not Working: Check all connections and ensure the sensor is receiving 5V power.
  • Calibration: Perform calibration in the specific environment where the sensor will be used.
  • Sensor Cleaning: Use a soft brush to gently clean the sensor if it's exposed to dust or other particles.

FAQs

Q: How long does the MQ-2 sensor last? A: The lifespan of the MQ-2 sensor can vary depending on usage and environment, but it typically lasts for about 5 years.

Q: Can the MQ-2 sensor detect carbon monoxide (CO)? A: The MQ-2 is not specifically designed for CO detection and may not be reliable for this purpose. For CO detection, use a sensor specifically designed for that gas.

Q: Is the MQ-2 sensor sensitive to alcohol vapors? A: Yes, the MQ-2 sensor can respond to alcohol vapors, but it is not selective. It is important to consider cross-sensitivity when using this sensor for specific gas detection.