AI Agent Air Quality Intelligence Platform
ESP32 + Air Quality Sensors + n8n Automation + AI Agent + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard
AI Agent Air Quality Intelligence Platform
ESP32 + AI Agent + n8n + Telegram Voice Alerts + Google Sheets + ThingSpeak
Project Overview
This project develops an AI-powered Air Quality Monitoring System using ESP32,
MQ135 Air Quality Sensor, DHT22, ThingSpeak Cloud, n8n Automation,
Telegram Voice Alerts, Google Sheets Logging, and Predictive Analytics.
- Real-Time Air Quality Monitoring
- Cloud Dashboard Visualization
- AI-Based Pollution Prediction
- Telegram Voice Notifications
- Google Sheets Data Logging
- Agentic Decision Making
System Architecture
MQ135 + DHT22
|
V
ESP32
|
V
WiFi Cloud
|
V
ThingSpeak
|
V
n8n
/ | \
Sheets Telegram AI
|
V
Voice Alerts
Components List
| Component |
Quantity |
| ESP32 | 1 |
| MQ135 Sensor | 1 |
| DHT22 Sensor | 1 |
| OLED Display | 1 |
| Breadboard | 1 |
| Jumper Wires | 20 |
| WiFi Router | 1 |
Circuit Connections
MQ135
VCC -> 5V
GND -> GND
AOUT -> GPIO34
DHT22
VCC -> 3.3V
GND -> GND
DATA -> GPIO4
OLED
VCC -> 3.3V
GND -> GND
SDA -> GPIO21
SCL -> GPIO22
Flowchart
Start
|
Initialize ESP32
|
Connect WiFi
|
Read Sensors
|
Calculate AQI
|
Upload to ThingSpeak
|
Trigger n8n
|
AI Analysis
|
High Pollution?
/ \
Yes No
| |
Send Alert
|
Voice Notification
|
Store in Google Sheets
|
Loop
AQI Classification
| AQI |
Status |
| 0-50 | Good |
| 51-100 | Moderate |
| 101-150 | Unhealthy for Sensitive Groups |
| 151-200 | Unhealthy |
| 201-300 | Very Unhealthy |
| 301+ | Hazardous |
ESP32 Sample Code
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid="YOUR_WIFI";
const char* password="YOUR_PASSWORD";
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
}
}
void loop()
{
int airValue=analogRead(34);
HTTPClient http;
String url=
"https://api.thingspeak.com/update?api_key=KEY"
"&field1="+String(airValue);
http.begin(url);
http.GET();
http.end();
delay(60000);
}
ThingSpeak Setup
- Create ThingSpeak Account
- Create New Channel
- Add AQI Field
- Copy Write API Key
- Paste into ESP32 Code
Telegram Bot Setup
- Open Telegram
- Search BotFather
- Create New Bot
- Copy Bot Token
- Get Chat ID
- Configure in n8n
n8n Workflow
Webhook
|
IF AQI > 150
|
OpenAI Analysis
|
Google Sheets
|
Telegram Alert
|
Text-to-Speech
|
Telegram Voice Message
AI Prediction Logic
Moving Average
Predicted AQI =
(AQI1+AQI2+AQI3+AQI4+AQI5)/5
Linear Regression
AQI = m*x + c
Advanced AI Models
- Random Forest
- XGBoost
- LSTM
- Time Series Forecasting
Voice Notification Message
Warning!
Air quality is unhealthy.
Current AQI: 185
Predicted AQI: 230
Avoid outdoor activities.
Google Sheets Columns
| Timestamp |
AQI |
Temperature |
Humidity |
Prediction |
Status |
Future Enhancements
- Machine Learning Forecasting
- Solar-Powered ESP32
- LoRaWAN Communication
- Mobile Application
- GIS Air Pollution Maps
- Industrial Deployment
- Smart City Integration
Estimated Cost
| Item |
Cost (₹) |
| ESP32 | 500 |
| MQ135 | 250 |
| DHT22 | 250 |
| OLED | 250 |
| Accessories | 200 |
| Total |
1450 |
For a professional final-year project, you could further split this into:
index.php (dashboard)
esp32_code.php
thingspeak_setup.php
telegram_setup.php
n8n_workflow.php
ai_prediction.php
deployment_guide.php
and add Bootstrap, charts, login authentication, live ThingSpeak data fetching, and downloadable PDF documentation.
Comments
Post a Comment