top of page

Arduino Based Fire alarm using dot matrix display

Updated: Dec 29, 2022



In this article we interface Flame Sensor with Arduino and learn all the steps to build Fire Alarm System by using Arduino, flame sensor and Dot matrix display. Flame sensor module has a photodiode to detect the light and an op-amp to control the sensitivity. It is used to detect fire and provide a HIGH signal upon the detection. Arduino reads the signal and provides alert by turning on the buzzer and Dot Matrix Fire Animation. The flame sensor used here is an IR based flame sensor. We have also used the same concept to detect fire in our Fire Fighting Robot, you can also check that our if you are interested.



Fire Alarm Systems are very common in commercial building and factories, these devices usual contain a cluster of sensors that constantly monitors for any flame, gas or fire in the building and triggers an alarm if it detects any of these. One of the simplest way to detect fire is by using an IR Flame sensor, these sensors have an IR photodiode which is sensitive to IR light. Now, in the event of a fire, the fire will not only produce heat but will also emit IR rays, yes every burning flame will emit some level of IR light, this light is not visible to human eyes but our flame sensor can detect it and alert a microcontroller like Arduino that a fire has been detected.


Circuit Diagram



Components Required

  • Arduino Uno (any Arduino board can be used)

  • IR Flame sensor module

  • Dot Matrix Display 8x8

  • Buzzer

  • Jumper wires

For Programmed ardunio Uno & Price:


Flame Sensor

The flame sensor detects and responses to the presence of fire or flame. The module is based on the IR receiver and basically detects the presence of flammable gases likes nitrogen, hydrogen, carbon mono oxide. The sensor can be directly interfaced with I/O pins of processors and controllers. It works in the wavelength of the range between 760 nm to 1100 nm in the light source.


Specification

  • Voltage supply: 3.3-5V

  • Signal detection capacity: adjustable

  • Wavelength range: 760 nm-1100 nm

  • Detection angle: up to 60 degree

  • Fast response time

  • Easy to use

Applications of flame sensors

  • Fire alarm

  • Firefighting robot

  • Home security system


Installing the Arduino_Library

Download Led Control library

Subscribe and Download code.

In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded.

After installing the required libraries, copy the following code to your Arduino IDE.


Subscribe and Download code.

Arduino Code


#include <LedControl.h>


const int numDevices = 1; // number of MAX7219s used in this case 2

const long scrollDelay = 120; // adjust scrolling speed

unsigned long bufferLong [14] = {0};

LedControl lc=LedControl(12,11,10,numDevices);//DATA | CLK | CS/LOAD | number of matrices

const unsigned char scrollText[] PROGMEM ={"NO FIRE"};


const int buzzerPin = 8;

const int flamePin = 9;

int Flame = HIGH;



int theHeightTarget[8];

int theHeightCurrent[8];


int fireHeight = 0;

int sparkX = 0;



void setup()

{

for (int x=0; x<numDevices; x++)

{

lc.shutdown(x,false); //The MAX72XX is in power-saving mode on startup

lc.setIntensity(x,8); // Set the brightness to default value

lc.clearDisplay(x); // and clear the display

}

pinMode(buzzerPin, OUTPUT);

pinMode(flamePin, INPUT);

Serial.begin(9600);

}

