A Smart WiFi Multi-Sensor Node for Fire Detection Mechanism Based on Social Network

— A small device with WiFi multi-sensing element is essential under a digital social century . This study aims to implement the hardware and the power of the algorithm with WiFi technologies. Notably, the multi-sensors have to re-inforce around a home area and support to any requirement in the term of digital society. This work focus to care at home security— on going to the fire detection with applying several technologies based on social networks. Firstly, the multi-sensor calibration used the calibration time, and the self-calibration used the Finite Impulse Response (FIR) filter. Next, the Full-Scale Kalman Filter (FSKF) helps to fill data and estimate the accuracy data. After that, a fire detection mechanism used Fuzzy logic to detect and sent alert messages over the term of IF This Then That (IFTTT) process. The home event changes the WiFi multi-sensor data. They took the data range effect to the fire proportion inside the home. Furthermore, The OFF-Mode is to reduce the power consumption suddenly the WiFi module sends the sensor data to the Cloud. If had a critical point, sent an alert message to social networks. Finally, the WiFi multi-sensor node has to use more than one same detector that it will be high stability and high accuracy.


Introduction
The objective of this work to develop a small device for fire detection with the best algorithm that should run over low-cost hardware with the automatic multi-sensor to check within the area.The small device has many technologies under two parts.First, there set the hardware and multi-sensor following saved cost will be low-cost.Second, to implement and design the algorithm to support the device to be highly functional.While the automatic device is running this will be checked and detect the environment as well.After that, they send the sensor data to the Cloud (Thingspeak.com)and alert message to a smartphone over the social network messenger.
Many kinds of literature told about the fire detection have used two types of device.First, they had used video and image processing [1] [2] [3].Another one, they used the single sensor such as frame sensor, smoke-CO sensor, or temperature sensor and humidity sensor [4] [5].Moreover, there had got and sent the data over the satellite, or the Global System for Mobile Communications (GSM) signal carries data.Some case of the review had processed over a local area such as a robotic survey [6].
The primary process of this study classifies and estimate the data when used multisensor and train the device to be the automatic processing.Most experiments corresponded to use fuzzy logic for fire detection mechanisms such as Vikshant Khanna and Rupivder Cheema (2013) [4], and A.K. Singh (2012) [5].Another case has been impressive the methodology to classify and estimate the sensor data.Ugur Toreyin (2009) has used the Learning Management System (LMS) active learning.His device runs automatically and set as well detection [1].Santosh and his friends (2016) had proposed Cardinalized Probability Hypothesis Density (CPHD) over the Gaussian to filter sensor data.They found the final result was independent of sensors ordering.They had reported the approximate product sensor filter was unstable and the number of sensors increases [7].If the system ran as long time and got more data--R.Olfati-Saber (2007), Greg Welch and Gary Bishop (2001) appropriated the Kalman filter to implement into the WiFi multi-sensor node and their work was stable [8] [9].
This work aims to develop a smart device with low cost, using the multi-sensor entirely performance under the best algorithm and run the device with a low power consumption based on the Cloud processing.Furthermore, the user can use or monitor the alert message on a smartphone over IFTTT process following the popularity of a social network messenger such as Facebook, Gmail, or Line notify.At last, this system used the MATLAB application to confirm and verify the accuracy of the rule-based and the fuzzy set to detect the fire probability under the surface graph-to confirm the accuracy of fire detection.The device restricted to execute the WiFi signal area.They are following the WiFi module, and a smartphone must open over the internet signal, at last, to receive the alert message and monitor sensor data in a Cloud service.This work has solved following the outline: ─ The Sensor calibration use on the calibration-time and the self-calibration run on FIR (Finite Impulse Response) filter.─ The Full-scale Kalman Filter (FSKF) use to classify and estimate sensor data.─ The Fuzzy logic should predict the fire detection in the house model.─ The OFF-Mode uses to keep the power consumption following the current sensing element and the last sensor data only to compare before setting delay and do not send data over the WiFi module every time.

