Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use MQ 4: Examples, Pinouts, and Specs

Image of MQ 4
Cirkit Designer LogoDesign with MQ 4 in Cirkit Designer

Introduction

The MQ-4 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 MQ-4 provides an analog output signal proportional to the gas concentration, making it suitable for a wide range of applications.

Explore Projects Built with MQ 4

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Multi-Gas Detection System with Arduino and MQ Sensors
Image of Centrala calitate aer: A project utilizing MQ 4 in a practical application
This circuit is designed to monitor various gases using a series of MQ gas sensors (MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9, and MQ-135), each providing digital outputs to an Arduino UNO microcontroller. The Arduino is also connected to a piezo speaker for audible alerts and multiple LEDs with resistors, likely for visual status indicators. An Adafruit TCA9548A I2C multiplexer is included, suggesting the potential for I2C sensor expansion or managing multiple I2C devices.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and A9G GSM/GPRS GPS-Based Air Quality Monitoring System
Image of A9G Smoke Sensor: A project utilizing MQ 4 in a practical application
This circuit features an Arduino UNO microcontroller interfaced with an A9G GSM/GPRS+GPS module and an MQ2 gas sensor. The Arduino communicates with the A9G module via digital pins D11 and D10 for data transmission, and it reads analog gas concentration levels from the MQ2 sensor through analog pin A5. Both the A9G module and the MQ2 sensor are powered by the Arduino's 5V output, and all components share a common ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
MQ-4 Gas Sensor Controlled Exhaust Fan System
Image of automatic exhaust : A project utilizing MQ 4 in a practical application
This circuit features an MQ-4 gas sensor connected to a 5V relay, which likely controls the activation of an exhaust fan based on the gas concentration levels detected. The relay switches power from a 7.4V source to the fan, with two rocker switches acting as manual on/off controls for the power supply to the relay and the fan. The circuit is designed to provide safety by automatically activating ventilation when potentially dangerous gas levels are detected.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and MQ-4 Gas Sensor Interface
Image of MQ4 Connections: A project utilizing MQ 4 in a practical application
This circuit is designed to interface an Arduino UNO with an MQ-4 gas sensor for the detection and measurement of gas concentrations. The Arduino provides power to the sensor and reads its analog output for processing. The embedded code for the Arduino is currently a template without specific functionality implemented.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MQ 4

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Centrala calitate aer: A project utilizing MQ 4 in a practical application
Multi-Gas Detection System with Arduino and MQ Sensors
This circuit is designed to monitor various gases using a series of MQ gas sensors (MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9, and MQ-135), each providing digital outputs to an Arduino UNO microcontroller. The Arduino is also connected to a piezo speaker for audible alerts and multiple LEDs with resistors, likely for visual status indicators. An Adafruit TCA9548A I2C multiplexer is included, suggesting the potential for I2C sensor expansion or managing multiple I2C devices.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of A9G Smoke Sensor: A project utilizing MQ 4 in a practical application
Arduino UNO and A9G GSM/GPRS GPS-Based Air Quality Monitoring System
This circuit features an Arduino UNO microcontroller interfaced with an A9G GSM/GPRS+GPS module and an MQ2 gas sensor. The Arduino communicates with the A9G module via digital pins D11 and D10 for data transmission, and it reads analog gas concentration levels from the MQ2 sensor through analog pin A5. Both the A9G module and the MQ2 sensor are powered by the Arduino's 5V output, and all components share a common ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of automatic exhaust : A project utilizing MQ 4 in a practical application
MQ-4 Gas Sensor Controlled Exhaust Fan System
This circuit features an MQ-4 gas sensor connected to a 5V relay, which likely controls the activation of an exhaust fan based on the gas concentration levels detected. The relay switches power from a 7.4V source to the fan, with two rocker switches acting as manual on/off controls for the power supply to the relay and the fan. The circuit is designed to provide safety by automatically activating ventilation when potentially dangerous gas levels are detected.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of MQ4 Connections: A project utilizing MQ 4 in a practical application
Arduino UNO and MQ-4 Gas Sensor Interface
This circuit is designed to interface an Arduino UNO with an MQ-4 gas sensor for the detection and measurement of gas concentrations. The Arduino provides power to the sensor and reads its analog output for processing. The embedded code for the Arduino is currently a template without specific functionality implemented.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Gas leak detection in homes and industries
  • Methane monitoring in mining and oil fields
  • Natural gas detection in HVAC systems
  • Environmental monitoring systems
  • IoT-based gas detection projects

Technical Specifications

