5V
5V
150mA (max)
Analog voltage (0V to 5V)
100-1000ppm (dependent on gas type)
10-30 seconds
-20C to 50C
5-95% RH
34mm x 20mm x 10mm
Applications
The MQ-135 Gas Sensor Module is suitable for a wide range of applications, including |
Air quality monitoring systems
Industrial process control systems
Safety systems
Environmental monitoring systems
HVAC systems
Home automation systems
Precautions and Notes
The module should be used in a well-ventilated area to prevent exposure to hazardous gases.
The module should not be exposed to direct sunlight or high temperatures.
The module may require calibration before use.
The module is sensitive to humidity and temperature, so it may require compensation in certain applications.
By following proper usage guidelines and precautions, the MQ-135 Gas Sensor Module can provide accurate and reliable gas detection capabilities for a wide range of applications.
MQ-135 Gas Sensor Module Documentation
Overview
The MQ-135 Gas Sensor Module is a versatile gas detection module capable of detecting various gases, including NH3, alcohol, benzene, smoke, and CO2. This module is widely used in IoT applications, such as air quality monitoring, industrial automation, and surveillance systems.
Pinout and Technical Specifications
Pinout:
+ VCC: Power supply (5V)
+ GND: Ground
+ OUT: Analog output signal
+ DOUT: Digital output signal (optional)
Technical Specifications:
+ Operating Voltage: 5V
+ Operating Temperature: -20C to 50C
+ Sensitivity: 1-1000 ppm (depending on the gas type)
+ Response Time: 10-30 seconds
Arduino Code Examples
### Example 1: Basic Analog Reading
In this example, we will read the analog output signal from the MQ-135 module and display the raw sensor value on the serial monitor.
```cpp
const int sensorPin = A0; // Connect the OUT pin to an analog input on your Arduino board
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.println(sensorValue);
delay(500);
}
```
### Example 2: Digital Output with Threshold Detection
In this example, we will use the digital output pin (DOUT) to detect when the gas concentration exceeds a certain threshold.
```cpp
const int doutPin = 2; // Connect the DOUT pin to a digital input on your Arduino board
void setup() {
pinMode(doutPin, INPUT);
}
void loop() {
int sensorState = digitalRead(doutPin);
if (sensorState == HIGH) {
Serial.println("Gas concentration exceeded threshold!");
} else {
Serial.println("Gas concentration is normal.");
}
delay(500);
}
```
### Example 3: airs quality monitoring using MQ-135 with ESP32
This example shows how to use the MQ-135 module with an ESP32 board to monitor air quality and send data to a remote server using Wi-Fi.
```cpp
#include <WiFi.h>
#include <HTTPClient.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
const int sensorPin = 32; // Connect the OUT pin to an analog input on your ESP32 board
WiFiClient espClient;
HTTPClient http;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
}
void loop() {
int sensorValue = analogRead(sensorPin);
float airQuality = map(sensorValue, 0, 4095, 0, 100); // Convert sensor value to air quality percentage
http.begin("http://your_remote_server.com/air_quality_data");
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
String postData = "air_quality=" + String(airQuality);
int httpResponseCode = http.POST(postData);
if (httpResponseCode > 0) {
Serial.println("Data sent successfully!");
} else {
Serial.println("Error sending data: " + http.getString());
}
http.end();
delay(60000); // Send data every 1 minute
}
```
In this example, you'll need to replace `"your_wifi_ssid"` and `"your_wifi_password"` with your Wi-Fi credentials, and `"http://your_remote_server.com/air_quality_data"` with the URL of your remote server.