"An IoT-Based Smoke Detection and Fire Alert System using MQ-2 Sensor and NodeMCU for real-time fire safety monitoring and emergency alert generation."
- Project Introduction
- Problem Statement
- Objective
- Literature Survey Summary
- Existing System
- Proposed System
- System Architecture
- Block Diagram
- Circuit Diagram
- Components Required
- Hardware Description
- Software Requirements
- Working Principle
- Flowchart
- Arduino / NodeMCU Code Explanation
- Results and Discussion
- Advantages
- Applications
- Future Scope
- Conclusion
- References
- Team Members
- Project Guide
- Acknowledgements
A smoke detector is an electronic safety device designed to sense smoke particles as an early indicator of fire. Commercial security networks link individual detectors to a central panel, whereas household systems typically emit a loud audible and visual alarm from the device itself. This ECE project implements an IoT-Based Smoke Detector System that monitors ambient air quality, provides immediate acoustic and visual alerts, and displays real-time gas levels locally on a 16x2 Liquid Crystal Display.
Traditional household smoke detectors operate as isolated systems. During a fire event:
- standalone alarms can only alert individuals within earshot.
- they provide no quantitative data representing the intensity or source of the gas concentration.
- they are prone to false alarms caused by steam or normal kitchen activities, which cannot be calibrated or adjusted easily without software-based threshold controls.
The primary objectives of this project are:
- Design and assemble a reliable, cost-effective smoke detection node using the NodeMCU ESP8266 microcontroller.
- Integrate an MQ-2 gas sensor to measure ambient smoke concentration levels.
- Configure a 16x2 LCD display (via I2C interface) to show numeric gas concentration thresholds locally.
- Establish visual (LEDs) and acoustic (Active Buzzer) alarm triggers that scale according to danger limits.
- Create a prototype that can be scaled for IoT smart-home integration.
A review of current safety designs highlights significant advancements:
- Optical (Photoelectric) and Physical (Ionization) sensing are the standard approaches. Ionization detectors excel at spotting fast-flaming fires but suffer from false alarms due to kitchen smoke. Photoelectric sensors react faster to slow, smoldering fires.
- Modern configurations emphasize multi-criteria systems that combine heat, smoke, and CO detection to improve reliability.
- The integration of microcontrollers and wireless communication protocols (Wi-Fi, ZigBee) represents a major shift toward automated smart building integration.
Traditional systems typically fall into three categories:
- Ionization Smoke Detectors: Use a small radioactive source (Americium-241) to ionize air. They detect fast fires but contain hazardous materials and are sensitive to humidity.
- Standard Photoelectric Alarms: Rely on a light source and photosensor. Less effective in fast-flaming scenarios.
- Standalone Non-Programmable Detectors: Simple battery-operated units. Lacks remote alerts, logging capability, or visual displays.
The proposed system builds a micro-controller-based programmable safety node. It reads the analog output of the MQ-2 sensor (which changes in proportion to gas levels) and performs dynamic comparisons in code:
- Normal Air (<300): Green LED ON, Red LED OFF, Buzzer OFF, LCD:
Environment Safe. - Smoke Detected (300 to 750): Green LED OFF, Red LED ON, Buzzer ON (pulsed), LCD:
Smoke Detected!. - Fire Hazard (>750): Green LED OFF, Red LED ON, Buzzer ON (continuous), LCD:
WARNING! FIRE.
The architecture is structured into four distinct layers:
- Sensing Layer: Captures gas/smoke parameters using the MQ-2 metal-oxide semiconductor sensor.
- Data & Communication Layer: Converts the analog voltage into a digital scale (10-bit resolution) and transmits command signals over the I2C interface bus.
- Processing & Logic Layer: Evaluates threshold logic in the firmware of the NodeMCU ESP8266.
- Application & Alert Layer: Drives alarms (Buzzer, Red LED) and updates the LCD display.
The system components and data flow pathways are organized as shown below:
The schematic pin mapping and connections are illustrated below:
- NodeMCU ESP8266 (or Arduino Uno)
- MQ-2 Gas Sensor Module
- 16x2 I2C LCD Display Module
- Active Piezoelectric Buzzer
- 5mm Green LED & 5mm Red LED
- 220Ω Resistors (for current-limiting)
- Solderless Breadboard
- Jumper Wires (Male-to-Male and Female-to-Male)
- Arduino IDE (v2.x or later)
- LiquidCrystal_I2C Library
- Wire Library (I2C interface)
An open-source electronics platform based on the ESP8266 Wi-Fi chip. It features a 10-bit analog-to-digital converter (ADC pin A0), digital GPIOs, and built-in Wi-Fi, making it the perfect platform for IoT sensor nodes.
A metal-oxide semiconductor (MOS) sensor. It utilizes a heating coil (Nickel-Chromium) and a sensing surface (Tin Dioxide,
- Development Tool: Arduino IDE.
- Microcontroller Core: ESP8266 Board Core (v3.x or later).
- Libraries:
Wire.h(Built-in I2C protocol library).LiquidCrystal_I2C.h(Character LCD driver).
The system's operation is based on the resistance change of the MQ-2 sensor:
- When tin dioxide (
$SnO_2$ ) is heated in clean air, oxygen is adsorbed on its surface, creating a potential barrier that restricts electron flow. - When smoke or reducing gases are introduced, they react with the adsorbed oxygen, releasing electrons back into the tin dioxide layer.
- This reaction increases the electrical conductivity, lowering the sensor's resistance and raising the output voltage on pin A0.
- The NodeMCU reads this voltage, calculates the PPM equivalent, and triggers the alarm states when the value exceeds the 300 PPM limit.
The firmware program flow logic follows the sequence shown below:
The complete code resides in CODE/Smoke_Detector.ino. Key logical segments include:
- Pin Allocations: Pin
A0is mapped for sensor input. Pin8is configured for the Buzzer, and pins6and7drive the Green and Red LEDs. - LCD Driver Setup:
Initializes the LCD over address
LiquidCrystal_I2C lcd(0x27, 16, 2);
0x27using standard SDA/SCL lines. - Detection Loop:
Reads the analog sensor output. A comparison logic is used to branch execution:
int gasLevel = analogRead(mq2Pin);- If
gasLevel > 750: LCD updates toWARNING! FIREand continuous alarms are triggered. - If
300 < gasLevel <= 750: LCD updates toSmoke Detected!and pulsed alarms are triggered. - If
gasLevel <= 300: Green LED remains ON, buzzer is muted, and LCD showsEnvironment Safe.
- If
Calibration trials under laboratory conditions successfully demonstrated the three operational alert states:
- Sensor Time-Series Response: Shows the sensor signal rise, peak alarm trigger, and recovery phase when smoke is cleared:

- Calibration Data: For detailed logs, response curves, and accuracy graphs, check RESULTS.md.
- Fast Response: Triggers alarms in under 1.5 seconds when smoke is detected within 15 cm.
- Visual Clarity: Local LCD outputs eliminate guesswork, showing precise sensor levels.
- Dual-State Warnings: Differentiates between light smoke warning levels and critical fire emergencies.
- Low Power Consumption: Operates on a standard 5V USB interface.
- Residential Safety: Kitchens, fireplaces, and boiler rooms.
- Industrial Facilities: Chemical storage depots and manufacturing plants.
- IT Infrastructure: Server rooms, server racks, and network distribution closets.
- IoT Cloud Integration: Push sensor readings to cloud dashboards (Blynk or ThingSpeak) for remote tracking.
- GSM Cellular Backup: Integrate a SIM800L module to send SMS notifications if the local Wi-Fi goes down.
- Environmental Sensor Fusion: Integrate a DHT11 sensor to monitor temperature and humidity spikes to reduce false alarms.
This IoT-Based Smoke Detector System represents a reliable and cost-effective approach to fire safety. Using a NodeMCU microcontroller and an MQ-2 sensor, the system provides real-time local visual readouts and multi-level alarms, making it an excellent baseline for smart-home integration.
- M. Brain, How Smoke Detectors Work, HowStuffWorks.
- National Fire Protection Association (NFPA) 72: National Fire Alarm and Signaling Code.
- Underwriters Laboratories (UL) Standard 217: Single and Multiple Station Smoke Alarms.
- Ms. M. Archana, Design of Embedded Systems for Fire Detection, Dept. of ECE, Dr. N.G.P. Institute of Technology, 2024.
- Akash V (710723106007) - 23ec007@drngpit.ac.in
- Arun Pranav S K (710723106012) - 23ec012@drngpit.ac.in
- Devanand N (710723106021) - 23ec021@drngpit.ac.in
- Manoj S (710723106058) - 23ec058@drngpit.ac.in
- Ms. M. Archana M.E. Assistant Professor (SS), Department of Electronics and Communication Engineering, Dr. N.G.P. Institute of Technology, Coimbatore.
We express our sincere gratitude to:
- Dr. Nalla G. Palaniswami (Chairman) and Dr. Thavamani D. Palaniswami (Secretary) for providing excellent facilities.
- Dr. S. U. Prabha (Principal) for her academic guidance.
- Dr. P. Sampath (Head of the Department, ECE) and Ms. T. Bhuvaneswari (Project Coordinator) for their administrative and technical support.
- All teaching and non-teaching staff members of the Department of Electronics and Communication Engineering for their continuous assistance.







