Description
MQ4 - Natural Gas / Methane Gas Sensor Module
The MQ4 Methane Sensor Module is designed to detect Methane (CH₄) and natural gas. It can also sense LPG, propane, and hydrogen to some extent. It's commonly used in gas leak detectors, safety systems, and industrial gas monitoring. It is used to detect the methane gas concentration within the air at either home or industries & generates output like an analog voltage by reading it. Here, the range of concentration for sensing ranges from 300 ppm – 10,000 ppm, which is appropriate for the detection of a leak.
Technical Specifications:
- Operating Voltage: 5V DC
- Analog Output (A0): Varies with gas concentration
- Digital Output (D0): HIGH/LOW based on threshold (adjustable via potentiometer)
- Gas Detected: Methane (CH₄), natural gas, LPG, etc.
- Detection Range: 200 to 10000 ppm Methane
- Warm-up Time: 1–5 minutes for stable readings
Pinouts:
Connection with Arduino:
Module |
Arduino UNO |
VCC |
5V |
GND |
GND |
A0 |
A0 |
D0 |
D2 (Optional) |
Sample Code:
Analog Reading:
int mq4Pin = A0; // MQ4 A0 connected to Arduino A0
void setup() {
Serial.begin(9600); // Start Serial Monitor
}
void loop() {
int sensorValue = analogRead(mq4Pin); // Read analog value
Serial.print("Methane Gas Level: ");
Serial.println(sensorValue); // Print value
delay(1000); // 1 second delay
}
Optional: Trigger a Buzzer When Gas is Detected
int mq4Pin = A0;
int buzzerPin = 8;
int threshold = 400; // Adjust based on your testing
void setup() {
Serial.begin(9600);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
int gasLevel = analogRead(mq4Pin);
Serial.print("Gas Level: ");
Serial.println(gasLevel);
if (gasLevel > threshold) {
digitalWrite(buzzerPin, HIGH); // Buzzer ON
} else {
digitalWrite(buzzerPin, LOW); // Buzzer OFF
}
delay(500);
}