

The MQ-4 is a gas sensor designed to detect methane (CH₄) and natural gas concentrations in the air. Manufactured by Flying Fish, this sensor operates on the principle of resistive change when exposed to gas, providing an analog output proportional to the gas concentration. It is widely used in applications such as gas leak detection, industrial safety systems, and home automation for monitoring air quality.








The MQ-4 sensor is a robust and reliable component with the following key specifications:
| Parameter | Value |
|---|---|
| Manufacturer | Flying Fish |
| Part ID | MQ-4 |
| Target Gases | Methane (CH₄), Natural Gas |
| Operating Voltage | 5V DC |
| Output Signal | Analog (0-5V) |
| Preheat Time | ≥ 24 hours (for stable readings) |
| Detection Range | 200 ppm to 10,000 ppm |
| Heater Voltage (VH) | 5V ± 0.1V |
| Heater Current (IH) | ≤ 150 mA |
| Operating Temperature | -20°C to 50°C |
| Humidity Range | 33% to 85% RH |
| Lifetime | ≥ 5 years |
The MQ-4 sensor module typically comes with a 4-pin interface. Below is the pin configuration:
| 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-4 sensor with an Arduino UNO to read analog values:
// MQ-4 Methane Gas Sensor Example Code
// Connect AOUT to Arduino analog pin A0
// Connect VCC to 5V and GND to ground
const int analogPin = A0; // Analog pin connected to AOUT
int sensorValue = 0; // Variable to store sensor reading
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
Serial.println("MQ-4 Gas Sensor Test");
}
void loop() {
sensorValue = analogRead(analogPin); // Read analog value from sensor
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage
// 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 next reading
}
No Output or Incorrect Readings:
Fluctuating Readings:
Sensor Not Detecting Gas:
Digital Output Not Triggering:
Q1: Can the MQ-4 detect gases other than methane?
A1: While the MQ-4 is optimized for methane and natural gas, it may respond to other gases like propane or hydrogen, but with reduced sensitivity.
Q2: How do I calibrate the MQ-4 sensor?
A2: Expose the sensor to a known concentration of methane gas and adjust the potentiometer or use software calibration to map the analog output to the gas concentration.
Q3: Can I use the MQ-4 outdoors?
A3: The MQ-4 is not designed for outdoor use as extreme temperatures, humidity, and contaminants can affect its performance.
Q4: What is the lifespan of the MQ-4 sensor?
A4: The sensor has a typical lifespan of 5 years under normal operating conditions.
By following this documentation, users can effectively integrate the MQ-4 gas sensor into their projects for reliable methane and natural gas detection.