Framework
This work proposed the methodology and developed the device that can detect fire.They send the alert message to a smartphone over the social network following Facebook, Gmail or Line notify.This system has two compatible parts.First, to set the hardware circuit and sensors.Second, to generate the best algorithm within a full option.
The system overview set with three sensors to detect the environment-a temperature in the unit of Celsius, a humidity data following the relative humidity (RH), and a smoke-CO check the air content.Next, the MCU should process under a smart device.They trained the condition of the automatic device.There are four main steps.First, to compare and set the sensors in the case of sensor calibration.Second, to classify and estimate the sensor data in the term of FSKF.Third, the sensor data got a prediction by the Fuzzy logic inference of the fire probability.The last step, the OFF-mode set to serve the WiFi module to trick data to the Cloud this case just to save the power consumption by comparing themselves.Furthermore, there use IFTTT processing to check and receive the alert message over the social network via a smartphone (see Fig. 1).

2.2
The hardware and circuit The hardware has used following a low-cost module and full the high performance.A temperature sensor, the AM2301 module is a digital temperature and humidity have calibrated with the digital signal output of the humidity and temperature combined sensor.This sensor is excellent quality, fast response and anti-interference ability.When this module, run as long time there are reliability and stability.A smoke sensor, the MQ7-CO module is the binary signal output with high sensitivity and excellent selectivity for CO.This module is a rapid response and reliable stability.All of these sensors have operated by the voltage between 3.3 -5 VDC.The GPIO connects the MCU-Smoke sensor used GPIO as A0, the Temperature sensor used GPIO as D5.
Many types of MCU has same the similar function such as Arduino board, ESP32, Raspberry-Pi, ESPresso lite or NodeMCU.The GPIOs connected with all of the analog signal and the digital signal.This work used the Arduino UNO and NodeMCU following two sensor module.There's got three data values.When they used the ESP01 module, they need to update the firmware to support the AT-command.

Fire Detection Mechanism.
After the device set with the sensor and any hardware.The sensor's data came to calibration processing-following the calibration-time and the FIR filter.Next, there used the FSKF-the Kalman filter to classify and estimate the sensor data.All of this state supports the data to be able to high accuracy and highly stable.The Fuzzy logic inference takes the main point of this study.There can detect and send an alarm message.After that, there send sensor data to the Cloud.The work uses Thingspeak.com and tricking the IFTTT to run over the social network into a smartphone (see Fig. 4).

2.4
The sensor detecting fire of the home model burn-up Subsequently, the WiFi module has set up in the house model.While the house model was burning, its got the sensor data to the Cloud.Let, fire burn-up 10%, 30%, and 60% (see Fig. 5-A, B, C).There were traveling along the timeline and discovered data in the Cloud over the WiFi module.
B: 30% of burn-up.C: 60% of burn-up.In this example, after laying out the WiFi module inside the mansion model, then the fire burn-up the module was detected and received the data values.Firstly, these values are satisfied by the FSKF.Next, these values have stuck to the fuzzy logic process and the OFF-mode to compare between the previous value and current value after they shipped it to the Cloud storage.
The several data range has set the prototype of the Fuzzy logic; it was the condition of rule-based.Afterward, there was taking the prediction of fire burn-up based on the Cloud to IFTTT process following the social network messenger.