void loop(){


Flame = digitalRead(flamePin);

if (Flame== LOW)

{

Serial.println("Fire!!!");

digitalWrite(buzzerPin, HIGH);

lc.clearDisplay(0);

FireDisplay();

}

else

{

Serial.println("No worries");

digitalWrite(buzzerPin, LOW);

lc.clearDisplay(0);

scrollMessage(scrollText); //scrollFont();

}

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const unsigned char font5x7 [] PROGMEM = { //Numeric Font Matrix (Arranged as 7x font data + 1x kerning data)

B00000000, //Space (Char 0x20)

B00000000,

B00000000,

B00000000,

B00000000,

B00000000,

B00000000,

3,//cambias el tamaño del espacio entre letras

B01000000, //!

B01000000,

B01000000,

B01000000,

B01000000,

B00000000,

B01000000,

2,

B10100000, //"

B10100000,

B10100000,

B00000000,

B00000000,

B00000000,

B00000000,

4,

B01010000, //#

B01010000,

B11111000,

B01010000,

B11111000,

B01010000,

B01010000,

6,

B00100000, //$

B01111000,

B10100000,

B01110000,

B00101000,

B11110000,

B00100000,

6,

B11000000, //%

B11001000,

B00010000,

B00100000,

B01000000,

B10011000,

B00011000,

6,

B01100000, //&

B10010000,

B10100000,

B01000000,

B10101000,

B10010000,

B01101000,

6,

B11000000, //'

B01000000,

B10000000,

B00000000,

B00000000,

B00000000,

B00000000,

3,

B00100000, //(

B01000000,

B10000000,

B10000000,

B10000000,

B01000000,

B00100000,

4,

B10000000, //)

B01000000,

B00100000,

B00100000,

B00100000,

B01000000,

B10000000,

4,

B00000000, //*

B00100000,

B10101000,

B01110000,

B10101000,

B00100000,

B00000000,

6,

B00000000, //+

B00100000,

B00100000,

B11111000,

B00100000,

B00100000,

B00000000,

6,

B00000000, //,

B00000000,

B00000000,

B00000000,

B11000000,

B01000000,

B10000000,

3,

B00000000, //-

B00000000,

B11111000,

B00000000,

B00000000,

B00000000,

B00000000,

6,

B00000000, //.

B00000000,

B00000000,

B00000000,

B00000000,

B11000000,

B11000000,

3,

B00000000, ///

B00001000,

B00010000,

B00100000,

B01000000,

B10000000,

B00000000,

6,

B01110000, //0

B10001000,

B10011000,

B10101000,

B11001000,

B10001000,

B01110000,

6,

B01000000, //1

B11000000,

B01000000,

B01000000,

B01000000,

B01000000,

B11100000,

4,

B01110000, //2

B10001000,

B00001000,

B00010000,

B00100000,

B01000000,

B11111000,

6,

B11111000, //3

B00010000,

B00100000,

B00010000,

B00001000,

B10001000,

B01110000,

6,

B00010000, //4

B00110000,

B01010000,

B10010000,

B11111000,

B00010000,

B00010000,

6,

B11111000, //5

B10000000,

B11110000,

B00001000,

B00001000,

B10001000,

B01110000,

6,

B00110000, //6

B01000000,

B10000000,

B11110000,

B10001000,

B10001000,

B01110000,

6,

B11111000, //7

B10001000,

B00001000,

B00010000,

B00100000,

B00100000,

B00100000,

6,

B01110000, //8

B10001000,

B10001000,

B01110000,

B10001000,

B10001000,

B01110000,

6,

B01110000, //9

B10001000,

B10001000,

B01111000,

B00001000,

B00010000,

B01100000,

6,

B00000000, //:

B11000000,

B11000000,

B00000000,

B11000000,

B11000000,

B00000000,

3,

B00000000, //;

B11000000,

B11000000,

B00000000,

B11000000,

B01000000,

B10000000,

3,

B00010000, //<

B00100000,

B01000000,

B10000000,

B01000000,

B00100000,

B00010000,

5,

B00000000, //=

B00000000,

B11111000,

B00000000,

B11111000,

B00000000,

B00000000,

6,

B10000000, //>

B01000000,

B00100000,

B00010000,

B00100000,

B01000000,

B10000000,

5,

B01110000, //?

B10001000,

B00001000,

B00010000,

B00100000,

B00000000,

B00100000,

6,

B01110000, //@

B10001000,

B00001000,

B01101000,

B10101000,

B10101000,

B01110000,

6,

B01110000, //A

B10001000,

B10001000,

B10001000,

B11111000,

B10001000,

B10001000,

6,

B11110000, //B

B10001000,

B10001000,

B11110000,

B10001000,

B10001000,

B11110000,

6,

B01110000, //C

B10001000,

B10000000,

B10000000,

B10000000,

B10001000,

B01110000,

6,

B11100000, //D

B10010000,

B10001000,

B10001000,

B10001000,

B10010000,

B11100000,

6,

B11111000, //E

B10000000,

B10000000,

B11110000,

B10000000,

B10000000,

B11111000,

6,

B11111000, //F

B10000000,

B10000000,

B11110000,

B10000000,

B10000000,

B10000000,

6,

B01110000, //G

B10001000,

B10000000,

B10111000,

B10001000,

B10001000,

B01111000,

6,

B10001000, //H

B10001000,

B10001000,

B11111000,

B10001000,

B10001000,

B10001000,

6,

B11100000, //I

B01000000,

B01000000,

B01000000,

B01000000,

B01000000,

B11100000,

4,

B00111000, //J

B00010000,

B00010000,

B00010000,

B00010000,

B10010000,

B01100000,

6,

B10001000, //K

B10010000,

B10100000,

B11000000,

B10100000,

B10010000,

B10001000,

6,

B10000000, //L

B10000000,

B10000000,

B10000000,

B10000000,

B10000000,

B11111000,

6,

B10001000, //M

B11011000,

B10101000,

B10101000,

B10001000,

B10001000,

B10001000,

6,

B10001000, //N

B10001000,

B11001000,

B10101000,

B10011000,

B10001000,

B10001000,

6,

B01110000, //O

B10001000,

B10001000,

B10001000,

B10001000,

B10001000,

B01110000,

6,

B11110000, //P

B10001000,

B10001000,

B11110000,

B10000000,

B10000000,

B10000000,

6,

B01110000, //Q

B10001000,

B10001000,

B10001000,

B10101000,

B10010000,

B01101000,

6,

B11110000, //R

B10001000,

B10001000,

B11110000,

B10100000,

B10010000,

B10001000,

6,

B01111000, //S

B10000000,

B10000000,

B01110000,

B00001000,

B00001000,

B11110000,

6,

B11111000, //T

B00100000,

B00100000,

B00100000,

B00100000,

B00100000,

B00100000,

6,

B10001000, //U

B10001000,

B10001000,

B10001000,

B10001000,

B10001000,

B01110000,

6,

B10001000, //V

B10001000,

B10001000,

B10001000,

B10001000,

B01010000,

B00100000,

6,

B10001000, //W

B10001000,

B10001000,

B10101000,

B10101000,

B10101000,

B01010000,

6,

B10001000, //X

B10001000,

B01010000,

B00100000,

B01010000,

B10001000,

B10001000,

6,

B10001000, //Y

B10001000,

B10001000,

B01010000,

B00100000,

B00100000,

B00100000,

6,

B11111000, //Z

B00001000,

B00010000,

B00100000,

B01000000,

B10000000,

B11111000,

6,

B11100000, //[

B10000000,

B10000000,

B10000000,

B10000000,

B10000000,

B11100000,

4,

B00000000, //(Backward Slash)

B10000000,

B01000000,

B00100000,

B00010000,

B00001000,

B00000000,

6,

B11100000, //]

B00100000,

B00100000,

B00100000,

B00100000,

B00100000,

B11100000,

4,

B00100000, //^

B01010000,

B10001000,

B00000000,

B00000000,

B00000000,

B00000000,

6,

B00000000, //_

B00000000,

B00000000,

B00000000,

B00000000,

B00000000,

B11111000,

6,

B10000000, //`

B01000000,

B00100000,

B00000000,

B00000000,

B00000000,

B00000000,

4,

B00000000, //a

B00000000,

B01110000,

B00001000,

B01111000,

B10001000,

B01111000,

6,

B10000000, //b

B10000000,

B10110000,

B11001000,

B10001000,

B10001000,

B11110000,

6,

B00000000, //c

B00000000,

B01110000,

B10001000,

B10000000,

B10001000,

B01110000,

6,

B00001000, //d

B00001000,

B01101000,

B10011000,

B10001000,

B10001000,

B01111000,

6,

B00000000, //e

B00000000,

B01110000,

B10001000,

B11111000,

B10000000,

B01110000,

6,

B00110000, //f

B01001000,

B01000000,

B11100000,

B01000000,

B01000000,

B01000000,

6,

B00000000, //g

B01111000,

B10001000,

B10001000,

B01111000,

B00001000,

B01110000,

6,

B10000000, //h

B10000000,

B10110000,

B11001000,

B10001000,

B10001000,

B10001000,

6,

B01000000, //i

B00000000,

B11000000,

B01000000,

B01000000,

B01000000,

B11100000,

4,

B00010000, //j

B00000000,

B00110000,

B00010000,

B00010000,

B10010000,

B01100000,

5,

B10000000, //k

B10000000,

B10010000,

B10100000,

B11000000,

B10100000,

B10010000,

5,

B11000000, //l

B01000000,

B01000000,

B01000000,

B01000000,

B01000000,

B11100000,

4,

B00000000, //m

B00000000,

B11010000,

B10101000,

B10101000,

B10001000,

B10001000,

6,

B00000000, //n

B00000000,

B10110000,

B11001000,

B10001000,

B10001000,

B10001000,

6,

B00000000, //o

B00000000,

B01110000,

B10001000,

B10001000,

B10001000,

B01110000,

6,

B00000000, //p

B00000000,

B11110000,

B10001000,

B11110000,

B10000000,

B10000000,

6,

B00000000, //q

B00000000,

B01101000,

B10011000,

B01111000,

B00001000,

B00001000,

6,

B00000000, //r

B00000000,

B10110000,

B11001000,

B10000000,

B10000000,

B10000000,

6,

B00000000, //s

B00000000,

B01110000,

B10000000,

B01110000,

B00001000,

B11110000,

6,

B01000000, //t

B01000000,

B11100000,

B01000000,

B01000000,

B01001000,

B00110000,

6,

B00000000, //u

B00000000,

B10001000,

B10001000,

B10001000,

B10011000,

B01101000,

6,

B00000000, //v

B00000000,

B10001000,

B10001000,

B10001000,

B01010000,

B00100000,

6,

B00000000, //w

B00000000,

B10001000,

B10101000,

B10101000,

B10101000,

B01010000,

6,

B00000000, //x

B00000000,

B10001000,

B01010000,

B00100000,

B01010000,

B10001000,

6,

B00000000, //y

B00000000,

B10001000,

B10001000,

B01111000,

B00001000,

B01110000,

6,

B00000000, //z

B00000000,

B11111000,

B00010000,

B00100000,

B01000000,

B11111000,

6,

B00100000, //{

B01000000,

B01000000,

B10000000,

B01000000,

B01000000,

B00100000,

4,

B10000000, //|

B10000000,

B10000000,

B10000000,

B10000000,

B10000000,

B10000000,

2,

B10000000, //}

B01000000,

B01000000,

B00100000,

B01000000,

B01000000,

B10000000,

4,

B00000000, //~

B00000000,

B00000000,

B01101000,

B10010000,

B00000000,

B00000000,

6,

B01100000, // (Char 0x7F)

B10010000,

B10010000,

B01100000,

B00000000,

B00000000,

B00000000,

5,

B00000000, // smiley

B01100000,

B01100110,

B00000000,

B10000001,

B01100110,

B00011000,

5

};