Table of Contents

Fire Detection and Suppression System

Introduction

The project consists of the development of an active protection mechatronic system based on the ATmega324PB microcontroller. The system utilizes a periodic scanning algorithm to monitor a 180° sector, processing analog signals from an optical sensor to identify the infrared signature of a flame.

General Description

The proposed system offers diverse applicability, primarily targeted at monitoring industrial environments with a high fire risk, where a rapid reaction is critical to limit damages before high-capacity sprinkler systems are activated. Due to the architecture of the ATmega324PB microcontroller, which provides dual USART, SPI, and TWI interfaces, the device can be easily integrated into redundant security systems, functioning as an independent node within a larger sensor network. From a technical and educational perspective, the project serves as an ideal case study for deepening the understanding of closed-loop control systems and managing hardware interrupts in real-time.

Hardware Design

1.Components

Component Type / Model Role
Microcontroller ATmega324PB Xplained Mini Central Processing Unit (CPU); manages ADC and PWM signals.
Flame Sensor Optical IR Sensor (Analog) Detects infrared radiation emitted by a flame.
Servo Motor 1 SG90 / MG90 Rotates the scanning assembly on the horizontal axis (180°).
Servo Motor 2 SG90 / MG90 Controls the vertical orientation of the extinguishing nozzle.
MiniWater Pump 3V - 6V DC Delivers the extinguishing agent toward the fire.
Relay Module 5V Optocoupled Switches the pump on/off and isolates the power circuit from the MCU.
Power Supply 5V / 2A (External) Provides the necessary current for the motors and the pump.
Connectivity Breadboard & Jumpers Used for making electrical connections between modules.

2.Electrical Schematic

Design Explanations:

3. Pin Configuration and Rationale

To ensure efficient operation and hardware-level precision, the following pins were selected:

4. Hardware Implementation and Testing

Physical Assembly

The images above show the final wiring on the breadboard, with the Buck Converter supplying power to the flame sensor and the Xplained Mini board.

Proof of Functionality: Flame Detection

To verify the system, the Flame Sensor and the integrated LED (PB5) were tested.

Image with the process

3. Software Implementation & Project Details

Current Status of the Software Implementation

The software implementation is fully functional and stable. The application is written in pure C for the ATmega328P microcontroller using PlatformIO. It successfully runs a real-time fire detection and suppression loop. The system concurrently monitors a flame sensor via both digital and analog channels, triggers an instantaneous acoustic alarm via hardware interrupts, controls a high-power water pump through an isolated relay module, and drives a 2-axis sweep mechanism using hardware PWM.

Motivation for Library Selection

In order to maximize execution speed, minimize memory footprint, and strictly adhere to low-level academic requirements, no external third-party libraries (such as Arduino.h or Servo.h) were used.

Element of Novelty

The primary novelty of this project lies in its Hybrid Dual-Channel Sensor Architecture. Instead of relying on a single data path, the flame sensor is evaluated simultaneously through two distinct subsystems:

1. A **Digital Safety Path** linked directly to a high-priority hardware interrupt line.
2. An **Analog Measurement Path** processed via the ADC.

This creates a fail-safe paradigm: the acoustic alarm bypasses any software delay or loop blockage to guarantee immediate warning, while the analog loop calculates the spatial presence of the threat to dynamically orchestrate physical suppression.

Justification of PM Laboratory Functionalities

The architecture incorporates core concepts from three foundational PM laboratories:

Project Skeleton & Functional Interaction

The software layout is divided into explicit hardware initialization blocks and a single, low-latency execution loop:

+-----------------------------------------------------------------------+
|                         Hardware Initialization                       |
|          (ADC_init()  |  PWM_init()  |  INT0_init()  |  sei())        |
+-----------------------------------------------------------------------+
                                    |
                                    v
+-----------------------------------------------------------------------+
|                           Main Loop [while(1)]                        |
+-----------------------------------------------------------------------+
| 1. Sample raw IR intensity from PC0 (ADC0).                           |
| 2. Evaluate threshold criteria (valoare_foc < 400).                   |
+-----------------------------------------------------------------------+
          |                                            |
 [Fire Detected: FALSE]                        [Fire Detected: TRUE]
          |                                            |
          v                                            v
+------------------------------------+      +------------------------------------+
| - Pull PD4 LOW (Activate Relay)    |      | - Pull PD4 HIGH (Deactivate Relay) |
| - Pull PD3 HIGH (Maintain Buzzer)  |      | - Pull PD3 LOW (Silence Buzzer)    |
| - Increment Servo position         |      | - Snap Servo back to Bisectore     |
|   (Sweep 0° to 120° dynamically)   |      |   (60° Rest Position)              |
+------------------------------------+      +------------------------------------+
          |                                            |
          +---------------------> [_delay_ms(20)] <----+
                                    |
                                    v
                             (Repeat Loop)

Asynchronous Interruption Event

Independent of the flow chart above, if pin PD2 drops to 0V at any microsecond, the CPU stops execution instantly:

ISR(INT0_vect) {
    stare_alerta = 1;
    PORTD |= (1 << PD3); // FORCES BUZZER ON IMMEDIATELY
}

Validation

System verification was carried out systematically:

Sensor Calibration

The infrared phototransistor module required hardware-software co-calibration to avoid false positives caused by laboratory overhead fluorescent lighting:

Optimizations

Video Demo & Explanations

Directly access the official project demonstration video hosted on the university's cloud platform here:
🎬 Click Here to Watch: Fire Suppression System Demo

Link to the project repository https://github.com/PatriciaBratu/Fire-Detection-and-Suppression-System.git