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

How to Use MQ-138: Examples, Pinouts, and Specs

Image of MQ-138
Cirkit Designer LogoDesign with MQ-138 in Cirkit Designer

Introduction

The MQ-138 is a gas sensor designed to detect various gases, particularly volatile organic compounds (VOCs) and other harmful gases. It operates on the principle of resistive change, where the sensor's resistance varies in the presence of target gases. This change is converted into an analog output signal, which can be processed by microcontrollers or other electronic systems.

The MQ-138 is widely used in applications such as:

  • Air quality monitoring systems
  • Industrial safety systems
  • Environmental monitoring
  • Smart home devices for detecting harmful gases
  • Research and development in gas detection technologies

Explore Projects Built with MQ-138

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Solar-Powered Environmental Monitoring Station with ESP32 and Gas Sensors
Image of AIR QUALITY MONITORING: A project utilizing MQ-138 in a practical application
This circuit is designed to monitor various gas levels and air quality using a set of sensors (MQ-136, MQ-6, MQ-137, MQ-7, and PMS5003) interfaced with an ESP32 microcontroller. The ESP32 collects sensor data and can control a relay module potentially for activating systems like fans or alarms based on the sensor readings. Additional components include a DHT22 for temperature and humidity readings, a power supply with a step-down converter, and safety features like resettable fuses and an LVD (Low Voltage Disconnect) to protect the battery and circuit.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO Based Air Quality Monitoring and GSM Notification System
Image of Arduino wild: A project utilizing MQ-138 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
ESP32-Based Air Quality Monitoring System with Multiple Sensors
Image of IIIT_H_mini_project: A project utilizing MQ-138 in a practical application
This circuit is an air quality monitoring system that uses an ESP32 microcontroller to collect data from various sensors, including the MQ135 and MQ-2 gas sensors, a DHT11 temperature and humidity sensor, and a PMS5003 PM2.5 air quality sensor. The ESP32 processes the sensor data and can potentially transmit it for further analysis or display.
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-138 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-138

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 AIR QUALITY MONITORING: A project utilizing MQ-138 in a practical application
Solar-Powered Environmental Monitoring Station with ESP32 and Gas Sensors
This circuit is designed to monitor various gas levels and air quality using a set of sensors (MQ-136, MQ-6, MQ-137, MQ-7, and PMS5003) interfaced with an ESP32 microcontroller. The ESP32 collects sensor data and can control a relay module potentially for activating systems like fans or alarms based on the sensor readings. Additional components include a DHT22 for temperature and humidity readings, a power supply with a step-down converter, and safety features like resettable fuses and an LVD (Low Voltage Disconnect) to protect the battery and circuit.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Arduino wild: A project utilizing MQ-138 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 IIIT_H_mini_project: A project utilizing MQ-138 in a practical application
ESP32-Based Air Quality Monitoring System with Multiple Sensors
This circuit is an air quality monitoring system that uses an ESP32 microcontroller to collect data from various sensors, including the MQ135 and MQ-2 gas sensors, a DHT11 temperature and humidity sensor, and a PMS5003 PM2.5 air quality sensor. The ESP32 processes the sensor data and can potentially transmit it for further analysis or display.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of AIRMS: A project utilizing MQ-138 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

Technical Specifications

The MQ-138 sensor is a versatile and reliable component. Below are its key technical details:

Parameter Value
Operating Voltage 5V DC
Load Resistance (RL) Adjustable (typically 10 kΩ)
Heater Voltage (VH) 5V ± 0.1V
Heater Power Consumption ≤ 800 mW
Detection Range 1 ppm to 1000 ppm (varies by gas)
Preheat Time ≥ 24 hours for stable operation
Output Signal Analog voltage
Operating Temperature -20°C to 50°C
Humidity Range ≤ 95% RH
Sensor Life ≥ 2 years

Pin Configuration and Descriptions

The MQ-138 sensor typically comes with four pins. Below is the pin configuration:

Pin Name Description
1 VCC Power supply pin. Connect to 5V DC.
2 GND Ground pin. Connect to the ground of the circuit.
3 AOUT Analog output pin. Provides a voltage proportional to the gas concentration.
4 DOUT Digital output pin. Outputs HIGH or LOW based on a preset threshold (optional).

Usage Instructions

How to Use the MQ-138 in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 5V DC power supply and the GND pin to the ground.
  2. Connect the Output:
    • Use the AOUT pin to read the analog signal. This pin provides a voltage proportional to the gas concentration.
    • Optionally, use the DOUT pin for a digital HIGH/LOW signal if a threshold is set using the onboard potentiometer.
  3. Preheat the Sensor: Allow the sensor to preheat for at least 24 hours before taking accurate readings. This ensures the internal heater stabilizes.
  4. Read the Output:
    • For analog readings, connect the AOUT pin to an analog input pin of a microcontroller (e.g., Arduino).
    • For digital readings, connect the DOUT pin to a digital input pin.

Important Considerations and Best Practices

  • Preheating: The MQ-138 requires a long preheating time (≥ 24 hours) for stable and accurate readings.
  • Calibration: Calibrate the sensor in a controlled environment with known gas concentrations for accurate results.
  • Ventilation: Ensure proper ventilation around the sensor to avoid saturation or false readings.
  • Load Resistor: Use an appropriate load resistor (typically 10 kΩ) to achieve the desired sensitivity and output range.
  • Avoid Contamination: Keep the sensor away from water, oil, and dust to maintain its performance and longevity.

Example: Using MQ-138 with Arduino UNO

Below is an example code to interface the MQ-138 with an Arduino UNO and read the analog output:

// Define the analog pin connected to the MQ-138 AOUT pin
const int MQ138_AOUT_PIN = A0;

// Variable to store the sensor reading
int sensorValue = 0;

void setup() {
  // Initialize serial communication for debugging
  Serial.begin(9600);
  Serial.println("MQ-138 Gas Sensor Test");
}

void loop() {
  // Read the analog value from the sensor
  sensorValue = analogRead(MQ138_AOUT_PIN);

  // Convert the analog value to a voltage (assuming 5V reference)
  float voltage = sensorValue * (5.0 / 1023.0);

  // 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");

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

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Cause: Incorrect wiring or power supply.
    • Solution: Double-check the connections and ensure the sensor is powered with 5V DC.
  2. Unstable Readings:

    • Cause: Insufficient preheating time or environmental interference.
    • Solution: Allow the sensor to preheat for at least 24 hours and ensure proper ventilation.
  3. Low Sensitivity:

    • Cause: Incorrect load resistor value or sensor aging.
    • Solution: Adjust the load resistor or replace the sensor if it has exceeded its lifespan.
  4. False Alarms:

    • Cause: Contamination or exposure to non-target gases.
    • Solution: Clean the sensor area and ensure it is used in a controlled environment.

FAQs

Q1: Can the MQ-138 detect multiple gases simultaneously?
A1: The MQ-138 is sensitive to a range of gases, but it does not differentiate between them. Calibration and additional processing are required to identify specific gases.

Q2: How do I calibrate the MQ-138?
A2: Expose the sensor to a known concentration of the target gas and record the output voltage. Use this data to create a calibration curve.

Q3: Can I use the MQ-138 with a 3.3V system?
A3: The MQ-138 is designed for 5V operation. Use a level shifter or voltage regulator to interface with 3.3V systems.

Q4: How long does the MQ-138 last?
A4: The sensor has a typical lifespan of 2 years under normal operating conditions.