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

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

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

Introduction

The MQ-2 gas sensor is a versatile and widely used electronic component designed to detect the presence of gases such as LPG, propane, methane, hydrogen, and smoke. It operates on the principle of resistive change, where the sensor's resistance varies in response to the concentration of target gases in the environment. The sensor outputs an analog signal proportional to the gas concentration, making it easy to interface with microcontrollers and other electronic systems.

Explore Projects Built with MQ-2 GAS SENSOR

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 MQ-2 Gas Sensor with Alert Buzzer
Image of gas detect: A project utilizing MQ-2 GAS SENSOR 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
Battery-Powered Gas Detection Alarm with MQ2 Sensor and Buzzer
Image of smoke detection: A project utilizing MQ-2 GAS SENSOR 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
Multi-Gas Detection System with Arduino and MQ Sensors
Image of Centrala calitate aer: A project utilizing MQ-2 GAS SENSOR in a practical application
This circuit is designed to monitor various gases using a series of MQ gas sensors (MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9, and MQ-135), each providing digital outputs to an Arduino UNO microcontroller. The Arduino is also connected to a piezo speaker for audible alerts and multiple LEDs with resistors, likely for visual status indicators. An Adafruit TCA9548A I2C multiplexer is included, suggesting the potential for I2C sensor expansion or managing multiple I2C devices.
Cirkit Designer LogoOpen Project in Cirkit Designer
MQ-2 Gas Detection Circuit with Audio-Visual Alert
Image of Smoke detector: A project utilizing MQ-2 GAS SENSOR in a practical application
This circuit is designed to detect gases using an MQ-2 sensor and provide alerts through a buzzer and a bulb. The buzzer is triggered by the sensor's digital output, while the bulb, in series with a resistor, may serve as a status indicator or additional alert. The entire circuit is powered by a 9V battery.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MQ-2 GAS SENSOR

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 gas detect: A project utilizing MQ-2 GAS SENSOR 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 smoke detection: A project utilizing MQ-2 GAS SENSOR 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 Centrala calitate aer: A project utilizing MQ-2 GAS SENSOR in a practical application
Multi-Gas Detection System with Arduino and MQ Sensors
This circuit is designed to monitor various gases using a series of MQ gas sensors (MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9, and MQ-135), each providing digital outputs to an Arduino UNO microcontroller. The Arduino is also connected to a piezo speaker for audible alerts and multiple LEDs with resistors, likely for visual status indicators. An Adafruit TCA9548A I2C multiplexer is included, suggesting the potential for I2C sensor expansion or managing multiple I2C devices.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Smoke detector: A project utilizing MQ-2 GAS SENSOR in a practical application
MQ-2 Gas Detection Circuit with Audio-Visual Alert
This circuit is designed to detect gases using an MQ-2 sensor and provide alerts through a buzzer and a bulb. The buzzer is triggered by the sensor's digital output, while the bulb, in series with a resistor, may serve as a status indicator or additional alert. The entire circuit is powered by a 9V battery.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Gas leak detection systems
  • Air quality monitoring
  • Smoke detection in fire alarm systems
  • Industrial safety systems
  • Home automation for environmental monitoring

Technical Specifications

The MQ-2 gas sensor is a compact and efficient 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
Heater Current (IH) < 150mA
Detection Range 200 - 10,000 ppm (parts per million)
Preheat Time ≥ 24 hours for optimal performance
Sensitivity Detects LPG, propane, methane, hydrogen, and smoke
Output Signal Analog voltage
Operating Temperature -20°C to 50°C
Humidity Range 33% to 85% RH
Dimensions 32mm x 20mm x 22mm (approx.)

Pin Configuration and Descriptions

The MQ-2 gas sensor typically comes with four pins or six pins, depending on the module version. Below is the pin configuration for the most common 4-pin module:

Pin Name Description
1 VCC Power supply pin. Connect to 5V DC.
2 GND Ground pin. Connect to the ground of the circuit.
3 AOUT Analog output pin. Provides a voltage proportional to the gas concentration.
4 DOUT Digital output pin. Outputs HIGH or LOW based on a preset threshold (adjustable).

Usage Instructions

How to Use the MQ-2 Gas Sensor in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 5V DC power source and the GND pin to the ground.
  2. Read the Output:
    • Use the AOUT pin to read the analog signal. This pin provides a voltage proportional to the gas concentration.
    • Optionally, 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 use to ensure accurate readings.
  4. Connect to a Microcontroller: Interface the sensor with a microcontroller (e.g., Arduino UNO) to process the output signal and implement your application logic.

Important Considerations and Best Practices

  • Preheating: The sensor requires a preheating period of at least 24 hours for optimal performance. During this time, the internal heater stabilizes the sensor's resistance.
  • Calibration: Calibrate the sensor in a known gas concentration environment to improve accuracy.
  • Ventilation: Ensure proper ventilation around the sensor to avoid saturation and improve response time.
  • Avoid Contaminants: Keep the sensor away from water, oil, and other contaminants that may damage its surface.
  • Power Supply: Use a stable 5V power source to avoid fluctuations in the sensor's output.

Example Code for Arduino UNO

Below is an example of how to interface the MQ-2 gas sensor with an Arduino UNO to read the analog output:

// Define the analog pin connected to the MQ-2 sensor
const int analogPin = A0; // AOUT pin of MQ-2 connected to A0 on Arduino

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

void loop() {
  int sensorValue = analogRead(analogPin); // Read the analog value from the sensor
  float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage (0-5V range)

  // Print the sensor value and voltage to the Serial Monitor
  Serial.print("Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" | Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");

  delay(1000); // Wait for 1 second before the next reading
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Cause: Incorrect wiring or insufficient power supply.
    • Solution: Double-check the connections and ensure the sensor is powered with 5V DC.
  2. Inaccurate Readings:

    • Cause: Insufficient preheating time or improper calibration.
    • Solution: Allow the sensor to preheat for at least 24 hours and calibrate it in a known gas concentration.
  3. Digital Output Always HIGH or LOW:

    • Cause: Threshold not set correctly on the potentiometer.
    • Solution: Adjust the potentiometer to set the desired threshold for the digital output.
  4. Slow Response Time:

    • Cause: Poor ventilation or sensor saturation.
    • Solution: Ensure proper airflow around the sensor and avoid exposing it to high gas concentrations for extended periods.

FAQs

Q1: Can the MQ-2 detect multiple gases simultaneously?
A1: Yes, the MQ-2 can detect multiple gases, but it cannot differentiate between them. The output signal represents the combined concentration of all detectable gases.

Q2: How do I calibrate the MQ-2 sensor?
A2: To calibrate the sensor, expose it to a known concentration of the target gas and adjust the load resistance (RL) or use software calibration to map the analog output to the gas concentration.

Q3: Can I use the MQ-2 sensor outdoors?
A3: The MQ-2 is not designed for outdoor use as it may be affected by humidity, temperature fluctuations, and 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, depending on usage and environmental conditions. Regular maintenance and proper handling can extend its life.