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) and other harmful gases in the environment. It operates on the principle of resistive change in the presence of target gases, providing an analog output that can be easily interfaced with microcontrollers and other electronic systems.

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 and Use Cases

  • Air quality monitoring systems
  • Industrial safety and hazardous gas detection
  • Smart home automation for environmental monitoring
  • Laboratory and research applications
  • Portable gas detection devices

Technical Specifications

The MQ-138 sensor is a versatile and reliable component for gas detection. 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
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
Dimensions 32mm x 20mm x 22mm (approx.)

Pin Configuration and Descriptions

The MQ-138 module typically comes with a 4-pin interface. Below is the pinout description:

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. Powering the Sensor: Connect the VCC pin to a 5V DC power supply and the GND pin to the ground.
  2. Reading the Output:
    • Use the AOUT pin to read the analog voltage corresponding 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. Preheating the Sensor: Allow the sensor to preheat for at least 24 hours before taking accurate measurements. This stabilizes the internal heater and sensing element.
  4. Interfacing with a Microcontroller:
    • Connect the AOUT pin to an analog input pin of a microcontroller (e.g., Arduino UNO).
    • If using the DOUT pin, connect it to a digital input pin.

Important Considerations and Best Practices

  • Calibration: The sensor requires calibration for the specific gas you intend to detect. Use a known concentration of the target gas to determine the relationship between the analog output and gas concentration.
  • Ventilation: Ensure proper ventilation around the sensor to avoid saturation and improve response time.
  • Power Supply: Use a stable 5V power supply to avoid fluctuations in the sensor's output.
  • Avoid Contaminants: Keep the sensor away from water, oil, and other contaminants that may damage the sensing element.

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
// This code reads the analog output of the MQ-138 sensor and prints the value
// to the Serial Monitor. Ensure the sensor is properly connected to the Arduino.

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

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

void loop() {
  int sensorValue = analogRead(analogPin); // Read the analog value from the sensor
  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
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output or Incorrect Readings:

    • Ensure the sensor is properly powered (5V to VCC and GND connected).
    • Verify that the sensor has been preheated for at least 24 hours.
    • Check the connections to the microcontroller or ADC.
  2. Fluctuating Readings:

    • Use a stable power supply to avoid noise in the output.
    • Ensure the sensor is in a well-ventilated area to prevent gas accumulation.
  3. Digital Output Not Triggering:

    • Adjust the onboard potentiometer to set the desired gas concentration threshold.
    • Verify the DOUT pin connection to the microcontroller.
  4. Sensor Not Responding to Target Gas:

    • Confirm that the gas concentration is within the sensor's detection range.
    • Calibrate the sensor for the specific gas being detected.

FAQs

Q: Can the MQ-138 detect multiple gases simultaneously?
A: The MQ-138 is sensitive to a range of gases, but it does not differentiate between them. Calibration for a specific gas is recommended for accurate detection.

Q: How long does the sensor last?
A: The sensor has a typical lifespan of 2-3 years under normal operating conditions. Prolonged exposure to high concentrations of gases or contaminants may reduce its lifespan.

Q: Can I use the MQ-138 with a 3.3V system?
A: The MQ-138 requires a 5V power supply for proper operation. However, the analog output can be read by a 3.3V ADC if the voltage levels are within range.

Q: Is the sensor affected by temperature or humidity?
A: Yes, extreme temperatures and high humidity can affect the sensor's performance. Use it within the specified operating range for best results.