The MQ-4 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.2V DC/AC
Heating Current < 150 mA
Gas Detection Range 200 ppm to 10,000 ppm (CH₄)
Preheating Time ≥ 24 hours
Sensitivity Detects methane and natural gas
Operating Temperature -20°C to 50°C
Humidity Range ≤ 95% RH
Output Signal Analog voltage (proportional to gas concentration)

Pin Configuration and Descriptions

The MQ-4 sensor typically comes with four pins or six pins, depending on the module version. Below is the pin configuration for the 4-pin version:

Pin Name Description
1 VCC Power supply input (5V DC)
2 GND Ground connection
3 AOUT Analog output signal (proportional to gas level)
4 DOUT Digital output signal (threshold-based, optional)

For the 6-pin version, two additional pins are used for the internal heater connections (H1 and H2). These are typically pre-wired in most modules.

Usage Instructions

How to Use the MQ-4 in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 5V DC power supply and the GND pin to ground.
  2. Read the Output:
    • Use the AOUT pin to read the analog voltage signal, which varies with the gas concentration.
    • Optionally, use the DOUT pin for a digital signal if the module includes a comparator circuit.
  3. Preheat the Sensor: Allow the sensor to preheat for at least 24 hours before initial use to stabilize its readings.
  4. Connect to a Microcontroller: The analog output can be connected to an ADC (Analog-to-Digital Converter) pin of a microcontroller like the Arduino UNO for further processing.

Important Considerations and Best Practices

  • Preheating: The sensor requires a preheating period of 24 hours for accurate readings. For subsequent uses, a shorter warm-up time (a few minutes) is sufficient.
  • Calibration: Calibrate the sensor in a known gas concentration environment to improve accuracy.
  • Ventilation: Ensure proper ventilation around the sensor to avoid saturation and false readings.
  • Load Resistor: Adjust the load resistor (RL) value to optimize the sensor's sensitivity and output range.
  • Avoid Contaminants: Keep the sensor away from water, oil, and corrosive gases, as these can damage the sensing element.

Example: Connecting MQ-4 to Arduino UNO

Below is an example of how to connect the MQ-4 sensor to an Arduino UNO and read the analog output:

Circuit Connections

  • Connect the MQ-4's VCC pin to the Arduino's 5V pin.
  • Connect the GND pin to the Arduino's GND.
  • Connect the AOUT pin to the Arduino's analog input pin (e.g., A0).

Arduino Code

// MQ-4 Gas Sensor Example with Arduino UNO
// Reads the analog output of the MQ-4 sensor and prints the value to the Serial Monitor

const int gasSensorPin = A0; // Analog pin connected to MQ-4 AOUT
int sensorValue = 0;         // Variable to store the sensor reading

void setup() {
  Serial.begin(9600); // Initialize serial communication at 9600 baud
  Serial.println("MQ-4 Gas Sensor Test");
}

void loop() {
  sensorValue = analogRead(gasSensorPin); // Read the analog value from the sensor
  Serial.print("Gas Sensor Value: ");
  Serial.println(sensorValue); // Print the sensor value to the Serial Monitor

  delay(1000); // Wait for 1 second before the next reading
}

Notes on the Code

  • The analogRead() function reads the voltage from the AOUT pin and converts it to a digital value (0–1023 for a 10-bit ADC).
  • The sensor value can be mapped to a gas concentration using a calibration curve provided in the sensor's datasheet.

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Check the power supply connections (VCC and GND).
    • Ensure the sensor has completed its preheating period.
  2. Inaccurate Readings:

    • Verify the load resistor (RL) value is correctly set.
    • Calibrate the sensor in a known gas concentration environment.
  3. Fluctuating Output:

    • Ensure the sensor is in a stable environment with consistent airflow.
    • Avoid placing the sensor near heat sources or strong electromagnetic fields.
  4. Sensor Not Responding to Gas:

    • Confirm the target gas is within the sensor's detection range.
    • Check for physical damage to the sensor or contamination.

FAQs

Q: Can the MQ-4 detect gases other than methane?
A: While the MQ-4 is optimized for methane and natural gas, it may respond to other combustible gases. However, its sensitivity and accuracy for non-target gases may be lower.

Q: How long does the MQ-4 last?
A: The sensor typically has a lifespan of 2–3 years under normal operating conditions.

Q: Can I use the MQ-4 outdoors?
A: The MQ-4 can be used outdoors, but it should be protected from water, extreme temperatures, and high humidity to ensure reliable operation.

Q: Is the digital output (DOUT) always available?
A: The DOUT pin is only available on MQ-4 modules with an onboard comparator circuit. Check your module's specifications to confirm.

By following this documentation, users can effectively integrate the MQ-4 gas sensor into their projects for reliable methane and natural gas detection.