Sensor calibration and validation activities
The calibration methodologies of this work as two calibration methods [11] to impulse and adjust the multi-sensor.Foremost, they are going down the calibration time following the dynamic time based on the amount of the sensor.Second, there use the FIR filter following the self-calibration to impulse the sensors to go nearly the truth in the short time.There is two-step as continuous running.
The Calibration time.All of the sensors have had to set the pinMode over the MCU.This case the MCU should acknowledge the module following the numeral of the sensor.Thus, there can use the millisecond time, during the term of milli()-the function is running following the summary variable time.They obtain the value of active high to the low state from the GPIO.Afterward, they are acquiring the value for the duration of GPIO they are set up to be the average time (see equation 1).Ultimately, there are causing the dynamic time like 12, 17, or 20 seconds up to the number of the sensor. Let: Self-Calibration to use FIR filter.Some of the sensors are required to warm up the module by themselves.The signals are not smooth, especially for the low-cost model.There took to an Analog-to-Digital Converter (ADC) which the input by x(n) to the digital low-pass filter and the output to be y(n) after there has engaged into the Digitalto-Analog Converter (DAC).These methods caught the best data signal [10].The sensor data set in the shape of the mathematic function and several algorithms [20] following digital filters to achieve virtually affect.
The FIR filter is a simple linear equation based on the digital filter.There processed on a discrete-time between the input signal and the impulse response data [9].This study used the 4-points moving average filter.
The condition of this point requires a one-multiplication, one-addition, and one-subtraction.The basic step had four pseudocode of the FIR filter: 1.The new samples allocate the detectors the signal at the high end.2. To set an outer loop to produce each sampling signal.3.There took the inner loop to multiply the coefficient filter by the input signal and adds to the running summary.4.There are shifting the previous input signal back in time within the number of the new signal has processed in this routine.
There are finding the Fourier transform of the output signal.These obtained the amplitude-frequency characteristic of the filter.After, there find the detector signal and store in the terminus of y(i).All of this filtering will be the self-calibration procedure (see equation 2).
Since 1960, R.E.Kalman has published his study of the discrete linear data filtering with a recursive solution [8].This method classified and estimated the data.Many kinds iJOE -Vol.14, No. 10,2018 of research have used this rule to apply for several works.Especially the digital computing [8] [9] [16] [20] has been utilizing this popular following a high technology.The Kalman filter set of the mathematic equations to provide an efficient recursive of computing mean.This filter is very potent and precise estimation following the truth data [13].
The discrete mathematics of the Kalman filter updates and represents the equations as: Thus, the time updates to the equation ( 3) and ( 4) the covariance state to estimates following of the time k-1 to k. Subsequently, the variable [A] and [B] update the value, while [Q] is treating the noise covariance with the normal probability [9].
While the measurement is updating the value, the Kalman gain calculates themselves, Kk-the equation has given as equation (5).Later on, this setup measures the procedure of the obtain Zk; then there are generating a posteriori state for estimate the measurement has occupied in the equation (6).Ultimately, this obtains a posteriori error of the covariance estimate following equation (7).The Kalman filter should accept the mixed value while it calculates upon consequence of the block-1.The Kalman gain is estimating following the MCU as the block-2.At the terminal, they convey the data to hold value in the shape of the block-3.The estimation error should get custody of the system and run to accuracy.
Let, Algorithm KalmanFilter:: correctData (sensorData) These graphs represented the measurement, and the Kalman filter was comparing and sending the best value to the system following Fig 7.

2.7
The Fuzzy logic application.
The Fuzzy logic decides to the best support tool within the insertion of the several data and the reason for human thinking [24].The Fuzzy logic process in the practice of the Boolean logic following the truth data.The accuracy is ambiguous between the true and the false.The fuzziness is called multivalence within the membership more than two values (Lotfi Zadeh, 1965).The Fuzzy processed with the degree of membership (DOM) -sticking with the crisp input, crisp production, input sets, and output sets [24].
The Fuzzy logic calculates in term of a crisp input suddenly they made a crisp output.While the crisp output is the Fuzzy logic terminology and the crisp input is accurate means.Subsequently, they should work out the DOM with each Fuzzy input set by using the linear interpolation.
The main point of Fuzzy is the knowledge in term of the rule-based this condition should predict the inference of the constitution.Later, the device sets inside the house  1 between smoke-CO and temperature, Table 2 between smoke-CO and humidity, Table 3 between temperature and humidity.The MATLAB application had several functions of data processing.It has used the Mamdani inference following the max-min and defuzzification of the Mean of Maximum (MOM).There are the antecedent x1, x2 for the input section and the consequent y-output.
The shape of the membership used to mix between Gaussian curve membership function (gaussmf) and bell-shaped membership (gbellmf) following the range of multisensor.
Gaussian membership function.The Gaussian function uses two parameters are {m, σ} that m is the average value and σ is the standard deviation [24].

