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 manufactured by Flying Fish, designed to detect various gases, particularly volatile organic compounds (VOCs). It operates on the principle of resistive change when exposed to target gases, providing an analog output proportional to the gas concentration. This sensor is widely used in air quality monitoring systems, industrial safety equipment, and environmental research.

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

Common Applications

  • Air quality monitoring systems
  • Industrial gas detection
  • Environmental research and analysis
  • Smart home devices for VOC detection
  • Automotive air quality control systems

Technical Specifications

The MQ-138 sensor is a versatile 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
Heater Power Consumption ≤ 800 mW
Detection Range 1 ppm to 1000 ppm (VOCs)
Preheat Time ≥ 24 hours for optimal performance
Output Signal Analog voltage
Operating Temperature -20°C to 50°C
Humidity Range ≤ 95% RH (non-condensing)
Dimensions 32mm x 20mm x 22mm (module size)

Pin Configuration and Descriptions

The MQ-138 module typically comes with a 4-pin interface. 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 the gas concentration threshold.

Usage Instructions

How to Use the MQ-138 in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 5V DC power source and the GND pin to the ground.
  2. Connect the Output:
    • Use the AOUT pin to read the analog signal for precise gas concentration measurements.
    • Optionally, use the DOUT pin for a simple HIGH/LOW signal based on a preset threshold.
  3. Adjust the Load Resistance: Use the onboard potentiometer to adjust the load resistance (RL) and set the desired sensitivity for the DOUT pin.
  4. Preheat the Sensor: Allow the sensor to preheat for at least 24 hours before taking accurate measurements.
  5. Read the Output: Use an ADC (Analog-to-Digital Converter) to read the AOUT signal or directly interface the DOUT pin with a microcontroller.

Important Considerations and Best Practices

  • Preheating: The sensor requires a preheating period of at least 24 hours for stable and accurate readings.
  • Ventilation: Ensure proper ventilation around the sensor to avoid saturation and improve response time.
  • Calibration: Calibrate the sensor in a controlled environment with known gas concentrations for accurate results.
  • Power Supply: Use a stable 5V DC power source to avoid fluctuations in the output signal.
  • Avoid Contamination: Keep the sensor away from water, dust, and corrosive gases to maintain its longevity.

Example Code for Arduino UNO

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

// MQ-138 Gas Sensor Example Code for Arduino UNO
// This code reads the analog output (AOUT) of the MQ-138 sensor and prints
// the value to the Serial Monitor. Ensure the sensor is preheated before use.

const int MQ138_AOUT_PIN = A0; // Connect AOUT pin of MQ-138 to Arduino A0

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

void loop() {
  int sensorValue = analogRead(MQ138_AOUT_PIN); // Read analog value from MQ-138
  float voltage = sensorValue * (5.0 / 1023.0); // Convert ADC value to voltage

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

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 DC power source.
  2. Inconsistent Readings:

    • Cause: Sensor not preheated or exposed to fluctuating environmental conditions.
    • Solution: Allow the sensor to preheat for at least 24 hours and ensure a stable environment.
  3. DOUT Pin Always HIGH or LOW:

    • Cause: Incorrect threshold setting on the potentiometer.
    • Solution: Adjust the potentiometer to set the desired sensitivity.
  4. Slow Response Time:

    • Cause: Poor ventilation or sensor saturation.
    • Solution: Improve ventilation around the sensor and avoid prolonged exposure to high gas concentrations.

FAQs

Q1: Can the MQ-138 detect gases other than VOCs?
A1: Yes, the MQ-138 can detect a range of gases, but it is optimized for VOCs. For other gases, calibration may be required.

Q2: How do I calibrate the MQ-138 sensor?
A2: Expose the sensor to a known concentration of the target gas and adjust the load resistance (RL) or use software calibration to map the output voltage to the gas concentration.

Q3: Can I use the MQ-138 with a 3.3V microcontroller?
A3: The MQ-138 requires a 5V power supply for the heater. However, you can use a voltage divider or level shifter to interface the output with a 3.3V microcontroller.

Q4: How long does the MQ-138 sensor last?
A4: The sensor has a typical lifespan of 2-3 years under normal operating conditions. Proper care and maintenance can extend its life.