Smart Fire Detection and Deterrent System for Human Savior by Using Internet of Things (IoT)

: Fire monitoring systems have usually been based on a single sensor such as smoke or ﬂame. These single sensor systems have been unable to distinguish between true and false presence of ﬁre, such as a smoke from a cigarette which might cause the ﬁre alarm to go off. Consuming energy all day long and being dependent on one sensor that might end with false alert is not efﬁcient and environmentally friendly. We need a system that is efﬁcient not only in sensing ﬁre accurately, but we also need a solution which is smart. In order to improve upon the results of existing single sensor systems, our system uses a combination of three sensors to increase the efﬁciency. The result from the sensor is then analyzed by a speciﬁed rule-set using an AI-based fuzzy logic algorithm; deﬁned in the purposed research, our system detects the presence of ﬁre. Our system is designed to make smart decisions based on the situation; it provides feature updated alerts and hardware controls such as enabling a mechanism to start ventilation if the ﬁre is causing suffocation, and also providing water support to minimize the damage. The purposed system keeps updating the management about the current severity of the environment by continually sensing any change in the environment during ﬁre. The purposed system proved to provide accurate results in the entire 15 test performed around different intensities of a ﬁre situation. The simulation work for the SMDD is done using MATLAB and the result of the experiments is satisfactory.


Introduction
On the market there are many fire detection systems available. Many of them may work with a single sensor. These single sensor systems might cause false results as there are different factors to be considered when detecting fire, and false results may end up wasting energy, or worse, end up causing property damage. On the market there are two types of solutions: either they are cheap, such as sensors that might go off with the smoke from a cigarette, or they are too expensive, such as a sensor based on optical vision and head vision sensors.
In literature, different methods have been purposed by different researches to handle these kinds of circumstances. Some have utilized wireless sensor networks (WSN) with the integration of a global system of mobile communication (GSM) to create effective fire detection and warning mechanisms. Some researchers purposed image processing techniques and artificial intelligence based algorithms to execute different sets of actions depending upon the severity of the fire hazard, but every technology has its benefits and also its limitations with it [1,2]. In the quest of making a smart wireless sensor for fire detection, this research paper's purpose is a Smart Fire Detection and Deterrent System (SMDD). The purposed system uses a combination of multiple sensors so that it can produce efficient result while keeping the cost affordable. The purposed system is based on fuzzy logic to make the decisive decision based on the severity of the given circumstances. The purposed system uses Arduino microprocessors. The purposed system utilizes the fuzzy logic-based algorithm to detect the fire and depending on the severity activates the alarm and sends an alert message to the authorities. If the situation is critical enough that it might be lethal to human life, the purposed system is smart enough to start human life support, which involves a water sprinkler and will also start the emergency exhaust system to reduce suffocation in that particular area [3,4].
Our system is based on the fuzzy logic which is the brainchild of Dr. Lotfi Zadeh of the university of California; the idea was proposed in 1960 [5,6]. In 1964, he presented the membership function, which has become the life force of the fuzzy set theory [7,8]. In 1965 the fuzzy set theory and the fuzzy logic theologies were introduced, which became the founding tone for the membership function and the rule set, which has a vital role in SMDD.
The rest of the paper is structured as follows: Section 2 discusses the results of the literature review; Section 3 explains in detail the equipment and methodology of the presented research for the proposed Fire Monitoring and Warning System; Section 4 explains the results of the research in detail; and Section 5 presents a conclusion of the presented research.

Related Work
Before the arrival of fuzzy logic in the spotlight, fuzzy set theory became the mainstay for the new research ground for researchers to come up with applications for the detection of fire [9]. There were other ways that were proposed, which included artificial intelligencebased fields such as setting up neural networks or using a camera to detect changes in images using image processing or video-based technologies. As the cost of human life is above all, the use of various technologies has been proposed for the detection of fire at early stages [10].
Hamdy et al. proposed a similar system with the combination of wireless sensors including temperature, light and smoke. These sensors provided the main data. This data became the foundation for an artificial neural network (ANN) that guided in the detection of fire in forests at an earlier stage. The SFFEDSS was purposed to detect the fire without the involvement of a human factor [11]. Our system also uses multiple sensors, but the difference is for an indoor environment; we also use humidity sensors in addition to our system using AI algorithms to produce the final result instead of just depending on the results of a sensor alone. Turgay et al. purposed an image processing system which uses chrominance information with the factor of luminance that are converted into YCbCr color space, and fuzzy logic rules are used as the definition for more efficient detection of fire pixels from non-fire pixels in order to avoid false fire alarms [12]. Our system also uses the fuzzy logic algorithm, but the feature is the factor of multiple sensor, meaning if one of the sensor is defective or fails, the system will not become useless, it will use the results of other sensors to still provide results that can be acted upon.
Divya et al. came forward with the research for detection of fire with different techniques. As fire has different colors-yellow, red, orange, white-and many other objects that are not related to fire that may have the same color in order to identify fire, the purposed research used edge detection with the combination of motion detection and the area being covered with various thresholds in place to identify the existence of fire [13].
Giovanni laneve et al. provided a technique to detect fire in the Mediterranean forest by using satellites with infrared image technology called SEVIRI images. The base idea was two compare two images with each other after an interval of every 15 min [14]. Usage of satellite infrared imagery can be costly. Our system is designed to keep the cost to a minimum and still be able to provide effective results. Even if the sensor becomes faulty or damaged, the cost of replacing them is not high, so they are suitable for households as well factories and companies.
Haibing et al. presented a system in which multiple sensors were used for the detection of fire with short range to long range communication with the help of gprs. The base algorithm used in the purposed research was a BP algorithm which was used for detecting and anticipating the probability of fire at any given moment with the help of these sensors including carbon monoxide, smoke detection and temperature sensors [15]. In our system we also utilize the power of smoke sensors to detect the presence of fire, but in addition to that our purposed system provides starting of a ventilation system that reduces suffocation. Tuan wei et al. described a method for detecting fire by using image processing in which wavelet transformation method was combined with the edge-area-information to detect the energy emitted by the frames to detect fire over a longer period of time for those areas which are left unattended [16,17].
Santoshinee et al. provided an algorithm for detecting fire using wireless sensors including temperature and humidity sensors [16]. On top of these sensors for detecting fire the researcher also provides the algorithm to detect faulty nodes to produce more efficient systems and performed indoor experiments to validate the results for the algorithm [18]. Navyanth et al. purposed a mechanism for detection of fire using robots with ultrasonic sensors mounted on them [19]. The goal of the research was to detect and reach the designated area without causing damage to the nearby properties and avoid nearby obstacles. To achieve this goal, the purposed research used the distance of the obstacles from the robot with the help of turn around angles from the head of the robot to front, left and right, including other nearby robots using ultrasonic sensors. The purposed research used fuzzy logic algorithm as its base for the detection of fire [20].The maintenance cost of managing robots can be high as the technology involved is complex and requires expert maintenance efficient result that can be achieved by our purposed AI algorithm power system with a heavy cost of maintaining, as the sensors involved in our system are easy to acquire and integrate.
Prathyusha et al. purposed an E-Nose Electronic-Natural oil factory sensor emulator's sensor which used high end and state of the art sensors to detect smoke such as carbon dioxide co2 and carbon monoxide. The purposed system differentiates between fire and no fire particles in order to reduce the frequency of false fire alarms; another feature to extinguish the fire is with the help of a built-in fire extinguisher that activates when the sensor is absolute about the presence of fire, as a precaution [21].
Faisal et al. purposed his research while keeping the focus on the security of homes against fire hazard and used multiple wireless sensors in order to detect fire and integrated the GSM technology to send a notification if such an event occurs [22,23]. Our system takes Energies 2021, 14, 5500 4 of 30 the data from the sensor, but for accuracy we use data for analysis in the AI fuzzy logic algorithm to provide efficient results.
Malykhina et al. purposed a system that uses a wireless thread interface at its core to detect fire at early stages in plants [24]. The interface provides the facility to use the sensor to be moved freely around. These systems could easily be used as a temporary fire warning system by using multiple sensors while monitoring any changes in temperature, density of smoke and the composition of gas in the surrounding area [25,26]. Liu et al. presented his research regarding a smart bushfire monitoring system which uses cheap microcontrollers to detect fire and is incorporated with GSM technology to send SMS notification in case of fire occurrence. The purposed system also facilitates the GPS microcontroller in order to communicate the sensor information [27].
Antonio et al. purposed an algorithm hour that integrated image processing technology with fuzzy logic to detect fire [28]. In order to increase the efficiency of the system and in order to reduce false positives the algorithm uses dynamic motion test by analyzing the result produced by fuzzy logic when applied to analyze the motion of such areas that resemble fire colors [29]. In our system Fuzzy logic is used for analyzing the results from multiple sensors to accommodate if the sensor even gets faulty data from other sensors and can be used to perform analyses for the detection of fire. Mingyi et al. purposed a mechanism to detect the fire using a neural network. The neural network used bp (Back Propagation) algorithm as base. The purposed system used a microcontroller to provide the necessary data to the algorithm in order to detect the occurrence of fire and the sensors used in the purposed model include CO, temperature and smog sensor [30]. Muhammad Salihin et al. presented a mechanism to detect fire using smoke sensors and also provided a monitoring system so that in case of a fire the system could provide the monitoring mechanism to display wirelessly to help firefighters to pinpoint the location of fire, helping in the rescue process [31,32].