𝑔𝑔𝑢𝑢𝑐𝑐𝑖𝑖𝑖𝑖𝑐𝑐𝑐𝑐𝑐𝑐(𝑥𝑥: 𝑐𝑐
Bell-shaped membership function.This type used three parameters there were {a, b, c} in the sets of the input value. − ℎ(: , , ) =  Rule of inference.The primary idea of Fuzzy logic is the blueprint of underlying theory for the vague reason.This agreement is called approximate reasoning by classical propositional calculus for some real term.Assume, the rule-based on the Fuzzy has shown antecedent-consequent form or if-then-form.

𝐼𝐼𝐼𝐼 𝑥𝑥 𝑐𝑐𝑖𝑖 {𝐴𝐴} 𝑐𝑐ℎ𝑐𝑐𝑐𝑐 𝑦𝑦 𝑐𝑐𝑖𝑖 {𝐵𝐵}
Where {A} and {B} is a fuzzy set Thus, {A} is a new antecedent and {B} is a consequence, it can find from "If x is {A}, then y is {B}".Setting the factor  ̇=  ̇ ° .The popular form should use maxmin composition and max-product composition.
The implied term sets the fuzzy relationship.The R based on If A, Then B or R =A→B, they are implicated and should be vague for all the reasoning of x and y (∀x ∈ X, y ∈Y) and this impleied term of the membership function of fuzzy R over the Cartesian product in term of X .Y: Let, the measure explains in Defuzzification.This state transforms the Fuzzy set to be a crisp member set.The crisp value is just a single output data value there should manipulate the organization.
The Central of Gravity: COG is the average point of the event following the approximate function.
Where N: the value between 1 to i, αi: the fuzzy output of the fuzzy set i, wi: the curve area of fuzzy i.After it got, the values of sensor-n should transform the output to alert the criticism of the fire burn-up.
IFTTT (IF This Then That): its processes over the internet working support a lifestyle about everything that people would like to know by using the basic condition as if statement.There are 122 channels such as Line, Email, Google Drive, Facebook, Espn, Philips Hue, Nest thermostat, etc.After setting the condition form on the website: maker.ifttt.com.https://maker.ifttt.com/trigger/{condition}/with/key/{api-key} To use this statement in the main loop and pass over the WiFi module.
Let, Algorithm: Fuzzy inference and IFTTT process.When the system is running, there cannot turn off the sensor.However, if there want to save the power consumption, there should control the multi-sensor with an OFFmode, entering from any state by removing the power state.When the sensor is in the iJOE -Vol.14, No. 10, 2018 sleep mode under the microcontroller, it becomes deficient, not more than one milli-Amp for any modules [6].
The multi-sensor approach for lowering power consumption (Low-power sensing, 2015).There is one of the lowest power states, this low-power operating mode of the main loop made of two parts -the setup and the loop processing.Hence, this type of sensor's operation has immediately held by the command state.
The MCU with sensors start are off entirely (same VDD = 0) in the OFF-mode.The sensors turned in a term of millisecond every minute and necessarily there is not the consummation of power.
Let, Algorithm: The OFF-Mode state of sensor for turning down power consumption

Result and Discussion
The result has a crisp number between {0, 100} which is a range of fire burn-up.The inference of fire is five groups.Let, the data defined to be [400 60 35], where the factor of input matrix represents smoke-CO, temperature, and humidity the output value of 75.4%.The system has to infer the fire is very high.
The surface view of the rule base is experimental to test input values of the sensors got the output 75.The MATLAB surface represented many colors from the top to the bottom shapeyellow, green, blue and purple.It had not overlapped to another color this implied there is stable, and accuracy following the ten rule-bases in more detail can check in term of the MATLAB reporting.
These registered with ifttt.comand set the condition of the maker.There used three makers -Line, Facebook, and Gmail.The trigger processed following: {https://maker.ifttt.com/trigger/fire_true/with/key/ dLwMDdfENiCUADYWD_UulE} There took this statement into the main algorithm.After that, the fire was burningup high or very high status this IFTTT processed and sent the message to a smartphone over the social network application.
After running the device, there were stable and satisfied following the nine parts of processing to evaluate with the fire burn-up in the house model (see Table 4).

Parts of process
Point of view.

The MCU Excellent
Sensor modules Normal-if run as long time these have a heat collection inside the module, should use the heatsink supported.

IFTTT process Excellent
Cloud-thingspeak.com Normal-this Cloud does not have various options such as a dashboard.

Smartphone monitoring
Excellent -to develop an application or use the general application.
Note 1).Excellent-these can run and process following the objective.
2).Normal-may change another type module and use another Cloud service.
The WiFi-module ran under the low-cost device and used a performance of WiFi technologies.The aspects of the hardware, there had run for a long time, there has a heat collection.While they are running for the aspect of methodologies, in term of preprocessing-the calibration of the sensor is smooth and suitable for all of this function.The main processing-the FSKF has got the best value.The ten rule-bases of Fuzzy inference they are suitable for fire detection.The OFF-Mode has helped to preserve the power consumption.The IFTTT processing got the warning data and sent an alert message over the social network.They are accuracy following the case of simulation.Moreover, can contain the status or several data in the Cloud.
This work got a smart device that can run as reality.It has constrained the WiFi limited, the IFTTT conditional, and a dashboard of the Cloud service.The training system selects this trial to represent the rule and the theories.There is a prototype device for the other works.

