

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.








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.) |
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). |
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
}
No Output Signal:
Inaccurate Readings:
Digital Output Always HIGH or LOW:
Slow Response Time:
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.