Methods and Equipment's
The purposed system uses four sensors for getting the data to use it as input and based on the data collected from the sensors a rule based fuzzy logic is implemented. For SMDD MATLAB fuzzy Logic Toolbox capabilities are used for simulation work to provide an accurate picture and to also push the flexibility and scalability of system to next levels with respect to other systems [33].
In SMDD, linear input data has been mapped to scalar output with a fuzzy logic system. In order to do that, different sets of operations were performed as mentioned below: For the steps mentioned above each method has different sub methods to choose from, such as for fuzzification there is singleton fuzzification and grade fuzzification. For inference there is minmax inference, Takagaki_sugenu and Mamdani Fuzzy inference system; similarly for defuzzification, there is the centroid method, weighted Average method and mean-max membership method. In our purposed system the code for fuzzy logic control is written in C language using Arduino IDE, which is further integrated with Arduino UNO microcontroller, which is also controlling the sensors. The model for Arduino Board is ATmega328P. Table 1 provides the description of the terms that are used in this paper.

Purposed Fuzzy Logic System Architecture
The architecture for the purposed fuzzy logic used in SMDD is shown in Figure 1. Normally fuzzy set G is represented by a pair of (U,a) here U is the representation of universe of Disclosure and "a" is the membership function, for which values are assumed between the range from 0 to 1. The universe of disclosure plays a very important and vital role in this approach. The fuzzy set G within the Universe of information U could be defined as by being an ordered pair set of elements y which can be mathematically represented as: Three parameters Q W E R are utilized in the system purposed. Where Q is the representation of temperature. W is the representation of humidity. E is the symbolic representation of smoke and Time is represented by R. Representation of degree of membership of x in Q is given by aQ(x). aW(x) is the representation of the degree of member ship function of x in Similarly the representation of degree of membership of x in E is given by aE(x) and for time the degree of membership of x is shown as aR(x). Equations (2) and (3) are the representation of the above-mentioned degree of membership of with respect to temperature, humidity, smoke and time. Q∪W∪E∪R = {x, max(aQ(x), aW(x), aE(x), aR(x)) |x is an element of G} (2) Q∩W∩E∩R = {x, min(aQ(x), aW(x), aE(x), aR(x)) |x is an element of G} The Equations (2) and (3) are defined to calculate the strength of the rule in the purposed system. Equation (2) shows union of four fuzzy subsets by using or operator in which fuzzy inputs and are combined by the fuzzy combination. Similarly, the equation three shows the intersection of four fuzzy subsets for which the "and" operator is used. The intersection of four fuzzy subsets is achieved by clipping the output membership function. In the purposed system the Equation (3) with (4) inputs are used to obtain the strength of a rule by combining both fuzzified inputs and the output of membership function. The linguistic variables as qualitative and quantitative can both be utilized to describe the fuzzy set. According to the definition of membership function, each point is to be mapped to the values between 0 and 1 in the defined universe of disclosure. The fuzzy rule in our purposed system is represented by rules to describe a piece of information; the fuzzy rules in this system are the most widely and commonly used approach for the representation. Three parameters Q W E R are utilized in the system purposed. Where Q is the representation of temperature. W is the representation of humidity. E is the symbolic representation of smoke and Time is represented by R. Representation of degree of membership of x in Q is given by aQ(x). aW(x) is the representation of the degree of member ship function of x in Similarly the representation of degree of membership of x in E is given by aE(x) and for time the degree of membership of x is shown as aR(x). Equations (2) and (3) are the representation of the above-mentioned degree of membership of with respect to temperature, humidity, smoke and time. Q∪W∪E∪R = {x, max(aQ(x), aW(x), aE(x), aR(x)) |x is an element of G} (2) Q∩W∩E∩R = {x, min(aQ(x), aW(x), aE(x), aR(x)) |x is an element of G} The Equations (2) and (3) are defined to calculate the strength of the rule in the purposed system. Equation (2) shows union of four fuzzy subsets by using or operator in which fuzzy inputs and are combined by the fuzzy combination. Similarly, the equation three shows the intersection of four fuzzy subsets for which the "and" operator is used. The intersection of four fuzzy subsets is achieved by clipping the output membership function. In the purposed system the Equation (3) with (4) inputs are used to obtain the strength of a rule by combining both fuzzified inputs and the output of membership function. The linguistic variables as qualitative and quantitative can both be utilized to describe the fuzzy set. According to the definition of membership function, each point is to be mapped to the values between 0 and 1 in the defined universe of disclosure. The fuzzy rule in our Energies 2021, 14, 5500 6 of 30 purposed system is represented by rules to describe a piece of information; the fuzzy rules in this system are the most widely and commonly used approach for the representation.
Our Solution follows the process as described in the flow chart above of fuzzy logic. The result from our sensors are the crisp input for the algorithm. Fuzzy inference is then applied for determining the matching degree of the input data with predefined rules in the fuzzy logic and decided which predefine rule is to be fired based on the input values. Then the centroid defuzzification process is used to produce the output values.
Algorithm 1 describes the working of fuzzy logic which is based on [34] and fuzzy logic is represented in Figure 1 with all of its components as mentioned earlier. The following algorithm implements the fuzzy logic system in this purposed solution SMDD. Define: The terms and the variables 2: Create: Membership Functions for The Purposed Solution 3: Create: Rule base 4: Construct: Crisp Inputs using Membership Function and convert them to fuzzy values 5: Evaluate: The Rules present in rule base 6: Combine: The Results of each rule 7: Construct: Output from non-fuzzy values As per the purposed algorithm, the first step is to define the variables and terms. Sensors that are used to gather input in our purposed system are temperature, humidity and smoke. The term used to represent humidity is Humidity -S, the term to resent temperature is Temp-S and to represent smoke the term that is utilized in the purposed system is Smoke-S. The second step was to setup the membership functions, which play a very vital role because it is used to convert the inputs from the sensors known as crisp values to fuzzy values as input. These inputs are utilized by our rule base which was set up after the member ship function. The rule base consisted of all the rules checking the presence of fire at low to high using all the inputs provided from temperature humidity smoke sensors. Inference is made by utilizing the Fuzzy Rule base to check the intensity of fire based on the fuzzy inputs based on the result; the last step was to perform defuzzification method. The detail description of each of the component used in the algorithm is given below.

