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

How to Use MQ4: Examples, Pinouts, and Specs

Image of MQ4
Cirkit Designer LogoDesign with MQ4 in Cirkit Designer

Introduction

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.

Explore Projects Built with MQ4

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino UNO and A9G GSM/GPRS GPS-Based Air Quality Monitoring System
Image of A9G Smoke Sensor: A project utilizing MQ4 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
Arduino UNO Based Air Quality Monitoring and GSM Notification System
Image of Arduino wild: A project utilizing MQ4 in a practical application
This circuit features an Arduino UNO microcontroller interfaced with an MQ135 air quality sensor, an MPU-6050 accelerometer/gyroscope, a SIM900A GSM communication module, and a buzzer. The Arduino reads analog data from the MQ135 sensor and communicates with the MPU-6050 via I2C, while also controlling the buzzer and handling serial communication with the SIM900A module. The purpose of this circuit is likely to monitor air quality and motion, provide alerts through the buzzer, and enable remote communication via GSM.
Cirkit Designer LogoOpen Project in Cirkit Designer
Multi-Gas Detection System with Arduino and MQ Sensors
Image of Centrala calitate aer: A project utilizing MQ4 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 Mega 2560-Based Multi-Sensor Vehicle Tracker with GSM and GPS
Image of alcohol_detector: A project utilizing MQ4 in a practical application
This is a vehicle safety and tracking system that uses an Arduino Mega 2560 to monitor alcohol levels with an MQ-3 sensor, track location with a GPS module, communicate via GSM with a Sim800l module, display data on an LCD, and control a motor with an L293D driver. It also includes temperature sensing and vibration detection for additional monitoring and feedback.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MQ4

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 A9G Smoke Sensor: A project utilizing MQ4 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 Arduino wild: A project utilizing MQ4 in a practical application
Arduino UNO Based Air Quality Monitoring and GSM Notification System
This circuit features an Arduino UNO microcontroller interfaced with an MQ135 air quality sensor, an MPU-6050 accelerometer/gyroscope, a SIM900A GSM communication module, and a buzzer. The Arduino reads analog data from the MQ135 sensor and communicates with the MPU-6050 via I2C, while also controlling the buzzer and handling serial communication with the SIM900A module. The purpose of this circuit is likely to monitor air quality and motion, provide alerts through the buzzer, and enable remote communication via GSM.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Centrala calitate aer: A project utilizing MQ4 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 alcohol_detector: A project utilizing MQ4 in a practical application
Arduino Mega 2560-Based Multi-Sensor Vehicle Tracker with GSM and GPS
This is a vehicle safety and tracking system that uses an Arduino Mega 2560 to monitor alcohol levels with an MQ-3 sensor, track location with a GPS module, communicate via GSM with a Sim800l module, display data on an LCD, and control a motor with an L293D driver. It also includes temperature sensing and vibration detection for additional monitoring and feedback.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Gas leak detection in residential and industrial environments
  • Methane monitoring in mining and oil industries
  • Natural gas detection in HVAC systems
  • Air quality monitoring systems
  • DIY electronics and Arduino-based projects

Technical Specifications

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

Pin Configuration and Descriptions

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)

Usage Instructions

How to Use the MQ4 in a Circuit

  1. Power Supply: Connect the VCC pin to a 5V DC power source and the GND pin to ground.
  2. Analog Output: Connect the AOUT pin to an analog input pin of a microcontroller (e.g., Arduino) to read the gas concentration as a voltage signal.
  3. Digital Output (Optional): If using the DOUT pin, connect it to a digital input pin of the microcontroller. Adjust the onboard potentiometer to set the gas concentration threshold for triggering the digital output.
  4. Preheating: Allow the sensor to preheat for at least 24 hours before taking accurate measurements.

Important Considerations and Best Practices

  • Preheat Time: The sensor requires a preheat time of at least 24 hours for stable and accurate readings.
  • Ventilation: Ensure proper ventilation around the sensor to avoid saturation and ensure accurate detection.
  • Calibration: Calibrate the sensor in a known gas concentration environment for precise measurements.
  • Avoid Contaminants: Keep the sensor away from water, oil, and corrosive gases, as these can damage the sensing element.
  • Load Resistor: Use an appropriate load resistor (typically 10 kΩ) to achieve the desired sensitivity and output range.

Example: Connecting MQ4 to Arduino UNO

Below is an example of how to connect and use the MQ4 sensor with an Arduino UNO:

Circuit Diagram

  • Connect the MQ4'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 A0.

Arduino Code

// 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
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Cause: Incorrect wiring or insufficient power supply.
    • Solution: Double-check the connections and ensure a stable 5V power supply.
  2. Inaccurate Readings:

    • Cause: Insufficient preheat time or improper calibration.
    • Solution: Allow the sensor to preheat for at least 24 hours and calibrate it in a known gas concentration.
  3. Sensor Saturation:

    • Cause: Prolonged exposure to high gas concentrations.
    • Solution: Ensure proper ventilation and avoid continuous exposure to high gas levels.
  4. Digital Output Not Triggering:

    • Cause: Incorrect threshold setting on the potentiometer.
    • Solution: Adjust the potentiometer to set the desired gas concentration threshold.

FAQs

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.