Home > Projects > Sensor – Transducer – Detector Projects > Image Processing Based Fire Detection & Extinguisher System Using Arduino

Image Processing Based Fire Detection & Extinguisher System Using Arduino

Summary of Image Processing Based Fire Detection & Extinguisher System Using Arduino


This article describes an Arduino-based fire detection and extinguisher system utilizing OpenCV and Python for image processing. The system identifies fire via a trained Haar Cascade Classifier, triggering a buzzer, LED alerts, and a mini submersible pump to suppress the fire upon detection.

Parts used in the Fire Detection and Extinguisher System:

  • Arduino UNO
  • 16×2 LCD
  • 5volt buzzer
  • LEDs
  • 5volt relay
  • Bc547 transistor
  • Resistors (470r, 1k, 220r, 10k preset)
  • Lm7805 voltage regulator
  • Capacitors (1000uf/25volt, 470uf/16 volt)
  • Diode 1N4007
  • Webcam or laptop camera
  • Arduino cable
  • Mini submersible pump

prototype

This is an image processing based fire detection and extinguisher system using Arduino. It is basically the system is divided into two parts:

  1. Fire detection

2. Fire alert and extinguisher

In the first part, fire detects using image processing. Here in this project I’m using open CV and python for fire detection. I created a HAAR Cascade Classifier for fire detection using Open CV. It has trainer and detector for train our own cascade classifier, HAAR Cascade is used to detect object for which it has been trained. Lots of positive and negative image samples are need to train classifier. Training of cascade classifier is complex and time consuming process, so to make it easy I find a cascade training software on web name is “cascade trainer GUI”.

For training cascade classifier, download and install this trainer EXE from the above link. Create a folder with name fire (you can create folder with any name as my target object is fire, so I created folder “fire”) now create two folders inside of fire folder with name “n” and “p”, n folder is for negative image samples and p for positive image samples. Positive image contains the object which we want to detect, in our case we want to detect fire so collect the image samples which contains fire and put them inside of p folder. For negative samples collect large numbers of images which do not contains fire even partially. Now follow the steps on above page for making your cascade classifier file, or you can download pre-made cascade classifier for fire detection and source code from the link (source code)
Comes toward the python, to run this project you need to install following modules and libraries to your python setup.

• Numpy
• Scipy
• Pyserial (click here to download numpy, scipy and pyserial)

After installation of all modules open python code with name fire detection,arduino.py if you get some errors while running, don’t get panic, we just done first part.

Let’s move towards hardware, here I’m using Arduino UNO as controller since I need to control pump, buzzer and red LED’s.

Components used:

  • Arduino uno
  • 16×2 LCD
  • 5volt buzzer
  • LED’s
  • 5volt relay
  • Bc547 transistor
  • Resistors 470r, 1k, 220r, 10k preset
  • Lm7805
  • Capacitors 1000uf/25volt, 470uf/16 volt
  • Diode 1N4007
  • Webcam (optional, you can use your laptop camera also)
  • Arduino cable
  • Mini submersible pump

Connect all the components as per the circuit diagram below, connect arduino to your computer using USB cable and find out the com port on which Arduino is connected, now open the Arduino code, select com port and correct board from tool menu of Arduino and upload the code.

Open the python code with name fire detection, arduino.py check com port write in code is correct or not in line 13, if not change it with your Arduino com port number. Click on run tab then click run module or press F5.

python code

If all connections are ok, camera preview will show on screen. Now show fire to it, fire get detected and pump start as well as buzzer starts beep sound.

camera preview

Video:

Download Links

Source code: click here

Python modules: click here

Cascade trainer GUI: click here

Read More Detail:Image Processing Based Fire Detection & Extinguisher System Using Arduino

Quick Solutions to Questions related to Fire Detection and Extinguisher System:

  • How is fire detected in this project?
    Fire is detected using image processing with OpenCV and Python by creating a HAAR Cascade Classifier.
  • What software is used to train the cascade classifier?
    The article suggests using "cascade trainer GUI" found on the web to train the classifier.
  • Which Python modules are required to run the code?
    You need to install Numpy, Scipy, and Pyserial libraries in your Python setup.
  • Can I use my laptop camera instead of a webcam?
    Yes, the article states that you can use your laptop camera as an optional alternative to a webcam.
  • What happens when fire is successfully detected?
    When fire is detected, the pump starts working and the buzzer begins to beep while LEDs activate.
  • How do I ensure the Arduino communicates correctly with the Python script?
    You must check line 13 of the python code to ensure the COM port matches the one where the Arduino is connected.
  • What folders are needed to train the cascade classifier?
    You need to create a main folder containing two subfolders named n for negative samples and p for positive samples.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top