Fuzzification Method
In the fuzzification phase of the purposed fuzzy logic the input values from the humidity, temperature and smoke sensors are converted into fuzzy inputs. This conversion takes place with the help of membership functions which are explained in detail in the next section. Each value from the sensor which is being fuzzified has their quality represented by their membership function; for example the membership function for humidity sensor, Temperature and smoke sensor is given by "High", "Mid" and "Low", while the membership faction for time is valued by "Long" and "Short" and the fuzzification set is represented by the following relation (4) Here the Z(x1) is there representation of kernel of fuzzification. This method when implemented the value if β is kept constant and the xi kept being converted to a fuzzy set Z(xi). Fuzzification provides the fuzzy inputs on which the rule base is applied to get the output on which critical decision are made depending upon the circumstances.

Membership Function
In the purposed solution the membership ship function is given by βG: X [0,1] according to this for a given fuzzy set G in which X represents the universe of disclosure and every value of X is mapped to a degree of membership ranging between the values from Energies 2021, 14, 5500 7 of 30 0 to 1. In the proposed system, a graphic approach can also be provided where x is the representation of the values of universe of disclosure and the y is representing the degree of membership ranging from 0 to 1. In the purposed system triangular membership function is being used. Triangular member ship function according to definition has a lower limit and an upper limit b and third value m acting as a mean between the lower and upper limit which is represented as: a < m < b the reason for using triangular membership function is due to its simplicity to implement and that it provides efficiency and accuracy. For implementation of triangular membership function in the purposed system we have utilized the MATLAB "trimf" function.
The x axis in triangular member ship function is represented by three parameters gin as (a,m,b) these values represent the lower boundary peak and the upper boundary respectively. The above-mentioned equation can also be expressed in the form of min max operation as described in Equation (6).
In the purposed system the fuzzy logic is based on the Equations (5) and (6) with 5 variables in which 4 of them are the inputs which are collected from (Temperature, humidity, smoke and time) and one is output of the fuzzy logic system on which the purposed system makes decisions. There are three variables involved in the triangular membership function for each sensor which are given as a, b, c with the following property (a < b < c). The linguistic variable use in the purposed system with above mention membership function are following change rate in Temperature-S, change rate in Humidity-S, change rate in Smoke-S, Time and output variable showing the "fire chances". The mentioned membership function is given as "trimf" function in the MATLAB fuzzy logic toolbox and is further explained in Section 3 with each of the sensor mentioned here in detail.

Fuzzy Inference System Used for SMDD
The fuzzy inference system used in fuzzy logic algorithm is based on the if else rule, and a set of membership functions with the combination of fuzzy logic operators (and, or). In this purposed fuzzy logic algorithm fuzzy inference is use4d to map the fuzzy inputs to and fuzzy output. There are different inference systems available such as Mamdani fuzzy inference, Takagi-Sugeno Fuzzy Model and Tsukamoto fuzzy inference system. In the purposed system the Mamdani Fuzzy Inference system is used which was purposed in 1975 by Ebhasism Mamdani, which was used to control a boiler with a steam engine and boiler by utilizing a set of fuzzy rules that were obtained from a group of people working on the system.
The following are the steps that are used in Mamdani fuzzy inference system to get the computed output: Step 1-Determine the fuzzy rules.
Step 2-convert crisp input using membership function to fuzzy input values.
Step 3-Set up the Rule base.
Step 4-Evaluate the fuzzy input on the bases of rule base and membership function to get the output.
Step 5-Combine all the outputs.
Step 6-Defuzzification of the output from the membership function.
In the Equations (7) and (8) there are three fuzzy values given as Q, W, E and operator is used here for applying intersection on these crisp inputs gathered from the sensors.

Defuzzification Method Used in the Proposed Fuzzy Logic
Defuzzification is the process of reducing the fuzzy member into a crisp member or crisp set. In the purposed SMDD system the output evaluated with the help of rule set that were given in the form of if-then else statements. These rule bases are being used as the knowledge base to get the computed output. In this step the scaler values of the system are fuzzified by applying the rules on them which results in generation of a fuzzy output result which converts this into a scaler quantity. There are different methods available for defuzzification described below:

Max Membership Method
This methodology is limited to peak output function. It is represented mathematically as:

Weighted Average Method
In weighted average the function is weighted using the maximum membership value.

Centroid Method
This method is developed by Sugeno in 1985. Mathematical representation of the defuzzied output for centroid method is given as following: Here X* is the defuzzied output. β G is the aggregated membership function. In the purposed system the shape is obtained using "and" fuzzy operator by clipping the output of membership function based on the rule strength.
Defuzzification is done in SMDD using Centroid Defuzzification Method and MAT-LAB fuzzy logic toolbox.

Implementation of Smart Fire Detection and Deterrent (SMDD)
The purposed SMDD system used multiple sensors to detect fire presence. The sensors that are used in this purposed solution included temperature sensor, humidity sensor, smoke and flame sensor. The flame sensor is first sensor that goes off if it detects the presences of flame. If the flame sensor detects presence of fire, then temperature humidity and smoke starts sensing the environment and recording the inputs. The workflow of the purposed system can be seen in Figure 2.
As defined in the workflow of the purposed system the sensors are attached with Microcontroller that senses the environment. The second step in workflow is to sense the presence of fire with the help of a flame sensor as soon as the sensor detects the presence. As per Flow chart, a decision is to be made based on the severity of the fire. The severity of fire here is detected by using the AI fuzzy logic algorithm, in which Fuzzy inference is then applied for determining the matching degree of the input data with predefined rules in the fuzzy logic and decided which predefine rule is to be fired based on the input values. Then the centroid defuzzification process is used to produce the output decision value. Based on the result, as per flow diagram system either sends the alert or starts the water sprinkler, As defined in the workflow of the purposed system the sensors are attached with Microcontroller that senses the environment. The second step in workflow is to sense the presence of fire with the help of a flame sensor as soon as the sensor detects the presence. As per Flow chart, a decision is to be made based on the severity of the fire. The severity of fire here is detected by using the AI fuzzy logic algorithm, in which Fuzzy inference is then applied for determining the matching degree of the input data with predefined rules in the fuzzy logic and decided which predefine rule is to be fired based on the input values. Then the centroid defuzzification process is used to produce the output decision value. Based on the result, as per flow diagram system either sends the alert or starts the water sprinkler, then the system waits for the next result as per the flow diagram cycle to send the alert or to stop the water sprinkler and alerts if the situation is under control.

Hardware and Software Used for the Implementation of SMDD
In the purposed solution different sensors that are used include MQ series MQ-7 smoke sensor along with DHT22 temperature and humidity sensor. The flame sensor is used for detecting flame. In order to power these sensors and perform operation the Arduino UNO microcontroller is used. The details and specification for the above-mentioned sensors are discussed below: Arduino UNO microcontroller is a microcontroller board based on ATmega328. Arduino is an open-source platform. The Arduino Uno board has 14 digital input/output pins it has 6 analog inputs from A0 to A5. From the 14 pins 6 pins can be used as PWM output. The crystal oscillator on this board is of 16 MHz a USB connector. It also has a power jack and a reset button as shown in Figure 3.

