How to Use MQ4 Gas Sensor?
MQ-4 datasheet pdf and Unclassified product details from Zhengzhou Winsen Elec Tech stock available at Utmel









This MQ4 Gas Sensor module is useful for gas leakage detection. It is suitable for detecting Methane, Propane, Butane, and other combustible gas. The sensitivity of the sensor can be adjusted by a potentiometer. In this post, we will see an introduction to the MQ4 methane gas sensor, it's working, interfacing with Arduino, and applications.

Arduino, MQ4 methane gas detector
Overview of MQ4 Gas Sensor
The MQ4 methane gas sensor is a MOS (metal oxide semiconductor) type sensor that detects methane gas concentration in the air at home or in the workplace and gives an analog voltage output when read. The concentration range for sensing, in this case, is 300 pm – 10,000 ppm, which is suitable for detecting a leak.
The main component of this gas sensor is a detecting element made of aluminum oxide (Al2O3) ceramic covered with Tin dioxide (SnO2) and organized within a stainless-steel mesh.
MQ4 Gas Sensor Pinout
The pin configuration of the MQ4 methane gas sensor is shown below.


MQ4 Pinout
| Pin Name | Function |
| VCC | Positive power supply pin |
| GND | Reference potential pin |
| AO | Analog output pin. It generates a signal proportional to the intensity of methane. |
| DO | Digital Output pin. It also produces a digital signal whose limit can be set using a potentiometer. |
MQ4 Gas Sensor Features
Good sensitivity to a wide range of combustible gas
High sensitivity to Natural gas
Stable and long life
Small sensitivity to alcohol, smoke
Fast response Stable and long life
MQ4 Gas Sensor Specifications
Power requirements: VCC - 5V±0.1
DO output: TTL digital 0 and 1 (0.1 and 5V)
AO output: 0.1-0 .3 V (relative to pollution), the maximum concentration of a voltage of about 4V
Detection Gas: Natural gas/Methane
Operating temperature: 14 to 122 °F (-10 to 50°C)
RH Related humidity less than 95%Rh
O2 Oxygen concentration is 21% (standard condition) - Oxygen concentration can affect sensitivity
Load resistance: 20KΩ
Sensing Resistance Rs: 10KΩ- 60KΩ (1000ppm CH4)
Preheat time:Over 24 hour
Detection Concentration: 200-10000ppm (Natural gas / Methane)
Interface: 1 TTL compatible input (HSW), 1 TTL compatible output (ALR)
Heater consumption: less than 750mw
Working Principle of MQ4 Gas Sensor
The power LED illuminates as soon as the module is turned on. The MQ-4 detects the presence of methane in the atmosphere. The sensor's analog pin then produces an analog signal proportional to the amount of CH4 in the air. An ADC microcontroller can be used to measure a sensor's analog output.
Most microcontrollers nowadays include an ADC peripheral that can be used to read the analog output of sensors like the MQ4. The methane gas sensor's analog output signal is read by the microcontroller, which then performs signal conditioning to transform the observed analog voltage into methane concentration in the air. When methane gas is detected, the digital pin turns HIGH and the built-in LED for the Digital output illuminates. This digital pin can also be used to control other operations using a microcontroller.
Digital Output of MQ4 Gas Sensor
When there is methane gas present, the D0 pin creates a high (equal to VCC) signal and a low (equivalent to about 0.1 V) signal. The trimmer pot on the circuit can be used to calibrate this "digital" output.

MQ4 Digital Output Circuit
The D0 pin is connected to the Arduino's digital pin 2. The Arduino sketch below uses an interrupt to ensure that the MQ-4 is always detected first by the microcontroller.

MQ4 Arduino Data
Analog Output of MQ4 Gas Sensor
Determining PPM Equation

Sensitivity curve of the MQ-4
This graph, taken from the device datasheet, depicts the MQ-4's sensitivity to gases. It's especially sensitive to CH4, the molecular term for methane, as shown above. Propane and butane gases are not included in the curve, even though they are both known components of LPG (which is second to methane in this curve).
The graph depicts the relationship between RS/R0 and gas concentration in parts-per-million on a log-log scale (PPM). The ratio of sensor resistance at target gas (RS) to sensor resistance in clean air (R0) is RS/R0 (R0). As a result, knowing RS/R0 allows us to calculate the gas concentration in PPM.
To derive a formula, we take two points on this graph. Later on, we'll use this formula in our Arduino sketch.
When RS/R0 = 1 and PPM = 1000, the most evident point appears. When RS/R0 is around 0.58 and PPM = 5000, the second point is reached. The formula begins with:

From the first point, we'll assign Y1 = 1, X1 = 1000, and from the second point, Y2 = 0.58, X2 = 5000. Substituting these values into the previous equation:

Changing Y to RS/R0 and X to PPM and solving for PPM:

Methane PPM Output Arduino Diagram
In the presence of methane, the sensor resistance is RS, while in clean air, the sensor resistance is R0. R0 would be the simplest to figure out of the two. Using an ohmmeter, we measure the resistance of electrodes 1-6 or 4-3.

MQ4 Arduino Diagram
As can be seen, Aout is connected to one of the electrodes and a resistor RL in parallel. This indicates that the electrode resistance generates a voltage divider with RL, resulting in the following voltage at Aout:

