This is an old revision of the document!
This project is an air quality monitoring system built using an ESP32 microcontroller, an MQ-135 gas sensor, and a buzzer for audible alerts. The main goal of the system is to continuously monitor the air quality, detect harmful gas levels (such as NH3, NOx, benzene, CO2, and smoke), and:
The following schematic illustrates the core components and their connections in the air quality monitoring system:
This schematic includes:
ESP32 Development Board
Description: The ESP32 is a low-cost, low-power microcontroller with integrated Wi-Fi and Bluetooth. It is ideal for IoT projects due to its wireless capabilities and sufficient computing power.
Key Features:
Use in Project:
Important Pins Used:
MQ-135 Gas Sensor
Description: The MQ-135 is a chemical gas sensor capable of detecting a wide range of gases, including ammonia, nitrogen oxides, benzene, smoke, and carbon dioxide. It is commonly used in air quality monitoring.
Key Features:
Use in Project: Provides an analog voltage proportional to air pollution levels. Connected to the ESP32’s analog input (GPIO34) through a voltage divider or level shifter, since it outputs 5V and ESP32 is 3.3V-tolerant.
Pinout:
Pin | Function | Description |
---|---|---|
VCC | Power Input | Connect to 5V |
GND | Ground | Connect to GND |
AOUT | Analog Output | Analog signal to ESP32 (via voltage divider) |
DOUT | Digital Output | Not used in this project |
Active Buzzer Module
Description: An active buzzer is a simple sound-emitting component that generates a tone when voltage is applied. Unlike passive buzzers, it does not require PWM control — just a HIGH/LOW signal.
Key Features:
Use in Project:
Pinout:
Pin | Function | Description |
---|---|---|
+ | VCC | Connect to 3.3V or 5V |
- | GND | Connect to Ground |
SIG | Signal Input | Connect to ESP32 digital pin (e.g., GPIO25) |
Voltage Divider Resistors
Description:
Use in Project:
Breadboard and Jumper Wires
Description:
Use in Project:
Power Supply
Description:
Use in Project:
The Air Sense Visualizer is a web application created to monitor and display air quality data in real time. It retrieves sensor readings—such as PPM values from an air quality sensor—and presents them through a clean, user-friendly interface. The application is designed for development and educational use, offering a simple way to test, view, and analyze environmental data either locally or through connection with cloud-based platforms. Its structure is modular and flexible, making it easy to adapt to different use cases and hardware setups.
#include <WiFi.h>
#include <Firebase_ESP_Client.h>
#include “addons/TokenHelper.h”
#include “addons/RTDBHelper.h”
#define WIFI_SSID “WI-FI HOME”
#define WIFI_PASSWORD “TREB-15-HOME”
#define API_KEY “AIzaSyD…”
#define DATABASE_URL “https://air-qulaity-default-rtdb.europe-west1…”
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
void setup() {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(300);
}
config.api_key = API_KEY;
config.database_url = DATABASE_URL;
if (Firebase.signUp(&config, &auth, ””, ””)) {
Serial.println(“Firebase signUp succeeded”);
}
config.token_status_callback = tokenStatusCallback;
Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);
}