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:
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 |
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). |
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);
}
No Output Signal:
Unstable Readings:
Low Sensitivity:
False Alarms:
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.