MQ4 Methane Gas Sensor : Pin Configuration & Its Applications

The MQ4 methane gas sensor is extremely used for detecting gas leakage at home or in industries like Methane (CH4) & CNG Gas. This gas sensor is highly responsive in very little time, so based on the sensitivity requirements; it can be adjusted through a potentiometer. This is an analog output sensor, used like a CNG (compressed natural gas) sensor within the series of MQ sensors.

So this sensor is suitable for detecting the concentration of natural gas like methane within the air. For this sensor, if the gas concentration increases then the output voltage will be increased. This sensor works with 5V DC and draws 750 mW around. This article discusses an overview of the MQ4 methane gas sensor and its working with applications.

What is MQ4 Methane Gas Sensor?

MQ4 methane gas sensor is a MOS (metal oxide semiconductor) type sensor, used to detect the methane gas concentration within the air at either home or industries & generates output like analog voltage by reading it. Here, the range of concentration for sensing ranges from 300 pm – 10,000 ppm which is appropriate for the detection of a leak.

This gas sensor mainly includes a detecting element like ceramic based on aluminum-oxide (Al₂O₃), coated with Tin dioxide (SnO2) and arranged within a stainless-steel mesh.

MQ4 Methane Gas Sensor
MQ4 Methane Gas Sensor

When methane gas and detecting elements get in contact with each other then the resistivity of the detecting element will be changed. After that, the change is measured to get the methane gas concentration. The ignition of Methane gas is extremely exothermal which means it generates a huge amount of heat once ignited.

Pin Configuration

The pin configuration of the MQ4 methane gas sensor is shown below. This sensor includes three pins which are discussed below.

MQ4 Methane Gas Sensor Pin Configuration
MQ4 Methane Gas Sensor Pin Configuration
  • Pin1 (H Pins): These pins are two where one of them is used to connect supply and remaining pin is connected to ground
  • Pin2 (A Pins): Both the pins like A & B are interchangeable which will be connected to supply voltage.
  • Pin3 (B Pins): A & B pins are exchangeable where one pin acts like output and another pin will be pulled to the GND terminal.

The pin configuration of the MQ-4 methane gas sensor module includes four pins which are discussed below.

  • VCC Pin: This pin provides voltage to the module and the typical operating voltage is +5V
  • GND Pin: This pin is used to connect the sensor module to the GND terminal of the system
  • DO (Digital Out) Pin: This pin provides digital output by setting a threshold value with the help of the potentiometer
  • AO (Analog Out): This pin provides output analog voltage which ranges from 0 to 5V depending on the intensity of gas.

Features & Specifications

The features and specifications of the MQ4 methane gas sensor include the following.

  • Sensitivity is good for combustible gas in an extensive range
  • Sigh sensitivity for natural gas, methane gas
  • Small sensitivity for smoke and alcohol
  • Quick responsive, long life and stable
  • The drive circuit is simple
  • Load resistance is 20KΩ
  • Detecting resistance ranges from 10KΩ to 60KΩ
  • Preheat time is above 24Hrs
  • The required voltage is 5V
  • DO output: is 0.1 to 5V
  • AO output is 0.1 to 0 .3 V
  • Detection gas is methane or natural
  • The concentration of detection ranges from 200 to 10000ppm
  • Interface : TTL compatible input & output
  • Heater utilization is low than 750mw
  • Operating temperature ranges from 14 to 122 ° Fahrenheit or -10 to 50°Centigrade

MQ-4 equivalent sensors are MQ 214, MQ306A, MQ-5, MQ306A & MQ-2. Alternative MQ Gas sensors are MQ2, 3, 4, 5, 6, 7, 8, 9, 131, 135, 136, 137, 138, 214, 216, 303A, 306A, 307A, & 309A.

For the MQ4 methane gas sensor, the resistance value is not the same for different types of gases, it varies. So adjustment of sensitivity is very essential while using this sensor. It is suggested to adjust the sensor methane concentration within the air (5000ppm) & use a load resistance value of about 20KΩ.

How to use MQ4 Methane Gas Sensor?

MQ4 gas sensor is simply used to detect the gas by using an analog pin or digital pin. Once the sensor module is powered with 5Volts then it starts detecting the methane gas. Once it is detected then the LED will start glowing otherwise the LED will be OFF.

Before working with these gas sensors, we have to set aside pre-heating time before you can work with them. Now, bring in the sensor to the methane gas & notice that the voltage throughout the output LED will be high like 5V, so the LED will be turned ON otherwise it will be turned OFF, so the voltage will be low like 0V. Similarly, the analog pin can also be used for detecting methane gas.

The interfacing of the MQ4 methane gas sensor circuit using Arduino is shown below. This circuit uses different materials like breadboard, MQ-4 gas sensor & Arduino Uno board. The main purpose of this circuit is to monitor and detect the natural gas using an Arduino Uno board. If the limit of natural gas leakage exceeds then it generates an alarm sound.

Interfacing MQ4 Methane Gas Sensor with Arduino Uno
Interfacing MQ4 Methane Gas Sensor with Arduino Uno

The MQ 4 gas sensor is reliable, fast, and high sensitive to natural gas and also sensitive to butane & propane. This sensor has many benefits like less cost and has a long life, so used for detecting gas leakage. In this project, two-color LEDs are used for indicating the gas leakage like Green & Red.
When the concentration of gas is below the critical value, then the Greenlight will be turned ON.

Similarly, if the gas concentration exceeds the critical value, then the red LED will be turned ON. The MQ-4 sensor includes four pins like Positive (Vcc), ground (GND), analog output, and digital output. The wiring diagram of an MQ4 methane gas sensor with Arduino Uno is shown below.

In the above interfacing diagram, two 220 Ohm resistors are connected to the digital pins of an Arduino & two LEDs. The green color LED will be ON unless the concentration of natural gas exceeds the threshold, then the red color LED will be turned ON.

The required code for this project is shown below.

intpinRedLed = 11;
intpinGreenLed = 8;
intpinSensor = A5;
intTHRESHOLD = 250;
voidsetup() {
pinMode(pinRedLed, OUTPUT);
pinMode(pinGreenLed, OUTPUT);
pinMode(pinSensor, INPUT);
voidloop() {
int analogValue = analogRead(pinSensor);
Serial.println(“Val: ” +analogValue);
digitalWrite(pinGreenLed, HIGH);
if (analogValue >= THRESHOLD) {
digitalWrite(pinGreenLed, LOW);
digitalWrite(pinRedLed, HIGH);
else {
digitalWrite(pinRedLed, LOW);

Where to use MQ4 Methane Gas Sensor/Applications

The applications of the MQ4 methane gas sensor include the following.

  • This sensor is used in gas leakage detecting devices for homes, industries, offices, etc
  • These sensors detect the methane & natural gases
  • Used in portable gas detectors
  • Industrial Combustible gas detector
  • Gas leak alarm

Please refer to this link to know more about the MQ4 methane gas sensor datasheet.

Thus, gas sensors are also called gas detectors which are used for detecting and identifying various types of gases like explosive or toxic. These sensors vary based on size, detecting capacity, and range. The most frequently used gas sensor for identifying toxic and sensing smoke is a metal oxide-based sensor because it increases their resistance once they come into contact with gases. Here is a question for you, what are the different types of methane gas sensors available in the market?