MQ-135 Gas Sensor

Introduction

The MQ-135 is a popular gas sensor used for detecting air quality and hazardous gases such as ammonia (NH3), sulfur dioxide (SO2), benzene, carbon dioxide (CO2), and other harmful volatile organic compounds (VOCs). It is widely utilized in air quality monitoring systems, industrial safety devices, and environmental applications. With its high sensitivity and low cost, the MQ-135 is a preferred choice for both hobbyists and professionals working on IoT and embedded systems projects.

This article provides an in-depth look at the MQ-135 gas sensor, covering its working principle, specifications, interfacing with Arduino, applications, calibration methods, and troubleshooting.

Overview of the MQ-135 Gas Sensor

1. Key Features

  • High sensitivity to a variety of gases, including CO2, NH3, SO2, benzene, and alcohol vapors.
  • Low-cost and widely available for gas detection applications.
  • Analog and digital output for easy interfacing with microcontrollers.
  • Fast response time and recovery.
  • Long life span and stable performance.
  • Compatible with Arduino, Raspberry Pi, and other microcontrollers.

2. Technical Specifications

  • Operating Voltage: 5V DC
  • Power Consumption: < 800mW
  • Preheat Time: 24 hours (recommended for accurate readings)
  • Output Type: Analog (variable voltage) & Digital (threshold-based output)
  • Sensing Range: 10-1000 ppm
  • Operating Temperature: -10°C to 50°C
  • Humidity Range: 10% – 95% RH

Working Principle of MQ-135

The MQ-135 sensor is based on a SnO2 (tin dioxide) semiconductor layer that reacts with gas molecules in the air. When hazardous gases come in contact with the sensor, the resistance of the sensor changes, leading to a variation in the output voltage. This voltage is then read by a microcontroller (such as Arduino) to determine the concentration of the detected gas.

The MQ-135 has two outputs:

  1. Analog Output (AO): Provides a voltage proportional to the gas concentration.
  2. Digital Output (DO): Goes HIGH when the gas level exceeds a predefined threshold.

Interfacing MQ-135 with Arduino

The MQ-135 sensor can be easily interfaced with Arduino using its analog or digital output. Below is a simple wiring diagram and code example to read gas concentration levels.

1. Required Components

  • MQ-135 Gas Sensor
  • Arduino Board (Uno, Mega, Nano, etc.)
  • Jumper Wires
  • 5V Power Supply

2. Wiring the Sensor

MQ-135 PinArduino Pin
VCC5V
GNDGND
AOA0
DOAny Digital Pin

3. Arduino Code Example

const int mq135Pin = A0;
void setup() {
  Serial.begin(9600);
}
void loop() {
  int sensorValue = analogRead(mq135Pin);
  float ppm = (sensorValue / 1023.0) * 1000; // Example calculation
  Serial.print("Gas Concentration (PPM): ");
  Serial.println(ppm);
  delay(1000);
}

Applications of MQ-135 Sensor

1. Air Quality Monitoring

  • Detecting pollution levels in indoor and outdoor environments.
  • Used in smart cities for real-time air monitoring.

2. Industrial Safety Systems

  • Detection of toxic gases in factories and chemical plants.
  • Used in coal mines and oil refineries to prevent gas leakage hazards.

3. Home Automation

  • Integrated into smart homes to detect harmful gases and trigger alarms.
  • Connected with IoT devices to monitor and report air quality.

4. Automotive Industry

  • Detecting CO2 and CO levels inside vehicles.
  • Ensuring proper ventilation and air circulation in closed environments.

5. Medical Applications

  • Used in hospitals to monitor indoor air quality.
  • Helps in detecting harmful VOCs in medical labs.

Calibration of MQ-135 Sensor

Calibration is essential to obtain accurate readings from the MQ-135 sensor. The sensor’s response varies based on environmental conditions such as humidity and temperature.

1. Preheating the Sensor

  • The MQ-135 requires 24 hours of preheating before initial use.
  • This ensures that the sensor stabilizes and provides accurate readings.

2. Calculating the Sensor’s Resistance

Use the formula:

Rs = (Vc / VRL - 1) * RL

Where:

  • Rs = Sensor Resistance
  • Vc = Supply Voltage (5V)
  • VRL = Voltage across Load Resistor (RL)

3. Using a Reference Gas for Calibration

  • Expose the sensor to a known gas concentration (e.g., CO2 at 400 ppm).
  • Adjust the reference values in the code for accurate conversion.

Troubleshooting Common Issues

1. Sensor Not Giving Any Output

  • Ensure proper power connections.
  • Check if the sensor is preheated for at least 24 hours.
  • Use a multimeter to verify sensor voltage levels.

2. Inaccurate Readings

  • Calibrate the sensor using a reference gas.
  • Avoid placing the sensor near humidity sources.
  • Ensure stable power supply to avoid fluctuations.

3. False Alarms

  • Adjust the digital output threshold using the onboard potentiometer.
  • Filter noise in analog readings using a moving average filter.
Categories: Uncategorized