SVSEmbedded will do new innovative thoughts. Any latest idea will comes we will take that idea & implement that idea in a few days. We always encourage the students to take good ideas/projects. SVSEmbedded providing latest innovative electronics projects to B.E/B.Tech/M.E/M.Tech students. We developed thousands of projects for engineering student to develop their skills in electrical and electronics
Thursday, 28 May 2026
AI-Based Fire and Smoke Detection with Real-Time Alerts
AI-Based Fire and Smoke Detection with Real-Time Alerts
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Cloud Dashboard
AI-Based Fire and Smoke Detection with Real-Time Alerts
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Cloud Dashboard
1. Project Overview
This project is an intelligent IoT-based fire and smoke monitoring system using an ESP32 microcontroller, environmental sensors, cloud platforms, and AI-powered automation workflows.
The system continuously monitors:
Smoke concentration
Temperature
Flame detection
Air quality
When abnormal conditions are detected, the ESP32 sends data to:
Telegram for instant alerts
Google Sheets for logging
ThingSpeak dashboard for cloud visualization
n8n automation server for AI-based workflows and voice notifications
The system can:
Detect fire/smoke in real-time
Send AI-generated voice alerts
Store sensor history
Predict power consumption trends
Trigger smart automations
Enable future AI-based emergency response systems
2. Key Features
Core Features
✅ Real-time fire detection
✅ Smoke monitoring
✅ ESP32 WiFi connectivity
✅ Telegram instant alerts
✅ AI voice notifications
✅ Google Sheets logging
✅ ThingSpeak cloud dashboard
✅ n8n workflow automation
✅ Agentic IoT automation
✅ AI power consumption prediction
✅ Remote monitoring dashboard
3. System Architecture
┌──────────────────┐
│ Smoke Sensor MQ2 │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Flame Sensor │
└────────┬─────────┘
│
┌────────▼─────────┐
│ DHT11/DHT22 │
│ Temp Sensor │
└────────┬─────────┘
│
┌────────▼─────────┐
│ ESP32 Controller │
└────────┬─────────┘
│ WiFi
┌────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
Telegram Bot ThingSpeak n8n Automation
│ │ │
▼ ▼ ▼
Voice Alerts Cloud Dashboard Google Sheets
4. Components List
Component Quantity Purpose
ESP32 Dev Board 1 Main controller
MQ-2 Smoke Sensor 1 Smoke detection
Flame Sensor Module 1 Fire detection
DHT22 Sensor 1 Temperature monitoring
Buzzer Module 1 Local alarm
LED Indicator 2 Status indication
Breadboard 1 Circuit assembly
Jumper Wires Multiple Connections
5V Power Supply 1 Power source
WiFi Router 1 Internet connection
5. Circuit Schematic Diagram
ESP32 CONNECTIONS
MQ2 Sensor
VCC → 3.3V
GND → GND
AOUT → GPIO34
Flame Sensor
VCC → 3.3V
GND → GND
DOUT → GPIO27
DHT22
VCC → 3.3V
GND → GND
DATA → GPIO4
Buzzer
+ → GPIO26
- → GND
Red LED
+ → GPIO25
- → GND
6. Working Principle
The ESP32 continuously reads data from:
MQ2 smoke sensor
Flame sensor
DHT22 temperature sensor
If:
Smoke exceeds threshold
Flame is detected
Temperature becomes dangerous
Then:
Local buzzer activates
Telegram alert is sent
Voice notification generated
Data uploaded to ThingSpeak
Event logged in Google Sheets
n8n AI workflow processes event
7. Flowchart
START
│
▼
Initialize ESP32
│
▼
Connect WiFi
│
▼
Read Sensor Data
│
▼
Smoke/Fire Detected?
┌────┴────┐
YES NO
│ │
▼ ▼
Activate Alarm Continue Monitoring
│
▼
Send Telegram Alert
│
▼
Trigger Voice Alert
│
▼
Upload to ThingSpeak
│
▼
Store in Google Sheets
│
▼
AI Analysis via n8n
│
▼
LOOP
8. ESP32 Source Code (Arduino IDE)
#include
#include
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT22
#define MQ2_PIN 34
#define FLAME_PIN 27
#define BUZZER 26
#define LED 25
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
String botToken = "YOUR_TELEGRAM_BOT_TOKEN";
String chatID = "YOUR_CHAT_ID";
String thingSpeakApi = "YOUR_THINGSPEAK_API_KEY";
void setup() {
Serial.begin(115200);
pinMode(FLAME_PIN, INPUT);
pinMode(BUZZER, OUTPUT);
pinMode(LED, OUTPUT);
dht.begin();
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting...");
}
Serial.println("WiFi Connected");
}
void sendTelegram(String message) {
HTTPClient http;
String url = "https://api.telegram.org/bot" + botToken +
"/sendMessage?chat_id=" + chatID +
"&text=" + message;
http.begin(url);
http.GET();
http.end();
}
void sendThingSpeak(float temp, int smoke) {
HTTPClient http;
String url = "http://api.thingspeak.com/update?api_key=" +
thingSpeakApi +
"&field1=" + String(temp) +
"&field2=" + String(smoke);
http.begin(url);
http.GET();
http.end();
}
void loop() {
float temperature = dht.readTemperature();
int smoke = analogRead(MQ2_PIN);
int flame = digitalRead(FLAME_PIN);
Serial.println(smoke);
if (smoke > 2500 || flame == 0 || temperature > 50) {
digitalWrite(BUZZER, HIGH);
digitalWrite(LED, HIGH);
sendTelegram("🔥 FIRE ALERT DETECTED!");
sendThingSpeak(temperature, smoke);
delay(5000);
}
else {
digitalWrite(BUZZER, LOW);
digitalWrite(LED, LOW);
}
delay(2000);
}
9. n8n Automation Workflow
Workflow Features
The n8n automation:
Receives webhook data
Checks fire thresholds
Generates AI response
Sends Telegram message
Creates voice alert
Logs to Google Sheets
Updates dashboards
n8n Workflow Steps
Webhook Trigger
Parse Sensor Data
AI Decision Node
Telegram Notification
Text-to-Speech Node
Google Sheets Append
Emergency Alert Routing
Sample n8n Workflow JSON
{
"nodes": [
{
"name": "Webhook",
"type": "n8n-nodes-base.webhook"
},
{
"name": "Telegram",
"type": "n8n-nodes-base.telegram"
},
{
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets"
}
]
}
10. Telegram Bot Setup
Step 1: Create Bot
Open Telegram and search:
Telegram
Search for:
BotFather
Commands:
/newbot
Copy:
Bot Token
Step 2: Get Chat ID
Send message to your bot.
Open:
https://api.telegram.org/bot/getUpdates
Copy:
Chat ID
11. Google Sheets Integration
Requirements
Google Cloud Project
Google Sheets API
Service Account
Steps
Create Google Sheet
Enable Sheets API
Generate credentials JSON
Connect Google Sheets node in n8n
Map:
Time
Smoke Level
Temperature
Alert Status
12. ThingSpeak Cloud Dashboard Setup
Using:
ThingSpeak Official Platform
Steps
Create account
Create channel
Add fields:
Temperature
Smoke
Fire Status
Copy Write API Key
Paste into ESP32 code
13. AI Power Consumption Prediction Logic
The AI agent estimates power usage based on:
Sensor sampling rate
WiFi transmission frequency
Alarm activation duration
CPU active time
Formula
P=V×I
Where:
P = Power
V = Voltage
I = Current
Prediction Model
predicted_power =
(sensor_reads * 0.02) +
(wifi_transmissions * 0.15) +
(alarm_usage * 0.4)
AI can optimize:
Sleep intervals
Upload timing
Sensor polling frequency
14. Voice Notification Automation
Workflow
Fire Detected
↓
n8n Receives Data
↓
AI Generates Alert Text
↓
Text-to-Speech Conversion
↓
Telegram Voice Message
↓
Emergency Notification
Example Voice Alert
“Warning! Fire and smoke detected in the monitored area. Please take immediate action.”
15. Cloud Dashboard Features
Dashboard Displays
Real-time temperature
Smoke graph
Alert history
AI prediction status
Device online/offline
Notification logs
16. Future Enhancements
AI Enhancements
Machine learning fire prediction
Computer vision smoke detection
AI camera integration
Edge AI analytics
Hardware Enhancements
GSM backup alerts
Solar-powered ESP32
Battery backup
Multi-room deployment
Software Enhancements
Mobile app
MQTT architecture
Firebase integration
Voice assistant support
17. Deployment Guide
Suitable Locations
Smart homes
Industries
Warehouses
Laboratories
Server rooms
Smart buildings
18. Advantages
✅ Low cost
✅ Real-time monitoring
✅ AI-enabled automation
✅ Cloud accessible
✅ Expandable architecture
✅ Remote alerts
✅ Energy efficient
19. Applications
Smart Home Safety
Industrial Fire Detection
Warehouse Monitoring
Forest Fire Early Warning
Smart Cities
Data Center Protection
20. Conclusion
This project combines:
IoT
ESP32
AI automation
Cloud monitoring
Real-time emergency alerts
to create an intelligent fire and smoke detection ecosystem capable of proactive safety monitoring and smart emergency response.
The integration of:
ESP32
n8n workflows
Telegram voice alerts
Google Sheets
ThingSpeak
AI-based automation
Subscribe to:
Post Comments (Atom)
AI-Powered Home Automation Using Voice and Face Recognition
🏠 AI-Powered Home Automation Using Voice & Face Recognition (ESP32 + Agentic IoT + n8n + Telegram + Google Sheets + ThingSpeak) 🏠 AI-...
-
www.svsembedded.com SVSEMBEDDED svsembedded@gmail.com , CONTACT: 9491535690, 7842358459 ------------------------------------------...
-
Watch Video Demonstration Carefully Till End -- Temperature and Humidity Controller For Incubator Temperature and Humidity Controller For ...
-
Electronic KITS: DTDC Courier Proof Of Delivery Receipts - 2024 - 2023 - 2022 - 2021 - 2020 - 2019 - 2018 - 2017 - 2016...


No comments:
Post a Comment