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 gas sensor, manufactured by DF Robot, is a highly sensitive and reliable component 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 response to 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!
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
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
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-Based Air Quality Monitoring System with Multiple Gas Sensors and GSM Module
Image of AIRMS: A project utilizing MQ-4 in a practical application
This circuit is an air quality monitoring system that uses an Arduino UNO to read data from various sensors, including the MQ-7 for CO detection, MQ131 for ozone detection, MQ-135 for general air quality, and a DHT11 for temperature and humidity. The Arduino processes the sensor data and can communicate the results via a SIM800L module for remote monitoring.
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 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 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
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 AIRMS: A project utilizing MQ-4 in a practical application
Arduino-Based Air Quality Monitoring System with Multiple Gas Sensors and GSM Module
This circuit is an air quality monitoring system that uses an Arduino UNO to read data from various sensors, including the MQ-7 for CO detection, MQ131 for ozone detection, MQ-135 for general air quality, and a DHT11 for temperature and humidity. The Arduino processes the sensor data and can communicate the results via a SIM800L module for remote monitoring.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Gas leak detection in residential and industrial environments
  • Methane monitoring in mining and oil industries
  • Environmental air quality monitoring
  • Smart home safety systems
  • IoT-based gas detection systems

Technical Specifications

The MQ-4 sensor is designed for ease of use and integration into various electronic systems. Below are its key technical details:

Parameter Value
Operating Voltage 5V DC
Load Resistance (RL) Adjustable (typically 10 kΩ)
Heater Voltage (VH) 5V ± 0.2V
Power Consumption ≤ 800 mW
Detection Range 200 ppm to 10,000 ppm (CH₄)
Preheat Time ≥ 24 hours for optimal accuracy
Output Signal Analog voltage (0-5V)
Operating Temperature -20°C to 50°C
Humidity Range 33% to 95% RH
Sensor Life Span ≥ 5 years

Pin Configuration and Descriptions

The MQ-4 sensor typically comes with four pins or terminals. Below is the pinout description:

Pin Name Description
VCC Power supply pin (5V DC)
GND Ground connection
AOUT Analog output signal proportional to gas concentration
DOUT Digital output (threshold-based signal, optional)

Usage Instructions

The MQ-4 gas sensor is straightforward to use in a circuit. Follow the steps below to integrate it into your project:

Circuit Connection

  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 your microcontroller (e.g., Arduino UNO) to read the gas concentration.
  3. Digital Output (Optional): If using the DOUT pin, connect it to a digital input pin of your microcontroller. Adjust the onboard potentiometer to set the gas concentration threshold for the digital output.

Important Considerations

  • Preheating: Allow the sensor to preheat for at least 24 hours before taking accurate measurements. This ensures the internal heater stabilizes.
  • Calibration: For precise measurements, calibrate the sensor in a known gas concentration environment.
  • Ventilation: Ensure proper ventilation around the sensor to avoid saturation and improve response time.
  • Load Resistor: Use a load resistor (RL) of 10 kΩ for typical applications. Adjust as needed for your specific use case.

Example Code for Arduino UNO

Below is an example of how to use the MQ-4 sensor with an Arduino UNO to read analog values:

// MQ-4 Gas Sensor Example Code
// This code reads the analog output of the MQ-4 sensor and prints the value
// to the Serial Monitor. Ensure the sensor is connected to the correct pins.

const int MQ4_AOUT_Pin = A0; // Connect AOUT pin of MQ-4 to Arduino analog pin A0

void setup() {
  Serial.begin(9600); // Initialize serial communication at 9600 baud
  pinMode(MQ4_AOUT_Pin, INPUT); // Set the AOUT pin as input
}

void loop() {
  int sensorValue = analogRead(MQ4_AOUT_Pin); // Read the analog value from MQ-4
  float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage (0-5V range)

  // Print the sensor value and voltage to the Serial Monitor
  Serial.print("Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" | Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");

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

Best Practices

  • Avoid exposing the sensor to high concentrations of corrosive gases, as this may damage the sensing element.
  • Place the sensor in a stable environment to minimize noise and fluctuations in readings.
  • Use a decoupling capacitor (e.g., 0.1 µF) between VCC and GND to reduce power supply noise.

Troubleshooting and FAQs

Common Issues and Solutions

Issue Possible Cause Solution
No output signal Incorrect wiring or power supply issue Verify connections and ensure 5V power
Unstable or fluctuating readings Insufficient preheating time Allow the sensor to preheat for 24 hours
Low sensitivity to methane Calibration not performed Calibrate the sensor in a known gas environment
Sensor not responding to gas presence Sensor damaged or expired Replace the sensor if it has exceeded its lifespan

FAQs

  1. How long does the MQ-4 sensor last?

    • The sensor has a typical lifespan of 5 years under normal operating conditions.
  2. Can the MQ-4 detect gases other than methane?

    • While optimized for methane, the MQ-4 may respond to other combustible gases, but with reduced accuracy.
  3. Why is preheating necessary?

    • Preheating stabilizes the internal heater and ensures accurate and consistent readings.
  4. Can I use the MQ-4 with a 3.3V microcontroller?

    • The MQ-4 requires a 5V power supply for the heater. Use a level shifter or voltage divider for compatibility with 3.3V systems.

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