The MQ-2 is a versatile gas sensor designed to detect a variety of gases, including LPG, propane, methane, and smoke. Manufactured by Arduino, this sensor operates on the principle of resistive change when exposed to target gases. It is widely used in gas leak detection systems, air quality monitoring, and safety applications. The MQ-2 is a cost-effective and reliable solution for detecting combustible gases and smoke in residential, industrial, and commercial environments.
The MQ-2 sensor is designed for ease of use and integration into various electronic systems. Below are its key technical details:
Parameter | Value |
---|---|
Manufacturer | Arduino |
Manufacturer Part ID | MQ-2 |
Operating Voltage | 5V DC |
Power Consumption | ≤ 800 mW |
Detection Range | 200 ppm – 10,000 ppm |
Preheat Time | 20 seconds |
Sensitivity | Adjustable via onboard potentiometer |
Output Signal | Analog (0-5V) and Digital (0/1) |
Operating Temperature | -20°C to 50°C |
Dimensions | 32mm x 20mm x 22mm |
The MQ-2 sensor module typically has four pins. The table below describes each pin:
Pin Name | Description |
---|---|
VCC | Power supply pin. Connect to a 5V DC source. |
GND | Ground pin. Connect to the ground of the circuit. |
DO | Digital output pin. Outputs HIGH (1) or LOW (0) based on gas concentration. |
AO | Analog output pin. Provides a voltage proportional to gas concentration. |
The MQ-2 sensor is straightforward to use in a circuit. Follow the steps below to integrate it into your project:
VCC
pin to the 5V pin on the Arduino UNO and the GND
pin to the Arduino's ground.AO
pin to an analog input pin on the Arduino (e.g., A0).DO
pin to a digital input pin on the Arduino (e.g., D2) if you want to use the digital threshold feature.The following code demonstrates how to read both the analog and digital outputs of the MQ-2 sensor using an Arduino UNO:
// MQ-2 Gas Sensor Example Code
// Reads analog and digital outputs from the MQ-2 sensor and prints the values
// to the Serial Monitor.
const int analogPin = A0; // Analog output pin connected to A0
const int digitalPin = 2; // Digital output pin connected to D2
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
pinMode(digitalPin, INPUT); // Set digital pin as input
}
void loop() {
int analogValue = analogRead(analogPin); // Read analog value from sensor
int digitalValue = digitalRead(digitalPin); // Read digital value from sensor
// Print the values to the Serial Monitor
Serial.print("Analog Value: ");
Serial.print(analogValue); // Print analog value
Serial.print(" | Digital Value: ");
Serial.println(digitalValue); // Print digital value
delay(1000); // Wait for 1 second before the next reading
}
Issue | Possible Cause | Solution |
---|---|---|
No output from the sensor | Incorrect wiring or loose connections | Verify all connections and ensure proper wiring. |
Analog readings are unstable | Insufficient preheat time | Allow the sensor to preheat for at least 20 seconds before taking readings. |
Digital output always HIGH or LOW | Sensitivity not adjusted properly | Adjust the potentiometer to set the desired threshold. |
Sensor not detecting gas | Low gas concentration or sensor damage | Test with a higher gas concentration or replace the sensor if damaged. |
Can the MQ-2 detect multiple gases simultaneously?
How do I calibrate the MQ-2 sensor?
What is the lifespan of the MQ-2 sensor?
Can the MQ-2 be used outdoors?
By following this documentation, you can effectively integrate and use the MQ-2 gas sensor in your projects.