How To Create a Fire Detection Alarm System Using Arduino UNO R3

Both businesses and homes can lose many important things in fires. The Internet of Things is one of today's growing technologies, and in this scenario I am attempting to solve this problem using IoT technology. 
Flame sensors are used to detect a fire by using infrared technology.  Infrared bulbs are placed at the front of a flame sensor. This sensor comes in three types:
  1. Analog Out pin [AO]
  2. Digital Out pin [D0]
  3. Both Analog [AO] & Digital out pins [DO]
By reading this article, you will learn how to create a fire alarm system using Arduino UNO R3 

Prerequisites for creating this system

Hardware Requirement
Hardware  Qty
 Arduino UNO R3  1
 Flame Sensor  1
Piezo buzzer   1
LED Bulb   1
 220-ohm Resistor  1
 Jumper Wires
Software Requirement
Arduino IDE (Integrated Development Environment)
It has three stages for developing this fire detection alarm system.
  1. Connect hardware
  2. Write & upload code to Arduino UNO
  3. Test our developed system

Stage 1 [Connect Hardware]

First, we are connecting a flame sensor, Piezo buzzer and Led bulb to Arduino. Refer to the below diagram for making this connection.
How To Create A Fire Detection AlarmingSystem Using Arduino UNO R3
Pin Configuration
Step 1
Connect a flame sensor to Arduino with a Digital Pin by the below pin configuration:
Pin configuration
Flame Sensor Arduino
VCC------------------------------------> +5V
GND------------------------------------> GND
DO --------------------------------------> Digital pin8
Step 2
Next, connect a Piezo Buzzer to Arduino to make an alarm sound. There is no need to use a resistor for the Buzzer connection.
Pin configuration
Piezo Buzzer Arduino
(+) ---------------------------------------------> Digital pin9
(-) ---------------------------------------------> Digital pin GND
Step 3
Connect Led bulb to Arduino for  a flashing light for the fire alert warning.
Pin configuration 
Led bulb Arduino
(+) --------------------------------------------> Digital pin10
(-) --------------------------------------------> Digital pin GND
We successfully made the hardware connection :).

Stage 2 [Write and upload code to Arduino]

In this step, write code for Arduino using the Arduino IDE.
  1. Download Arduino software using this link here.
  2. Install and open an Arduino IDE in your PC/Laptop.
  3. Connect your Arduino board to your computer using a USB data cable.
  4. Copy and paste below the code into the Arduino IDE.
    1. #define Fire_sensor 8  
    2. #define Buzzer 9  
    3. #define Light 10  
    4. #define ldelay 500  
    5. #define bdelay 500  
    6. void setup() {  
    7.     Serial.begin(9600);  
    8.     pinMode(Fire_sensor, INPUT);  
    9.     pinMode(Buzzer, OUTPUT);  
    10.     pinMode(Light, OUTPUT);  
    11. }  
    12. void loop() {  
    13.     if (int a = digitalRead(Fire_sensor) == LOW) {  
    14.         alert();  
    15.     } else {  
    16.         digitalWrite(Buzzer, LOW);  
    17.         digitalWrite(Light, LOW);  
    18.     }  
    19. }  
    20. void alert() {  
    21.     digitalWrite(Light, HIGH);  
    22.     digitalWrite(Buzzer, HIGH);  
    23.     delay(ldelay);  
    24.     digitalWrite(Light, LOW);  
    25.     digitalWrite(Buzzer, LOW);  
    26.     delay(ldelay);  
    27.     digitalWrite(Light, HIGH);  
    28.     digitalWrite(Buzzer, HIGH);  
    29.     delay(ldelay);  
    30.     digitalWrite(Light, LOW);  
    31.     digitalWrite(Buzzer, LOW);  
    32.     delay(ldelay);  
    33.     digitalWrite(Light, HIGH);  
    34.     digitalWrite(Buzzer, HIGH);  
    35.     delay(ldelay);  
    36.     digitalWrite(Light, LOW);  
    37.     digitalWrite(Buzzer, LOW);  
    38.     delay(ldelay);  
    39. }  
Save and upload this code to the Arduino UNO board. After the code upload is completed, the device can start to detect any fire in a fixed area.

Stage 3 [Test our developed system]

Our developed system can now get ready to detect fire. I am using a match box for making fire to test our fire detection alarm system.
How To Create A Fire Detection AlarmingSystem Using Arduino UNO R3
Finally, the fire detection system gets alarmed and a red light indicates when fire can be detected by a sensor. This system successfully works.