Hardware and Software Used for the Implementation of SMDD
In the purposed solution different sensors that are used include MQ series MQ-7 smoke sensor along with DHT22 temperature and humidity sensor. The flame sensor is used for detecting flame. In order to power these sensors and perform operation the Arduino UNO microcontroller is used. The details and specification for the above-mentioned sensors are discussed below: Arduino UNO microcontroller is a microcontroller board based on ATmega328. Arduino is an open-source platform. The Arduino Uno board has 14 digital input/output pins it has 6 analog inputs from A0 to A5. From the 14 pins 6 pins can be used as PWM output. The crystal oscillator on this board is of 16 MHz a USB connector. It also has a power jack and a reset button as shown in Figure 3. Features of the Arduino UNO: • ATmega328  The DHT22 humidity and temperature sensor is used to detect both temperature and humidity of the environment. The DHT22 has three pins available on it: one for digital input, one for power and the last one for ground. These pins are attached with the micro controller. Dht22 sensor senses the temperature in centigrade and humidity value is presented in percentage as shown in Figure 4.  The DHT22 humidity and temperature sensor is used to detect both temperature and humidity of the environment. The DHT22 has three pins available on it: one for digital input, one for power and the last one for ground. These pins are attached with the micro controller. Dht22 sensor senses the temperature in centigrade and humidity value is presented in percentage as shown in Figure 4. DHT22 senses temperature in between the range from −40 °C to 80 °C; the range for humidity scented by the DHT22 is in from 0% to 100%. The DHT22 has transformation distance of 100 m. In order to configure DHT22 with Arduino microcontroller using Arduino IDE DHT22 library is used. DHT22 senses temperature in between the range from −40 • C to 80 • C; the range for humidity scented by the DHT22 is in from 0% to 100%. The DHT22 has transformation distance of 100 m. In order to configure DHT22 with Arduino microcontroller using Arduino IDE DHT22 library is used.

DHT22 Specifications
Operating Voltage: 3.5 V to 5.5 V Operating current: 0.3 mA (measuring) 60 uA (standby) Output: Serial data Temperature Range: −40 • C to 80 • C Humidity Range: 0% to 100% Resolution: Temperature and Humidity both are 16-bit Accuracy: ±0.5 • C and ±1% Flame Sensor: In our proposed system, a flame sensor is used to detect the presence of flame initially with wavelengths ranging from 760 nm to 1100 nm as shown in Figure 5. Flame sensor integration with Arduino Uno microcontroller is done by attaching a ground pin of sensor with microcontroller ground pin and the A0 pin of the sensor was attached to microcontroller A0 pin. The flame sensor is powered with a 5 V power input from the micro controller; the code is written for the flame sensor in the Arduino Ide.
Flame Sensor: In our proposed system, a flame sensor is used to detect the presence of flame initially with wavelengths ranging from 760 nm to 1100 nm as shown in Figure  5. Flame sensor integration with Arduino Uno microcontroller is done by attaching a ground pin of sensor with microcontroller ground pin and the A0 pin of the sensor was attached to microcontroller A0 pin. The flame sensor is powered with a 5 V power input from the micro controller; the code is written for the flame sensor in the Arduino Ide.  Smoke Sensor MQ2 Gas sensor is an efficient sensor of sensing smoke alcohol hydrogen methane and carbon monoxide in the air. MQ2 is a metal oxide-based sensor; there is another name used for this sensor-"Chemiresistors"; using the implementation of simple voltage divider, the gas presence can be detected by MQ2 sensor. MQ2 is powered by 5 V of DC voltage and 800 mW is drawn out by the sensor as shown in Figure 6 and its specification in Figure 7. The sensor has a steel mash over it that is called an anti-explosion network which gives it the capability to sense flammable gas without exploding internally, which makes it more ideal in our fire hazard-based situations. This mesh acts as shield as well by allowing only gas elements through, due to which the accuracy of readings also increases. The sensing element in the sensor is composed of Aluminum Oxide (AL2O3) based ceramic with a coating of Tin Dioxide (SnO2). The Tin Dioxide is the most important material being sensitive towards combustible gases [35]. Smoke Sensor MQ2 Gas sensor is an efficient sensor of sensing smoke alcohol hydrogen methane and carbon monoxide in the air. MQ2 is a metal oxide-based sensor; there is another name used for this sensor-"Chemiresistors"; using the implementation of simple voltage divider, the gas presence can be detected by MQ2 sensor. MQ2 is powered by 5 V of DC voltage and 800 mW is drawn out by the sensor as shown in Figure 6 and its specification in Figure 7. The sensor has a steel mash over it that is called an anti-explosion network which gives it the capability to sense flammable gas without exploding internally, which makes it more ideal in our fire hazard-based situations. This mesh acts as shield as well by allowing only gas elements through, due to which the accuracy of readings also increases. The sensing element in the sensor is composed of Aluminum Oxide (AL 2 O 3 ) based ceramic with a coating of Tin Dioxide (SnO 2 ). The Tin Dioxide is the most important material being sensitive towards combustible gases [35].

Program for the Micro Sensors in Arduino IDE
After the hardware configuration of all the sensors with the microcontroller, in order to read the sensors value and record them Arduino IDE 1.8.5 was used in which code was written in C language, the only library used was for DHT22 to sense the humidity and temperature. DHT22 is a library available online for the configuration of the sensor. Once we were able to read the data, we were able to generate the real time graphs of sensor sensing the environment in real time; the code for that is shown in the figure the input from the code allowed us to calculate Universe of Disclosure for the simulation to work on the MALTAB fuzzy logic tool box as shown in Figure 8.

Smoke Sensor MQ2 Specifications
Working Voltage is +5 V Can detect Alcohol, LPG, Hydrogen, CO, Propane and even methane Analog output voltage: 0 V to 5 V Digital Output Voltage: 0 V or 5 V Duration of preheat is 20 s Provides both digital and analog sensor VCC provides power to the module. It is connected to 5 V output from Arduino Uno microcontroller. GND represents the Ground Pin. D0 provides our system with a digital output of the presence of combustible gases. A0 provides analog output.

Program for the Micro Sensors in Arduino IDE
After the hardware configuration of all the sensors with the microcontroller, in order to read the sensors value and record them Arduino IDE 1.8.5 was used in which code was written in C language, the only library used was for DHT22 to sense the humidity and temperature. DHT22 is a library available online for the configuration of the sensor. Once we were able to read the data, we were able to generate the real time graphs of sensor sensing the environment in real time; the code for that is shown in the figure the input from the code allowed us to calculate Universe of Disclosure for the simulation to work on the MALTAB fuzzy logic tool box as shown in Figure 8.

Graphical Representation of Sensors with Crisp Values
In this purposed system, there are three inputs from the following sensors: flame, Temperature, Humidity and smoke sensor. Given below are the graphical representations of how the environment affects each one of the scenes in the presence of fire as well as absence of fire room temperature. There are two graphs for each of the sensors described below one with the presence and another with absence of fire.

Graphical Representation of Sensors with Crisp Values
In this purposed system, there are three inputs from the following sensors: flame, Temperature, Humidity and smoke sensor. Given below are the graphical representations of how the environment affects each one of the scenes in the presence of fire as well as absence of fire room temperature. There are two graphs for each of the sensors described below one with the presence and another with absence of fire.

Graphical Representation of Flame Sensor
Flame sensor KY-026 in the purposed system is used to detect the presence or absence of fire. The reason for using it is its sensitivity to IR wavelength. In this system, for flame sensors we consider the analog output from the sensor which is a real time output voltage signal on the thermal resistance. As can be seen in Figure 9, the graphical representation of the flame sensor analog output is steady and provides a voltage signal above or near 980.
Flame sensor KY-026 in the purposed system is used to detect the presence or absence of fire. The reason for using it is its sensitivity to IR wavelength. In this system, for flame sensors we consider the analog output from the sensor which is a real time output voltage signal on the thermal resistance. As can be seen in Figure 9, the graphical representation of the flame sensor analog output is steady and provides a voltage signal above or near 980. Flame sensor KY-026 in the purposed system is used to detect the presence or absence of fire. Figure 9 represents the graphical representation of the flame sensor analog voltage signals output. In the presence of fire, as soon as the flame starts the values of the output signal start to decrease; depending upon the intensity of the flame, the values drop significantly. The sensor is highly sensitive to the intensity of fire, as in the Figure 10 the graph shows that as the intensity of the fire starts to increase, the sensor voltage signal starts to drop. As presented in the graph, the values drop from 980 up to below 100 as the intensity of the flame continues to increase. Flame sensor KY-026 in the purposed system is used to detect the presence or absence of fire. Figure 9 represents the graphical representation of the flame sensor analog voltage signals output. In the presence of fire, as soon as the flame starts the values of the output signal start to decrease; depending upon the intensity of the flame, the values drop significantly. The sensor is highly sensitive to the intensity of fire, as in the Figure 10 the graph shows that as the intensity of the fire starts to increase, the sensor voltage signal starts to drop. As presented in the graph, the values drop from 980 up to below 100 as the intensity of the flame continues to increase.

