As we all know buildings are a major part of the infrastructural development that is happening in this country. Any damage to them is damage to our economic development. There can be various reasons for this to happen. Some of them include natural calamities like earthquakes and hurricanes, lack of maintenance. One of the major reasons for damage is fire. Fires in buildings can be caused due to many things like electrical problems, gas leaks, etc.

Today with this project, we are going to try to tackle this problem. In this tutorial-based article, we are going to learn how to make a fire alarm system using Arduino Uno.

Hardware Required

Software Required

The working concept of the Flame Sensor

  • This IR Infrared Flame sensor module which is Arduino compatible can be used to detect flame or wavelength of the light source within 760nm-1100nm. It is also useful for lighter flame detection at a distance of 80 cm. Greater the flame, the farther the test distance. It has a detect angle of 60 degrees and is very sensitive to the flame spectrum. 

  • It produces the one-channel output signal at the D0 terminal for further processing like an alarm system or any switching system. The sensitivity is adjustable with the help of a blue potentiometer given on the board. 

12V Piezoelectric buzzer

  • This is a general-purpose continuous Piezo Electric Buzzer Alarm. It works from 3 to 12V.
  • It has two mounting holes and can be easily mounted to a flat surface. 

Circuit Diagram

  • The wiring for this project is not so complex.

  • The flame sensor has 3 pins: VCC, GND, DO. These 3 pins are connected to 5V, GND and Digital pin 2 on the Arduino board. 

  • The piezoelectric buzzer has been connected to the Digital pin 5 and GND. 

The working concept of the flame detection system


  • The flame sensor is a photosensor. So as soon as the flame is lit and within the range of the sensor, the sensor will send the signal back to the Arduino board.
  • Upon receiving the signal from the flame sensor, the Arduino board will send the signal back to the buzzer commanding it to ring. 
  • As soon as the buzzer receives the signal, it will start ringing completing the fire detection and alarm cycle. 

Arduino code

  • The Arduino code for the fire alarm system is shown below. Paste it in your Arduino IDE.
const int buzzerPin = 5;
const int flamePin = 2;
int Flame = HIGH;

void setup() 
  pinMode(buzzerPin, OUTPUT);
  pinMode(flamePin, INPUT);

void loop() 
  Flame = digitalRead(flamePin);
  if (Flame== LOW)
    Serial.println("Fire is Detected");
    digitalWrite(buzzerPin, HIGH);
    Serial.println("No Fire is Detected");
    digitalWrite(buzzerPin, LOW);

Now your fire alarm system is ready to go!