Conclusion
This work proposes the WiFi multi-sensor node with the three sensor data values and should be set to a smart device following the multi-sensor module to detect fire in a house.They used several of the functional systems and simulated with MATLAB based on the Cloud.It has approached more accurate.The calibration method depended on the quality of sensors device.The FSKF was stable and processed as well as a long time upon the main processing-inside the main loop function.The Fuzzy logic should hold a high accuracy of fire detection within ten rule-bases -maybe use more one sensor in the same type and change the rule-based to calculate the point or the fire direction.They will improve the accuracy of fire possibility as well as the false warning rate.The IFTTT process should set an execution from the medium range and send the message more time to a smartphone-for alert and warning message.This device can use to observe the forest fire by changing the WiFi module to the GSM module and modify some statement especially the AT-command.

Fig. 5 .
Fig. 5. A, B, C-the house model was burn-up while the device was running.
model suddenly the fire burn-up.The device is running it detect and send data to the Cloud passing by the FSKF within 40 delta time.The device finds the flame.It separated out by the FSKF and estimated for all processing.This case sets the fire probability to five levels following the three sensor modules-there was very-low, low, medium, high and very high.These trial got the data value 40 delta-time.The data have set the range of each module in term of[minimum, upper limit, average].Then, there were the Smoke-CO [338.69,820.00, 513.23], the Temperature [25.00, 64.50, 34.18], and the Humidity [27.80, 93.21, 70.18].The sensor values change the fire possible.They are five level sets between 0 to 100 and each group upon the remainder value of the three modules.The sensors classify by fire probability can set in the form of the average data matrix [Smoke-CO, Temp, Humidity].There was the fire Very-low [0, 25] = [363.95,26.65, 65.51], the fire Low [0, 50] = [557.09,26.74, 75.30], the fire Medium [25, 75] = [773, 28.37, 85.79], the fire High [50, 100] = [642.43,41.80, 87.80], and the fire Very-high [75, 100] = [463.19,59.20, 48].The matrices have set following the general rule-based on fire detectionsee Table

Fuzzification.
When the sensors detect the fuzzy should control the quantity of the error and rate of the error change following:

Fig 9 -
Fig 9-A-Let: the membership of the Smoke-CO had three levels-there were Low, Medium, and High.B--Let: the membership of the Temperature had three levelsthere were Low, Medium, and High.C--Let: the membership of the Humidity had three levels--there were Low, Medium, and High.

Fig. 10 .
Fig. 10.The Surface view of fire possibility between the Temperature and the Humidity.

Table 1 .
Between smoke-CO and temperature

Table 2 .
Between smoke-CO and humidity

Table 3 .
Between temperature and humidity

Table 4 .
To evaluate the fire detection mechanism system.