Introduction
Fire accidents can cause severe damage to life and property if not detected at an early stage. A Smart Fire Detection System uses sensors and IoT technology to detect fire hazards such as smoke, flame, and abnormal temperature and instantly sends alerts to concerned authorities.
This system ensures early fire detection, quick response, and enhanced safety for homes, industries, and public places.
Objective of the Project
- To detect fire and smoke at an early stage
- To monitor temperature rise
- To send instant alerts using IoT
- To reduce fire-related accidents
Working Principle
- Flame sensor detects fire
- Smoke/gas sensor detects smoke
- Temperature sensor monitors abnormal heat
- Microcontroller processes sensor data
- Alert is generated through buzzer and cloud notification
Components Required
- ESP32 / Arduino Uno
- Flame Sensor
- Smoke/Gas Sensor (MQ-2)
- Temperature Sensor (DHT11 / LM35)
- Buzzer
- Relay Module (Fire extinguisher activation – optional)
- Wi-Fi Module (ESP8266 if Arduino used)
- Power Supply
Block Diagram
Flame + Smoke + Temperature Sensors
↓
Microcontroller
↓
Buzzer + Relay
↓
Wi-Fi
↓
Cloud Platform
Circuit Connections (ESP32 Example)
Flame Sensor
DO → GPIO27
VCC → 5V
GND → GND
MQ-2 Gas Sensor
AO → GPIO34
VCC → 5V
GND → GND
DHT11 Sensor
DATA → GPIO4
VCC → 5V
GND → GND
Buzzer
+ → GPIO26
- → GND
IoT Arduino Code (Smart Fire Detection System)
#include <WiFi.h>
#include "ThingSpeak.h"
#include "DHT.h"
#define flamePin 27
#define gasPin 34
#define buzzer 26
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
WiFiClient client;
const char* ssid = "Your_WiFi";
const char* password = "Your_Password";
unsigned long channelID = 123456;
const char* writeAPIKey = "YOUR_API_KEY";
void setup() {
Serial.begin(9600);
pinMode(flamePin, INPUT);
pinMode(buzzer, OUTPUT);
dht.begin();
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
ThingSpeak.begin(client);
}
void loop() {
int flame = digitalRead(flamePin);
int gasValue = analogRead(gasPin);
float temp = dht.readTemperature();
Serial.print("Flame: ");
Serial.println(flame);
Serial.print("Gas: ");
Serial.println(gasValue);
Serial.print("Temperature: ");
Serial.println(temp);
if (flame == LOW || gasValue > 500 || temp > 50) {
digitalWrite(buzzer, HIGH);
} else {
digitalWrite(buzzer, LOW);
}
ThingSpeak.setField(1, flame);
ThingSpeak.setField(2, gasValue);
ThingSpeak.setField(3, temp);
ThingSpeak.writeFields(channelID, writeAPIKey);
delay(15000);
}
Code Explanation
- Sensors continuously monitor fire indicators
- ESP32 processes data and triggers alarms
- Alerts are uploaded to cloud in real time
- System works automatically without human intervention
Advantages
- Early fire detection
- Real-time alerts
- Reduces damage and risk
- Low-cost and reliable
Applications
- Homes and apartments
- Industrial plants
- Warehouses
- Smart buildings
Future Enhancements
- Automatic fire extinguisher activation
- Mobile app notifications
- AI-based fire prediction
- Integration with smart city systems
Conclusion
The Smart Fire Detection System is an essential safety solution that combines IoT, sensors, and automation to protect lives and property. Early detection and instant alerts ensure faster response and minimize damage.
