


MQ-4 Methane Gas Sensor
Gas sensor designed to detect methane and natural gas in the environment
Introduction
The MQ-4 is a semiconductor-based gas sensor used for detecting methane (CH4) and natural gas. It is widely used in gas leak detection applications and is a valuable component for safety systems. The sensor features an easy-to-use interface and offers both analog and digital outputs.
Pinout
The MQ-4 gas sensor comes with the following pins:
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply input (5V). |
2 | GND | Ground connection. |
3 | DO | Digital output, HIGH when gas concentration exceeds threshold. |
4 | AO | Analog output, voltage increases with gas concentration. |

Working Principle
The MQ-4 sensor uses a semiconductor layer (SnO2) that reacts with methane and other gases. The sensor works by altering the conductivity of the semiconductor when it comes in contact with methane molecules:
- When the sensor is exposed to methane or natural gas, the resistance of the SnO2 layer decreases.
- This change in resistance is detected and converted to a voltage that can be read as an output signal.
- The analog output (AO) provides a voltage proportional to the concentration of methane.
- The digital output (DO) provides a HIGH signal when the gas concentration exceeds the preset threshold.
Features
The MQ-4 methane gas sensor comes with several notable features:
- Detects methane (CH4) and natural gas.
- Offers both analog and digital outputs for easy interfacing.
- Fast response time and high sensitivity.
- Low power consumption.
- Used in gas leakage detection and safety systems.
Applications
The MQ-4 sensor is widely used in the following applications:
- Gas leak detection in homes and industries.
- Monitoring methane levels in industrial plants.
- Home safety systems for detecting dangerous gas leaks.
- Smart gas detection systems for IoT applications.
- Portable gas detectors.
Calibration
For accurate gas detection, the MQ-4 sensor requires calibration:
- Allow the sensor to stabilize for at least 24 hours before first use.
- Use clean air to set the baseline resistance value.
- Introduce known concentrations of methane or natural gas for calibration.
- Adjust the analog output according to the concentration level.
- Adjust the digital output threshold to trigger when a certain gas concentration is reached.
Troubleshooting
If you encounter issues with the MQ-4 sensor, consider the following troubleshooting steps:
- No output: Ensure the sensor is powered correctly and properly connected.
- Inaccurate readings: Allow the sensor to stabilize for longer, and check for contamination or humidity.
- Fluctuating output: Calibrate the sensor in a controlled environment with known gas concentrations.
- Digital output not triggering: Adjust the threshold potentiometer to match the required gas concentration level.