Graphical Representation of DH11 Humidity Sensor
In the purposed solution for checking the humidity, the DH11 sensor comes into play. For power we have used 5 v power supply from the Arduino board. The reason for selecting the DH11 sensor is for its accuracy in detecting humidity between the range of 0 to 100 percent. Figure 11 is the graphical representation of a humidity sensor sensing humidity in percentages at room temperature; as can be seen, the humidity is near 37-38%.

Graphical Representation of DH11 Humidity Sensor
In the purposed solution for checking the humidity, the DH11 sensor comes into play. For power we have used 5 v power supply from the Arduino board. The reason for selecting the DH11 sensor is for its accuracy in detecting humidity between the range of  Figure 11 is the graphical representation of a humidity sensor sensing humidity in percentages at room temperature; as can be seen, the humidity is near 37-38%.

Graphical Representation of DH11 Humidity Sensor
In the purposed solution for checking the humidity, the DH11 sensor comes into play. For power we have used 5 v power supply from the Arduino board. The reason for selecting the DH11 sensor is for its accuracy in detecting humidity between the range of 0 to 100 percent. Figure 11 is the graphical representation of a humidity sensor sensing humidity in percentages at room temperature; as can be seen, the humidity is near 37-38%. Figure 11. Humidity sensor at Room Temperature. Figures 12 and 13 shows the graphical representation of a humidity sensor sensing humidity in percentages in the presence of flame as the humidity starts to decrease. As soon as the temperature starts to rise, the same can be seen in the graph where the humidity is gradually decreasing as the temperature keeps on increasing, because as the temperature increases due to fire, the moisture of the surroundings decreases. Figure 11. Humidity sensor at Room Temperature. Figures 12 and 13 shows the graphical representation of a humidity sensor sensing humidity in percentages in the presence of flame as the humidity starts to decrease. As soon as the temperature starts to rise, the same can be seen in the graph where the humidity is gradually decreasing as the temperature keeps on increasing, because as the temperature increases due to fire, the moisture of the surroundings decreases.

Graphical Representation of DH11 Temperature Sensor
In order to keep an eye on the temperature in the purposed system for sensing temperature, the DH11 sensor again plays a vital role. The sensor is powered by a 5 volt power supply from the microcontroller and has the ability to detect temperatures in the following range: −40-80 °C. The figure shows a graphical representation of the output of DH11 sensor while sensing temperature at room temperature; as can be seen, the temperature is at a constant value of 36 °C. Figure 14 is the graphical representation of a Dh1 sensor sensing temperature in the presence of gradually increasing fire; as can be seen from the graph, the sensor is capable of detecting a gradual increase in temperature accurately.

Graphical Representation of DH11 Temperature Sensor
In order to keep an eye on the temperature in the purposed system for sensing temperature, the DH11 sensor again plays a vital role. The sensor is powered by a 5 volt power supply from the microcontroller and has the ability to detect temperatures in the following range: −40-80 • C. The figure shows a graphical representation of the output of DH11 sensor while sensing temperature at room temperature; as can be seen, the temperature is at a constant value of 36 • C. Figure 14 is the graphical representation of a Dh1 sensor sensing temperature in the presence of gradually increasing fire; as can be seen from the graph, the sensor is capable of detecting a gradual increase in temperature accurately. In order to make our purposed system smart enough and to provide life support to people if the intensity of fire increases to such a level as might cause suffocation, our system utilizes the MQ2 smoke sensor which detects the intensity of the smoke created by the fire. The sensor is powered with a 5 V supplied from the microcontroller. If the smoke reaches a critical level, the lives of people caught in that fire might be at risk, and our system is smart enough to start a ventilation process to provide life support. Figure 15 provides the graphical representation of smoke levels at room temperature in analog voltage signals; the value is consistent and is at 46 with small variations, which means there is no smoke present at room temperature. In order to make our purposed system smart enough and to provide life support to people if the intensity of fire increases to such a level as might cause suffocation, our system utilizes the MQ2 smoke sensor which detects the intensity of the smoke created by the fire. The sensor is powered with a 5 V supplied from the microcontroller. If the smoke reaches a critical level, the lives of people caught in that fire might be at risk, and our system is smart enough to start a ventilation process to provide life support. Figure 15 provides the graphical representation of smoke levels at room temperature in analog voltage signals; the value is consistent and is at 46 with small variations, which means there is no smoke present at room temperature. In order to make our purposed system smart enough and to provide life support to people if the intensity of fire increases to such a level as might cause suffocation, our system utilizes the MQ2 smoke sensor which detects the intensity of the smoke created by the fire. The sensor is powered with a 5 V supplied from the microcontroller. If the smoke reaches a critical level, the lives of people caught in that fire might be at risk, and our system is smart enough to start a ventilation process to provide life support. Figure 15 provides the graphical representation of smoke levels at room temperature in analog voltage signals; the value is consistent and is at 46 with small variations, which means there is no smoke present at room temperature.

Graphical Representation of DH11, MQ2 and Flame Sensor
In order to explain how our system acts in a critical situation when the fire becomes a hazard, our graphs describes how the sensor acts at room temperature and how a critical situation affects the values of the sensor, which makes it possible to handle critical scenarios. Figure 17 is the graphical representation of all the sensors at room temperature including smoke, humidity, temperature and flame sensors. As can be seen, the flame sensor shows an analog output signal at 980 and the smoke sensor shows the voltage signal between the ranges of 48-50. Humidity is at a value in the range of 40 percent and temperature is constant at about 36 °C.

Graphical Representation of DH11, MQ2 and Flame Sensor
In order to explain how our system acts in a critical situation when the fire becomes a hazard, our graphs describes how the sensor acts at room temperature and how a critical situation affects the values of the sensor, which makes it possible to handle critical scenarios. Figure 17 is the graphical representation of all the sensors at room temperature including smoke, humidity, temperature and flame sensors. As can be seen, the flame sensor shows an analog output signal at 980 and the smoke sensor shows the voltage signal between the ranges of 48-50. Humidity is at a value in the range of 40 percent and temperature is constant at about 36 • C.

Graphical Representation of DH11, MQ2 and Flame Sensor
In order to explain how our system acts in a critical situation when the fire becomes a hazard, our graphs describes how the sensor acts at room temperature and how a critical situation affects the values of the sensor, which makes it possible to handle critical scenarios. Figure 17 is the graphical representation of all the sensors at room temperature including smoke, humidity, temperature and flame sensors. As can be seen, the flame sensor shows an analog output signal at 980 and the smoke sensor shows the voltage signal between the ranges of 48-50. Humidity is at a value in the range of 40 percent and temperature is constant at about 36 °C.  Figure 18 shows the graphical representation of all the sensors in the presence of smoke and flame. As can be seen, the output voltage from the flame sensor is decreasing,  Figure 18 shows the graphical representation of all the sensors in the presence of smoke and flame. As can be seen, the output voltage from the flame sensor is decreasing, which will alert that flame is indeed present and all the sensor values will then be used to make a decision using the fuzzy logic algorithm. Humidity increases as temperature increases due to fire, and the value temperature in degrees sensed by the DH11 sensor continues increasing above 40 • C. As can be seen in the graph values, the smoke sensor also senses the smoke due to providing an increasing analog voltage signal going above 260.
ies 2021, 14, x FOR PEER REVIEW 19 of 31 which will alert that flame is indeed present and all the sensor values will then be used to make a decision using the fuzzy logic algorithm. Humidity increases as temperature increases due to fire, and the value temperature in degrees sensed by the DH11 sensor continues increasing above 40 °C. As can be seen in the graph values, the smoke sensor also senses the smoke due to providing an increasing analog voltage signal going above 260.

