The MQ135 is a versatile gas sensor designed to detect a wide range of gases, including ammonia, benzene, alcohol, and smoke. Manufactured by ESP32 with the part ID 001, this sensor is widely used in air quality monitoring systems, industrial safety applications, and environmental testing. It operates on the principle of resistive change, where the sensor's resistance varies in the presence of target gases, producing an analog output that can be easily read by microcontrollers.
The MQ135 sensor is designed for ease of use and integration into various systems. Below are its key technical details:
Parameter | Value |
---|---|
Operating Voltage | 5V DC |
Load Resistance | 10 kΩ (recommended) |
Heating Voltage | 5V ± 0.1V |
Power Consumption | ≤ 800 mW |
Detection Range | 10 ppm to 1000 ppm |
Preheat Time | ≥ 24 hours (for stable output) |
Analog Output | 0V to 5V |
Operating Temperature | -20°C to 50°C |
Humidity Range | ≤ 95% RH |
Sensor Life Span | ≥ 2 years |
The MQ135 sensor typically comes with four pins. Below is the pinout description:
Pin Name | Description |
---|---|
VCC | Power supply input (5V DC) |
GND | Ground |
AOUT | Analog output signal (proportional to gas concentration) |
DOUT | Digital output signal (threshold-based, optional) |
The MQ135 sensor is straightforward to use in a circuit. Follow the steps below to integrate it into your project:
VCC
pin to a 5V power source and the GND
pin to ground.AOUT
pin to an analog input pin on your microcontroller (e.g., Arduino UNO or ESP32).DOUT
pin, connect it to a digital input pin on your microcontroller. Adjust the onboard potentiometer to set the gas concentration threshold for the digital output.AOUT
pin and ground for optimal performance.Below is an example of how to use the MQ135 sensor with an Arduino UNO to read analog values:
// MQ135 Gas Sensor Example Code
// Reads analog values from the sensor and prints them to the Serial Monitor.
const int MQ135_PIN = A0; // Connect AOUT pin of MQ135 to Arduino analog pin A0
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
Serial.println("MQ135 Gas Sensor Test");
}
void loop() {
int sensorValue = analogRead(MQ135_PIN); // Read analog value from MQ135
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage (0-5V)
// Print the raw 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:
DOUT
pin.Q: Can the MQ135 detect multiple gases simultaneously?
A: Yes, the MQ135 can detect a variety of gases, but it does not differentiate between them. It provides a combined analog output based on the total concentration of detectable gases.
Q: How do I calibrate the MQ135 sensor?
A: Place the sensor in clean air and record the baseline analog output. Use this value to calculate gas concentrations relative to the baseline.
Q: Can I use the MQ135 with a 3.3V microcontroller like ESP32?
A: Yes, but you will need a level shifter or voltage divider to safely interface the 5V analog output with the 3.3V ADC of the ESP32.
Q: How long does the MQ135 sensor last?
A: The sensor has a typical lifespan of 2 years under normal operating conditions.
By following this documentation, you can effectively integrate the MQ135 gas sensor into your projects for reliable air quality monitoring and gas detection.