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.
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) |
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. |
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
}
No Output Signal:
Inconsistent Readings:
DOUT Pin Always HIGH or LOW:
Slow Response Time:
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.