Records for Fuzzy logic Based on Sensors Data
The simulation work was done in MATLAB using the assistance of fuzzy logic toolbox for the purposed solution. In order to test whether the fire is present, there are a number of scenarios taken in account with the presence of fire and the absence of fire under harsh conditions on both ends with respect to humidity smoke and temperature sensors. The scenario also accounts for the time interval so that a better decision can be made about the intensity of fire if such a case arises. The data was gathered in real time from the sensor and was saved based on the data universe of disclosure for each of the

Records for Fuzzy logic Based on Sensors Data
The simulation work was done in MATLAB using the assistance of fuzzy logic toolbox for the purposed solution. In order to test whether the fire is present, there are a number of scenarios taken in account with the presence of fire and the absence of fire under harsh conditions on both ends with respect to humidity smoke and temperature sensors. The scenario also accounts for the time interval so that a better decision can be made about the intensity of fire if such a case arises. The data was gathered in real time from the sensor and was saved based on the data universe of disclosure for each of the sensors established.
In order to calculate Universe of disclosure for the purposed system simulation to work in MATLAB, data is gathered and displayed in Table 2. The data is collected and stored by the sensor in real time where each column represent the values of the sensors captured. The first column represents the Time interval that was recorded in minutes for each sensor value and in each iteration, time is continuously recorded as it increases while sensors senses the environment and decisions are updated with the new result, while the second column is the representation of temperature sensor data. The third column is the representation of humidity in percentages data which shows how the humidity is affected as the times move on and fire is detected. The fourth column represents the presence of smoke, the value representing how the presence of smoke affects the smoke sensor as it detects smoke starting due to the presence of fire. In Table 2, the first iteration shows at time 2 min that the temperature is 10 • C and humidity sensed is 30%, while smoke is 0 at second time (fifth minute) the temperature stated increasing to 29 degrees and humidity decreasing to 28 percent, and the smoke sensor senses the value at 30. When time is recorded at 10 min, the temperature is 36 degrees and humidity drops to 15 with smoke at a value of 100. In Table 3 for Experiment 2, in the second iteration when time is recorded at a value of 2 min, the temperature sensor records the temperature of the environment at a value of 26 • C and humidity is recorded by the humidity sensor at 22%, while smoke is 16%. In the fourth iteration when time is recorded at value of 12 min the temperature sensor records the temperature of the environment at a value of 35 • C and humidity is recorded by the humidity sensor at 17.8%, while smoke is 222.23%. For simulation, more than 70 experiments were done with more than 1000 values; based on this record we can set the Universe of Disclosure which is described below in Universe of Discourse for the values of membership function, meanwhile likewise the same as shown in Table 4 for experiment number 3.  In Table 5, the first column is representation Universe of Disclosure for linguistic fuzzy variable of Temperature sensor (Temp-S). For example, if the temperature of the particular area is 28 • C it will lie in the 0-30 • C range. If the temperature at any moment is 50 • C, then it lies in the range of high, which is starting from 45 • C up to 100 • C. The second column, which is Universe of Disclosure for the linguistic fuzzy variable Humidity (Humidity-S); for example if humidity is 29%, then it will be considered high as it lies in the high range which ranges in between 15-30%. The third column is representation of the Universe of Disclosure for a smoke sensor. The fourth column is the representation of universal of disclosure for Fire-Chances; this column represents the output at which different fire handling mechanisms will be activated and decisions are taken by the purposed system. The fifth column represents the times Universe of Disclosure, which holds values for shortand long-range and is measured in minutes. Based on these Universe of Disclosure for each of the linguistic fuzzy variables, different rules are applied.

Universe of Disclosure Configuration Representation on MATLAB
MATLAB provides fuzzy controller block, by which we can simulate the fuzzy logic control in order that first we enter the fuzzy variable with the inputs and based on those inputs we set up membership function. On these membership functions, a rule set is defined by which we get results on output that are interpreted using the procedure of fuzzy inference in order to do all that. The MATLAB fuzzy tools box for ease provides different editors and views to set up this data. In order to achieve our result for this purposed system, each of those views and editors are used. We used MATLAB 2018 version to provide the simulation result. In order to start this whole process, one has to enter the command of fuzzy in the command window, upon which fuzzy toolbox opens, and here we enter the variable state, their name and set our desired behavioral options.

Fuzzification Implementation in MATLAB
In fuzzification as described in fuzzy logic, crisp values are taken as input and are represented by a fuzzy linguistic variable with the help of membership function. in our purposed research, five inputs are taken into account: flame change in temperature, change in humidity change in time and smoke, and one output is evaluated based on the results of these inputs, known as fire-chances. Flame sensor variable is a constant because it is used to represent weather so its use is just for checking flame presence, and then all the rules are applied on the values captured after confirming that if fire is present by the rest of the sensor, the smoke humidity temperature and time are used in simulation of fuzzy logic to determine the chances of fire.
Membership Function for (Temp-S) temperature sensor: In Figure 19 LOW, MID, High are the three linguistic fuzzy variables used for representation of Temp-S. The y-axis value is a range between 0 and 1, respectively. The x-axis value is represented by a range between 0 and 100. Where the linguistic fuzzy variable low resides between 0 • C to 30 • C and medium variable resides in between the range of 30 • C to 45 • C. The linguistic fuzzy variable High is represented by the range from 45 • C to 100 • C; these values are based on the Universe of disclosure calculated for the temperature sensor (Temp-S) described in Table 3.
High are the three linguistic fuzzy variables used for representation of Temp-S. The y-axis value is a range between 0 and 1, respectively. The x-axis value is represented by a range between 0 and 100. Where the linguistic fuzzy variable low resides between 0 °C to 30 °C and medium variable resides in between the range of 30 °C to 45 °C. The linguistic fuzzy variable High is represented by the range from 45 °C to 100 °C; these values are based on the Universe of disclosure calculated for the temperature sensor (Temp-S) described in Table 3.  Membership Function for (Humidity-S) humidity sensor: In Figure 20 LOW, MID, High are the three linguistic fuzzy variables used for representation of Humidity-S. The y-axis value is given in a range between 0 and 1, respectively, for x-axis value is represented by a range from 0 to 30, where the linguistic fuzzy variable low resides between 0% to 6% and medium variable resides in between the range of 6% to 15%. The linguistic fuzzy variable High is represented by the range from 15% to 30%, these values are based on the Universe of disclosure calculated for the Humidity sensor (Humidity-S) described in Table 4. Membership Function for (Humidity-S) humidity sensor: In Figure 20 LOW, MID, High are the three linguistic fuzzy variables used for representation of Humidity-S. The y-axis value is given in a range between 0 and 1, respectively, for x-axis value is represented by a range from 0 to 30, where the linguistic fuzzy variable low resides between 0% to 6% and medium variable resides in between the range of 6% to 15%. The linguistic fuzzy variable High is represented by the range from 15% to 30%, these values are based on the Universe of disclosure calculated for the Humidity sensor (Humidity-S) described in Table 4.
Membership  Table 5. Membership Function for Time sensor SHORT and LONG are the three linguistic fuzzy variables used for representation of Time. The y-axis value is represented by a range from 0 to 1 respectively the x-axis value is represented by a range from 0 to 100. Where the linguistic fuzzy variable SHORT resides between 0 to 5 min and Long variable resides in between the range of 5 to 20 min. These values are based on the Universe of disclosure calculated for the Time described in Table 6.

Membership Function for Fire Chances
In Figure 20, LOW, MID, High are the three linguistic fuzzy variables used for repre-  Table 5.

