The MQ-2 sensor module is a versatile gas detection device capable of identifying various combustible gases, particularly methane, butane, propane, and LPG (liquefied petroleum gas). It is widely used in safety applications such as gas leak detection in household and industrial settings, as well as in air quality monitoring systems. The sensor's high sensitivity and fast response time make it an essential component in preventing potential hazards related to gas leaks.
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply input (5V DC) |
2 | GND | Ground |
3 | DOUT | Digital output (0V or 5V) |
4 | AOUT | Analog output (0.1V to 0.3V) |
To use the MQ-2 sensor module in a circuit:
// MQ-2 Sensor Example Code
const int AOUTpin = A0; // Analog output from the sensor
const int DOUTpin = 2; // Digital output from the sensor
void setup() {
Serial.begin(9600);
pinMode(DOUTpin, INPUT);
}
void loop() {
int analogValue = analogRead(AOUTpin);
int digitalValue = digitalRead(DOUTpin);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V)
float voltage = analogValue * (5.0 / 1023.0);
Serial.print("Analog Value: ");
Serial.print(analogValue);
Serial.print(" - Voltage: ");
Serial.print(voltage);
Serial.print("V - Digital Value: ");
Serial.println(digitalValue);
// Wait a bit before reading again
delay(1000);
}
Q: How long does the MQ-2 sensor last? A: The lifespan of the MQ-2 sensor is typically around 5 years, depending on usage and environmental conditions.
Q: Can the MQ-2 sensor detect carbon monoxide? A: The MQ-2 is primarily designed for detecting flammable gases and may not be as sensitive to carbon monoxide. For CO detection, a dedicated CO sensor is recommended.
Q: Is the MQ-2 sensor sensitive to alcohol? A: Yes, the MQ-2 sensor can respond to alcohol vapors, but it is not specifically calibrated for measuring alcohol concentration.