The resistance of our target electrode, RS, fluctuates depending on the amount of methane present.
RL is an SMD resistor with the designation 102, by the way. This is equivalent to a 1k resistance.
So we apply this formula to get RS.
Equivalents for MQ4 Gas Sensor
MQ 214, MQ306A, MQ-5, MQ306A & MQ-2
Alternatives for MQ4 Gas Sensor
MQ2, 3, 4, 5, 6, 7, 8, 9, 131, 135, 136, 137, 138, 214, 216, 303A, 306A, 307A, 309A
MQ4 Gas Sensor Dimension

MQ4 Gas Sensor Dimension
What is the use of MQ-4 gas sensor?
MQ-4 gas sensor has a high sensitivity to Methane, also to Propane and Butane. The sensor could be used to detect different combustible gas, especially Methane, which is with low cost and suitable for different applications.
How does MQ-4 gas sensor work?
The MQ-4 works by sensing the methane concentration in the air. The analog pin of the sensor then generates an analog signal proportional to the amount of CH4 in the air. We can measure the analog output of a sensor with an ADC microcontroller.
What is the output of MQ4 sensor?
The MQ4 can detect natural gas concentrations anywhere from 200 to 10000 ppm. This sensor has selective digital or analog output capability which can be measured easily with SPDuino or any other microcontroller.
What is the range of MQ sensor?
The concentration sensing range of 300 ppm to 10,000 ppm is suitable for leak detection. For example, the sensor could detect if someone left a gas stove on but not lit. The sensor can operate at temperatures from -10 to 50°C and consumes less than 150 mA at 5 V.
BMP280 Sensor: Pinout, Application, Circuit and Comparison18 August 20214823
STM32L010F4P6: Features, Applications, and Datasheet29 November 20231543
Beginner's tutorial for STM32F429IGT6 microcontroller setup24 July 2025169
PMEG10010ELRX Schottky Barrier Rectifier: 100V, 1A, Datasheet08 March 2022936
ST7FLITE09Y0M6 STMicrocontroller 8-bit microcontroller: Pinout, Datasheet and Applications04 January 2022976
MC74HC4051A Analog Multiplexer: Pinout, Equivalent and Datasheet14 February 20223274
DB3 DIAC 36V 0.05mA 2-Pin DO-35[video]: Datasheet, Features, and Applications11 March 20226785
RC4558P Operational Amplifier: Layout, Pinout, and Datasheet20 April 20225546
What is a Cell Phone Antenna?21 July 202128558
Introduction to TFT Displays29 August 20207463
QUIC: The Next Generation Communication Protocol22 February 20221641
Semiconductor R&D Spending: Top 12 Countries20 September 20232260
Arduino and Bluetooth Based Home Automation29 August 20235904
Photoresistor Basics: Types, Principles and Applications16 October 202542205
Introduction to the Types of Monitor Cables01 April 202414707
Aluminum Electrolytic Capacitor Basis: Definition, Characteristics and Life03 March 20225527
Zhengzhou Winsen Elec Tech
In Stock
United States
China
Canada
Japan
Russia
Germany
United Kingdom
Singapore
Italy
Hong Kong(China)
Taiwan(China)
France
Korea
Mexico
Netherlands
Malaysia
Austria
Spain
Switzerland
Poland
Thailand
Vietnam
India
United Arab Emirates
Afghanistan
Åland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antigua & Barbuda
Argentina
Armenia
Aruba
Australia
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius and Saba
Bosnia & Herzegovina
Botswana
Brazil
British Indian Ocean Territory
British Virgin Islands
Brunei
Bulgaria
Burkina Faso
Burundi
Cabo Verde
Cambodia
Cameroon
Cayman Islands
Central African Republic
Chad
Chile
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Congo
Congo (DRC)
Cook Islands
Costa Rica
Côte d’Ivoire
Croatia
Cuba
Curaçao
Cyprus
Czechia
Denmark
Djibouti
Dominica
Dominican Republic
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Falkland Islands
Faroe Islands
Fiji
Finland
French Guiana
French Polynesia
Gabon
Gambia
Georgia
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Honduras
Hungary
Iceland
Indonesia
Iran
Iraq
Ireland
Isle of Man
Israel
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Kosovo
Kuwait
Kyrgyzstan
Laos
Latvia
Lebanon
Lesotho
Liberia
Libya
Liechtenstein
Lithuania
Luxembourg
Macao(China)
Madagascar
Malawi
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Micronesia
Moldova
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Korea
North Macedonia
Northern Mariana Islands
Norway
Oman
Pakistan
Palau
Palestinian Authority
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn Islands
Portugal
Puerto Rico
Qatar
Réunion
Romania
Rwanda
Samoa
San Marino
São Tomé & Príncipe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
Somalia
South Africa
South Sudan
Sri Lanka
St Helena, Ascension, Tristan da Cunha
St. Barthélemy
St. Kitts & Nevis
St. Lucia
St. Martin
St. Pierre & Miquelon
St. Vincent & Grenadines
Sudan
Suriname
Svalbard & Jan Mayen
Sweden
Syria
Tajikistan
Tanzania
Timor-Leste
Togo
Tokelau
Tonga
Trinidad & Tobago
Tunisia
Turkey
Turkmenistan
Turks & Caicos Islands
Tuvalu
U.S. Outlying Islands
U.S. Virgin Islands
Uganda
Ukraine
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Wallis & Futuna
Yemen
Zambia
Zimbabwe