Setting Up Fuzzy Rules on MATLAB Using Fuzzy Rule Editor
After the membership function has been defined, the next step is to define the fuzzy rule set in Fuzzy logic. IF-Then is the provided way to represent the rules and this can be configured in the MATLAB rules editor. In this purposed system, four fuzzy inputs are used, on which IF-Then conditions are applied to get the desired output. As a flame sensor is used to detect presence of flame, it's a Boolean value as displayed in Table 4; if the fire is present then our proposed system will move to the next step and the values of smoke, temperature, humidity and time will be recorded to determine the chances and intensity of fire. If the flame sensor gives a false value, then the system will not move forward to the next step and will continue to sense the presence of it. In our purposed system for fuzzy rule set we have 72 rules to check the intensity of fire with respect to time being short and long. On the basis of these results, the system takes action to handle the situation depending upon the intensity. If the output is low, our purposed system sends an alert. Table 6 demonstrates all the rules in the case when the time is short, and the smoke is not present, but the fire has been detected by the flame sensor, so the system has started to evaluate the condition based on the sensor values. In this table, as smoke is not present, the focus of rules is on Humidity-S and Temperature-S, and is described by Low, Mid and High. Rules for SMDD (in case of when time is long and smoke is not present): Table 7 is similar to Table 5 where smoke is not present and fire is detected by the flame sensor, but with one exception: these time rules are the representation of the system when time is considered "long" instead of "short". Membership Function for Time sensor SHORT and LONG are the three linguistic fuzzy variables used for representation of Time. The y-axis value is represented by a range from 0 to 1 respectively the x-axis value is represented by a range from 0 to 100. Where the linguistic fuzzy variable SHORT resides between 0 to 5 min and Long variable resides in between the range of 5 to 20 min. These values are based on the Universe of disclosure calculated for the Time described in Table 6. In Figure 20, LOW, MID, High are the three linguistic fuzzy variables used for representation of Fire-Chances. The y-axis value is represented by a range from 0 to 1, respectively, the x-axis value is represented by a range from 0% to 100%, where the linguistic fuy variable low resides between 0% to 25% value and medium variable resides in between the range of 25% to 55% value. The linguistic fuzzy variable High is represented by the range 55% to 100%

Setting Up Fuzzy Rules on MATLAB Using Fuzzy Rule Editor
After the membership function has been defined, the next step is to define the fuzzy rule set in Fuzzy logic. IF-Then is the provided way to represent the rules and this can be configured in the MATLAB rules editor. In this purposed system, four fuzzy inputs are used, on which IF-Then conditions are applied to get the desired output. As a flame sensor is used to detect presence of flame, it's a Boolean value as displayed in Table 4; if the fire is present then our proposed system will move to the next step and the values of smoke, temperature, humidity and time will be recorded to determine the chances and intensity of fire. If the flame sensor gives a false value, then the system will not move forward to the next step and will continue to sense the presence of it. In our purposed system for fuzzy rule set we have 72 rules to check the intensity of fire with respect to time being short and long. On the basis of these results, the system takes action to handle the situation depending upon the intensity. If the output is low, our purposed system sends an alert.  Table 6 demonstrates all the rules in the case when the time is short, and the smoke is not present, but the fire has been detected by the flame sensor, so the system has started to evaluate the condition based on the sensor values. In this table, as smoke is not present, the focus of rules is on Humidity-S and Temperature-S, and is described by Low, Mid and High.
Rules for SMDD (in case of when time is long and smoke is not present): Table 7 is similar to Table 5 where smoke is not present and fire is detected by the flame sensor, but with one exception: these time rules are the representation of the system when time is considered "long" instead of "short".

Safeguard Mechanisms Based on the Outcomes
In our purposed system, different safeguard mechanisms are placed and they are activated according to the situation. These mechanisms are described in Table 8 with their respective actions. For example, if the fire occurs and the outcome is slow, then an alert will be transmitted to the management about the presence of fire. In such a scenario where the output of fuzzy logic system is high, then the alarm will be activated, followed by an alert message sent to the management, and the water sprinkler will also be activated in order to get the situation under control. Air ventilation support is also provided in high chances of fire when such a scenario occurs where the high percentage of smoke is present and may result in suffocation. After we have calculated all the possible rules with respect to the SMDD sensors, the next step is to add these rules in the MATLAB rules editor. In the rule editor we provide with our inputs with a list of low, mid and high value, and an output with possible outputs to choose from and operation to apply either and/or this can be seen in the Figure 22.

High
Notification Alert/Fire Alarm/Water Sprinkler(Low)/Ventilation 4.5.6. Adding Rules Using Rules Editor After we have calculated all the possible rules with respect to the SMDD sensors, the next step is to add these rules in the MATLAB rules editor. In the rule editor we provide with our inputs with a list of low, mid and high value, and an output with possible outputs to choose from and operation to apply either and/or this can be seen in the Figure 22.

Results and Discussion
A total of 15 experiments were performed to evaluate the performance of a system when dealing with different intensities of fire ranging from low, medium, and high. Our system output result ranges from 0 to 100, in which on average our system detected between 10 to 84. Out of a total of 15 experiments, as shown in Table 6 results and visual presentation on three of the experiments are given from Figures 16-19 with chances of fire ranging between low, medium, and high.

