The MQ135 is a versatile gas sensor designed to detect a wide range of gases, including ammonia (NH3), benzene (C6H6), alcohol, smoke, 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 makes it an ideal choice for air quality monitoring and environmental safety applications.
The MQ135 gas sensor is manufactured by ESP32 with the part ID 002
. Below are the key technical details and pin configuration:
Parameter | Value |
---|---|
Operating Voltage | 5V DC |
Load Resistance (RL) | 10 kΩ (typical) |
Heating Voltage (VH) | 5V ± 0.2V |
Heating Current (IH) | ≤ 120 mA |
Sensing Resistance (RS) | 10 kΩ to 200 kΩ (clean air) |
Preheat Time | ≥ 24 hours |
Detection Range | 10 ppm to 1000 ppm |
Operating Temperature | -20°C to 50°C |
Humidity Range | ≤ 95% RH |
Dimensions | 18mm x 18mm x 15mm |
The MQ135 sensor typically comes with four pins. Below is the pinout description:
Pin Name | Description |
---|---|
VCC | Power supply pin (5V DC) |
GND | Ground pin |
AO | Analog output pin (provides gas concentration) |
DO | Digital output pin (threshold-based signal) |
VCC
pin to a 5V DC power source and the GND
pin to ground.AO
pin to an analog input pin of a microcontroller (e.g., Arduino UNO) to measure gas concentration.DO
pin for threshold-based detection. Adjust the onboard potentiometer to set the threshold level.Below is an example code snippet to interface the MQ135 with an Arduino UNO:
// Include necessary libraries
const int analogPin = A0; // Connect AO pin of MQ135 to A0 on Arduino
float sensorValue; // Variable to store sensor reading
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
pinMode(analogPin, INPUT); // Set the analog pin as input
}
void loop() {
sensorValue = analogRead(analogPin); // Read analog value from MQ135
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage
Serial.print("Sensor Value: ");
Serial.print(sensorValue);
Serial.print(" | Voltage: ");
Serial.println(voltage);
delay(1000); // Wait for 1 second before next reading
}
analogRead()
function reads the analog output from the MQ135 sensor.No Output or Incorrect Readings
Fluctuating Readings
Sensor Not Detecting Gases
High Humidity Impacting Performance
Q1: Can the MQ135 detect CO2?
A1: Yes, the MQ135 can detect CO2, but it is more sensitive to ammonia, benzene, and alcohol. For precise CO2 detection, consider a dedicated CO2 sensor.
Q2: How do I calibrate the MQ135 sensor?
A2: Place the sensor in clean air, measure the resistance (RS), and use it as the baseline for gas concentration calculations.
Q3: Can I use the MQ135 with a 3.3V microcontroller?
A3: The MQ135 requires a 5V power supply. Use a level shifter or voltage divider to interface with 3.3V systems.
Q4: How long does the sensor last?
A4: The MQ135 has a typical lifespan of 2-3 years under normal operating conditions.
By following this documentation, users can effectively integrate the MQ135 gas sensor into their projects for reliable air quality monitoring.