The MQ4 is a gas sensor designed to detect methane (CH₄) and natural gas concentrations in the air. It operates on the principle of resistive change, where the sensor's resistance varies in the presence of target gases. The MQ4 provides an analog output proportional to the gas concentration, making it suitable for a wide range of applications.
The MQ4 sensor is a robust and reliable component with the following key specifications:
Parameter | Value |
---|---|
Operating Voltage | 5V DC |
Load Resistance (RL) | Adjustable (typically 10 kΩ) |
Heater Voltage (VH) | 5V ± 0.1V |
Heater Power Consumption | ≤ 900 mW |
Detection Range | 200 ppm to 10,000 ppm (methane) |
Preheat Time | ≥ 24 hours for stable operation |
Output Signal | Analog voltage |
Operating Temperature | -20°C to 50°C |
Humidity Range | ≤ 95% RH |
Sensor Life Span | ≥ 5 years |
The MQ4 sensor typically comes with four pins or leads. Below is the pinout description:
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply pin (5V DC) |
2 | GND | Ground pin |
3 | AOUT | Analog output pin (provides voltage proportional to gas concentration) |
4 | DOUT | Digital output pin (threshold-based signal, optional use) |
Below is an example of how to connect and use the MQ4 sensor with an Arduino UNO:
// MQ4 Methane Gas Sensor Example with Arduino UNO
// Reads analog output from MQ4 and displays gas concentration on Serial Monitor
const int analogPin = A0; // MQ4 AOUT connected to Arduino A0
int sensorValue = 0; // Variable to store sensor reading
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
Serial.println("MQ4 Gas Sensor Test");
}
void loop() {
sensorValue = analogRead(analogPin); // Read analog value from MQ4
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage
// Display the raw sensor value and voltage
Serial.print("Sensor Value: ");
Serial.print(sensorValue);
Serial.print(" | Voltage: ");
Serial.print(voltage);
Serial.println(" V");
delay(1000); // Wait 1 second before next reading
}
No Output Signal:
Inaccurate Readings:
Sensor Saturation:
Digital Output Not Triggering:
Q1: Can the MQ4 detect gases other than methane?
A1: While the MQ4 is optimized for methane and natural gas, it may respond to other combustible gases, but with reduced sensitivity.
Q2: How do I calibrate the MQ4 sensor?
A2: Expose the sensor to a known concentration of methane gas and adjust the load resistor or potentiometer to match the expected output.
Q3: Can I use the MQ4 with a 3.3V microcontroller?
A3: The MQ4 requires a 5V power supply for the heater. However, you can use a voltage divider to step down the analog output for 3.3V microcontrollers.
Q4: How long does the MQ4 sensor last?
A4: The MQ4 has a typical lifespan of 5 years under normal operating conditions.