Result Based on MATLAB Rules Viewer Fuzzy Logic
In Figure 23 the results for experiment 1 are discussed in MATLAB viewer. In the MATLAB rules viewer, we have four columns. The first column (Temperature-S), which represents the changes in temperature as sensed by the sensor, second column (Humidity-S) which represents humidity as recorded by the humidity sensor. The third column (Smoke-S) is for smoke value recorded by the smoke sensor. The fourth column is (Time) showing the values in minutes. The fifth column represents Fire-Chances. The Fire-Chances column describes the fire chances. As presented in Figure 16, recorded temperature (Temp-S) value is 10 • C. The recorded value of humidity (Humidity-S) is at 29% and the recorded value of smoke (Smoke-S) is at 0% Time is 10 min the output is 10.3% percent which tell the chances of fire are very low. According to our rules there is a need to alert the management.
In Figure 24 the results for experiment 2 are discussed in MATLAB viewer. In the MATLAB rules viewer, we have four columns. The first column (Temperature-S) which represents the changes in temperature as sensed by the sensor, second column (Humidity-S) which represents humidity as recorded by the humidity sensor. The third column (Smoke-S) is for smoke value recorded by smoke sensor. The fourth column is (Time) showing the values in minutes. The fifth column represents Fire-Chances. The Fire-Chances column represents the chances of fire. As presented in Figure 17, recorded temperature (Temp-S) value is 35 • C. The recorded value of humidity (Humidity-S) is at 10% and the recorded value of smoke (Smoke-S) is at 300 Time is 10 min the output is 55.8% percent which tell the chances of fire are very low. According to our rules there is a need to alert the management.
(Smoke-S) is for smoke value recorded by the smoke sensor. The fourth column is (Time) showing the values in minutes. The fifth column represents Fire-Chances. The Fire-Chances column describes the fire chances. As presented in Figure 16, recorded temperature (Temp-S) value is 10 °C. The recorded value of humidity (Humidity-S) is at 29% and the recorded value of smoke (Smoke-S) is at 0% Time is 10 min the output is 10.3% percent which tell the chances of fire are very low. According to our rules there is a need to alert the management. In Figure 24 the results for experiment 2 are discussed in MATLAB viewer. In the MATLAB rules viewer, we have four columns. The first column (Temperature-S) which represents the changes in temperature as sensed by the sensor, second column (Humidity-S) which represents humidity as recorded by the humidity sensor. The third column (Smoke-S) is for smoke value recorded by smoke sensor. The fourth column is (Time) showing the values in minutes. The fifth column represents Fire-Chances. The Fire-Chances column represents the chances of fire. As presented in Figure 17, recorded temperature (Temp-S) value is 35 °C. The recorded value of humidity (Humidity-S) is at 10% and the recorded value of smoke (Smoke-S) is at 300 Time is 10 min the output is 55.8% percent which tell the chances of fire are very low. According to our rules there is a need to alert the management.  Figure 25 is the representation of MATLAB Rules Viewer. In the Rule Viewer for our purposed system we have set up four columns as input and there is a fifth column which represents the outcome of the purposed system. The first input column as shown in Figure  26 is of a temperature sensor which shows the recorded value of temperature by sensor (Temp-S) and the value for it is set at 60 °C. The second column in the MATLAB result viewer is for the humidity, which is recorded and represented here by the (Humidity-S) sensor and the value for it is set at 5%. Respectively, the third column represent the recorded value of smoke by the (Smoke-S) sensor where the value for it is set at 305 and the fourth column is representation of time which is set at the value of 20 min. The fifth column, known as Fire-Chances, is the output column. In the MATLAB rules viewer, there is an option of setting the input values manually. At this point our system SMDD is complete. Built-in method for inference and defuzzification are used in the software. SMDD is ready to take the input values as fuzzy inputs as represented in Figure 24 (60, 5,30,10) are the input values entered for temperature, humidity, smoke and time, respectively. The composed output result, known as Fire-Chance, has been defuzzied using the central Defuzzification method which was implemented using MATLAB. As displayed in Figure 26 the output for the experiment 3 is 79.6%, which represents that the presence of fire chance is very high, and as the smoke value is very high, which might cause suffocation in order to provide further ascendance with an alert, alarm and water sprinkler human life support systems are also activated with a ventilation system installed in the building.  Figure 25 is the representation of MATLAB Rules Viewer. In the Rule Viewer for our purposed system we have set up four columns as input and there is a fifth column which represents the outcome of the purposed system. The first input column as shown in Figure 26 is of a temperature sensor which shows the recorded value of temperature by sensor (Temp-S) and the value for it is set at 60 • C. The second column in the MATLAB result viewer is for the humidity, which is recorded and represented here by the (Humidity-S) sensor and the value for it is set at 5%. Respectively, the third column represent the recorded value of smoke by the (Smoke-S) sensor where the value for it is set at 305 and the fourth column is representation of time which is set at the value of 20 min. The fifth column, known as Fire-Chances, is the output column. In the MATLAB rules viewer, there is an option of setting the input values manually. At this point our system SMDD is complete. Built-in method for inference and defuzzification are used in the software. SMDD is ready to take the input values as fuzzy inputs as represented in Figure 24 (60,5,30,10) are the input values entered for temperature, humidity, smoke and time, respectively. The composed output result, known as Fire-Chance, has been defuzzied using the central Defuzzification method which was implemented using MATLAB. As displayed in Figure 26 the output for the experiment 3 is 79.6%, which represents that the presence of fire chance is very high, and as the smoke value is very high, which might cause suffocation in order to provide further ascendance with an alert, alarm and water sprinkler human life support systems are also activated with a ventilation system installed in the building.  Figure 25 displays the surface viewer using MATLAB which shows the Fire-Chances it's the graphical representation of the result. The x-axis represents the value humidity. Yaxis is the representation of temperature recorded value and the output is represented using the z axis, as can be seen in the figure when the temperature increases and humidity decreases the chances of fire increases, and vice versa. All the experiments discussed in detail and the rest of the experiments that are performed are illustrated, with their observations and results in Table 9.    All the experiments discussed in detail and the rest of the experiments that are performed are illustrated, with their observations and results in Table 9.   Figure 25 displays the surface viewer using MATLAB which shows the Fire-Chances it's the graphical representation of the result. The x-axis represents the value humidity. Y-axis is the representation of temperature recorded value and the output is represented using the z axis, as can be seen in the figure when the temperature increases and humidity decreases the chances of fire increases, and vice versa.
All the experiments discussed in detail and the rest of the experiments that are performed are illustrated, with their observations and results in Table 9. Recorded results as represented in Table 6. In experiment 1 one the presence of flame is 1 and the temperature recorded is at 40 • C. Humidity is recorded at 18% by humidity sensor and smoke detected by smoke sensor is at a value of 233 while time is 5 min. The chances of fire are 27%, which is low, and the result is same as the actual outcome which means the accuracy is 100%. In experiment 2 the presence of flame is 1 and the temperature recorded is at 42 • C. Humidity is recorded at 15% by humidity sensor and smoke detected by the smoke sensor is at a value of 240, while time is 8.22 min. The chances of fire are 50%, which is Mid, the same as the actual result, and accuracy is 100%. In experiment 3, again the presence of flame is 1. The temperature recorded is at 45 • C. Humidity is recorded at 15% by the humidity sensor and smoke detected by the smoke sensor is at a value of 242 while time is 2.4 min. The chances of fire are 50%, the actual result is Mid, which is the same as the fire chances; accuracy is 100%. In experiment 4 value of the presence of flame is 1. Recorded temperature is at 39 • C. Recorded Humidity is at 18% as per the humidity sensor and smoke detected by the smoke sensor is at a value of 50, while time is 5.2 min. The chances of fire are at 27%, and the actual result is Low, which is the same as the fire chances; again, accuracy is 100%. As described in the Table 9 for experiment 5, the value of the presence of flame is 1. Recorded temperature is at 38.9 • C. Recorded Humidity is at 21% by humidity sensor and smoke detected by smoke sensor is at a value of 52, while time is 3.2 min. The chances of fire are at 10.1%, the actual result and the fire chances are the same, and representing accuracy is 100%. From experiment 6 to 15, some of them show Fire-Chances at Mid, some show Low Fire-Chances and in others Fire-Chances are high, but all of the results are the same as the actual outcome, which proves that our system is working according to defined rules described in detail earlier, and is also intelligent enough to detect fire while taking its intensity into account. The accuracy can be calculated for the SMDD by the following formula: where µ is the total number of accurate results and N is the representation of total number of experiments performed by applying the formula we get an accuracy of 100%.

Limitation of the Proposed Approach
The system purposed here has the ability to detect the presence of fire efficiently where it has a significant number of advantages. There are some limitations to the existing system. The advantages and disadvantages with the traditional system are given in Table 10. Table 10. Advantages of SMDD over traditional system.

SMDD Traditional Systems
• SMDD is cost effective.
• Image processing and infrared thermal detection-based solutions are quite expensive.
• Detects fire with multiple sensors.
• Tradition system mostly uses single sensors.
• SMDD provide human life support.
• Tradition mostly provides the facility of alarms and water support to control the situation.
• SMDD provide alarms facility with water sprinkler facility and also provide updated alerts to the higher management if situation gets too much out of control.
• Traditional system relaying on single sensor some time cannot distinguish between true and false fire occurring situation and start the alarms.
• SMDD doesn't require supervision it completely autonomous.
• SMDD can distinguish between false and true fire ignitions.

Limitations
Some of the limitations of SMDD are based on the area it is covering. The system is designed for houses and small offices. Accuracy may differ in bigger halls.
A flame sensor can also detect heat from the sun, so the purposed system accuracy can be affected by open areas, although it works perfectly for indoor facilities.

Conclusions
This paper presents a solution known as a Smart Fire Detection and Deterrent System (SMDD). Its basic purpose is to detect fire and utilize energy and resources to detect fire efficiently, unlike single sensor systems which might cause false alarm. Our system uses multiple sensors, which are temperature, heat, humidity and smoke. The results from these sensors are then analyzed and processed by the AI-based algorithm fuzzy logic. The results of the analysis are then used to perform alerts and support tasks depending upon the severity of the fire, such as while detecting the level of smoke in air. The system starts ventilation to avoid suffocation and also starts a water sprinkler that acts as a first line of defense until the fire department arrives. Simulation work has been carried out using MATLAB, the results of which are discussed in detail in this paper.