

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.








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.) |
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. |
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
}
No Output or Incorrect Readings:
Fluctuating Readings:
Digital Output Not Triggering:
Sensor Not Responding to Target Gas:
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.