Description
MQ135 - Air Quality Control Gas Sensor Module
The MQ135 Air Quality Sensor Module is used to detect a wide range of harmful gases in the air, including ammonia (NH₃), benzene, sulfur compounds, smoke, carbon dioxide (CO₂), and alcohol vapors. It provides both analog and digital outputs and is ideal for monitoring indoor air quality. This sensor is commonly used in air purifiers, pollution detection systems, and home safety devices.
Technical Specifications:
-
Operating Voltage: 5V DC
-
Detection Range: 10–1000 ppm for various gases
-
Output Type: Analog (A0), Digital (D0)
-
Heater Power: ~900 mW
-
Preheat Time: ~2–5 minutes for stable readings
- Sensitivity: Adjustable via onboard potentiometer
Pinouts:
Connection with Arduino:
Module |
Arduino UNO |
VCC |
5V |
GND |
GND |
A0 |
A0 |
D0 |
D2(Optional) |
Sample code:
Analog reading:
int mq135Pin = A0; // MQ135 Analog output connected to Arduino A0
void setup() {
Serial.begin(9600); // Initialize Serial Monitor
}
void loop() {
int airQualityValue = analogRead(mq135Pin); // Read analog value
Serial.print("Air Quality Value: ");
Serial.println(airQualityValue); // Print the value to the Serial Monitor
delay(1000); // Wait for 1 second
}
Add a Buzzer Alert When Air Quality Drops
int mq135Pin = A0;
int buzzerPin = 8;
int threshold = 400; // Adjust this based on your environment
void setup() {
Serial.begin(9600);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
int airQuality = analogRead(mq135Pin);
Serial.print("Air Quality: ");
Serial.println(airQuality);
if (airQuality > threshold) {
digitalWrite(buzzerPin, HIGH); // Alert ON
} else {
digitalWrite(buzzerPin, LOW); // Alert OFF
}
delay(500);
}