Smart Earthquake Disaster Prevention System

1College of Engineering, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 2Department of Civil Engineering, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 3Department of Computer Science & Information Engineering, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 4Department of Architecture and Urban Planning, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 5School of Urban and Environmental Science, Huaiyin Normal University, No. 111, ChangJang West Road, Huai’an City, Jiangsu 223300, China


Introduction
Earthquakes are the shaking of the ground caused by vibrations at or beneath the surface layer of Earth, and they can be induced by crustal movement, volcanic activity, and meteorite impact. Major catastrophic earthquakes in history were mostly caused by abrupt crustal movements. Geological disasters have always affected the development of human society and economic progress. (1,2) Taiwan is located on the Ring of Fire (a seismically active zone) and at the junction of the Philippine Sea Plate and the Eurasian Plate; thus, earthquakes are frequent in Taiwan. (3) The geological conditions of a region determine the characteristics of ground vibrations and the corresponding event severity. The same earthquake can result in different outcomes in different regions because of the distinct geological characteristics of these regions. (4) Between 1998 and 2017, geophysical disasters resulted in 1.3 million deaths globally, with 4.4 billion people injured, homeless, or in need of emergency assistance. Although most disasters (91%) are caused by extreme weather, which is being exacerbated by climate change, the disasters caused by earthquakes result in more casualties and economic losses than do other events. (2) Even with technological advancements, the times and locations of earthquakes cannot be accurately predicted. However, information on the epicenter, depth, and intensity of earthquakes can be determined from seismic waves. For example, the distance from the epicenter can be calculated by analyzing differences in the arrival time of primary (5) and secondary waves. (6) In this study, a web crawler system was used to instantly access earthquake data published by the Central Weather Bureau (CWB) and calculate the epicenter distance, arrival intensity, and arrival time. Accordingly, effective disaster prevention measures can be implemented to reduce the impact of strong earthquakes.
During past earthquakes, prevention measures could not be implemented in advance because earthquakes could not be predicted, which resulted in casualties and deaths. In this study, we used the earthquake data published by the CWB to calculate the epicenter distance and other information. If the earthquake intensity is expected to reach a dangerous level, the following actions are automatically implemented: A. Earthquake warning information is published on the CWB seismological center website.
Then, information on the epicenter location, depth, and magnitude of the earthquake is immediately captured. B. The arrival time and intensity of the seismic waves of the earthquake at a location are calculated. If a strong earthquake is predicted, gas blockers are immediately activated to turn off the gas supply. C. If residents are detected to be at home, an alarm is immediately activated, and earthquake information is instantly displayed. In addition, doors are automatically opened to prevent residents from being stuck inside. D. Signals are sent to elevator control centers to control the operation of elevators. Elevators are stopped at the nearest floor, and the doors are opened for evacuation. Thus, casualties and property loss from earthquakes can be reduced.

Literature Review
In recent years, the CWB has constructed a highly dense earthquake observation network across Taiwan, and the sensitivity of earthquake monitoring equipment has considerably increased. However, problems frequently occur when publishing seismic intensity information in earthquake reports, which cause trouble for related units. For example, even when small-scale earthquakes occur, an extremely large seismic intensity is observed at observation stations near the epicenter. Consequently, disaster rescue units cannot accurately determine the ranges and levels of potential earthquake disasters from the distribution of seismic intensity immediately after earthquakes. Thus, disaster rescue manpower and resources cannot be dispatched effectively. The range of peak ground acceleration (PGA) (7,8) for current seismic intensity levels over level 5 is overly large, which reduces the efficiency of disaster rescue units and public units in taking response actions. (9)

Seismic intensity classification in Taiwan
To resolve these problems, the CWB referenced classification systems and calculation methods in Japan and the United States and formulated a new earthquake seismic intensity classification method in 2009. The modifications of the methods in Japan and the United States include the following: The Japan Meteorological Agency: (10) The duration of the amplitude is considered to avoid overestimating seismic intensity. In addition, the PGA ranges of levels 5 and 6 are overly large; thus, seismic intensity is further classified.
The United States Geological Survey: (11) To strengthen the correlation between seismic intensity and disasters, PGA is first used to calculate seismic intensity. If seismic intensity is over level VII, then it is calculated using peak ground velocity (PGV) instead.
To strengthen the correlation between earthquake seismic intensity and disasters, improve the efficiency of earthquake responses and disaster rescues, and consider the correlation between the new seismic intensity classification and the former classification system, the CWB adjusted the seismic intensity classification and modified the calculation method for seismic intensity. PGA and PGV are considered simultaneously to allow response units to determine the earthquake seismic intensity more conveniently and faster. Accordingly, the new version of the earthquake seismic classification table does not list the PGA ranges but again uses the basic definition of seismic intensity. In addition, at high seismic intensity levels, level 5 is further classified into weak 5 and strong 5, and level 6 is further classified into weak 6 and strong 6. Thus, related units can use the information more effectively. Disasters from earthquakes are often inevitable. However, if plans are devised beforehand and are executed properly when earthquakes occur, disasters can be minimized.

Related work
A. Detecting and responding to earthquakes Lee et al. have evaluated different sensors as acceleration sensors to develop an earthquake warning device. To detect earthquakes, they used a simple machine learning technique. This technique trains earthquake detection models through daily motion data, noise data in buildings, and earthquakes recorded in the past. The earthquake warning device can detect an earthquake and send a warning message to nearby devices, thereby actively responding to the earthquake. (12) B. Active disaster response system (ADRS) The CWB has set up real-time warnings of strong earthquakes. These use early seismic wave data observed by seismic stations near the epicenter to quickly calculate the size, location, and depth of the earthquake, from which information such as the earthquake intensity and the arrival time of the earthquake in the region are estimated. Then, using fast communication technology, it rapidly notifies each area of the estimated earthquake intensity and the arrival time of the earthquake before the arrival of the destructive earthquake wave (S wave). If the warning of an imminent strong earthquake arrives faster than the S wave, the relevant area can obtain an early warning, giving them several seconds to tens of seconds to respond. This is currently the most effective earthquake disaster reduction technology. Lin et al. have developed an ADRS. When an earthquake happens, this system can read earthquake messages released by official agencies and activate devices to achieve emergency tasks. When an earthquake happens, the CWB publishes Common Alerting Protocol warning messages. The messages are received and read by Tibbo boards in a home. If the messages indicate that a strong earthquake is coming, the devices of the ADRS will spontaneously execute emergency tasks, such as opening doors, cutting off power and gas, and so on. (13)

Programming tools
The programming languages and compilers that were used in this study are described as follows: A. Python Python (14) is a widely applied interpretive, advanced, and universal programming language. The first edition was released in 1991. It can be viewed as an improvement of Lisp and adds some advantages from other programming languages such as the object-oriented property. The design philosophy of Python emphasizes code readability and concise grammar (particularly by using space indents to divide code blocks instead of using big parentheses or keywords). Compared with C++ or Java, Python allows developers to use less code to develop programs. Regardless of the size of the program, the language makes the structure clear and understandable. (15) Python is a multifunctional programming language and completely supports object-oriented program designs and structuralized programs. Python is a completely objectoriented language, and functions, modules, numerical values, and strings are all objects. In addition, inheritance, overload, derivation, and multiple inheritances are completely supported, which is helpful for strengthening the reusability of source codes.

B. Thonny
Thonny (16) is an integrated development environment that was developed by the University of Tartu. It supports step-by-step code execution, which allows program developers to detect the values of variables in different stages step by step. This concept model explains quotation and stacking through visualization, which allows Thonny to be used as a Python-integrated development environment that is suitable for beginners.

Smart Control Mechanisms Used in This Study
The function of smart buildings is enabled by activating related control mechanisms through control panels and programs after data are collected in a living environment from different types of sensors. This enables warning notifications and adjustment to physical environmental values to construct a safe, comfortable, and pleasant living environment. (17)(18)(19) In this study, the following components and controllable facilities were used to control hardware and issue warnings.

A. Buzzer
A buzzer (Fig. 1) is a device that generates sound signals and is powered by direct current. After connection with a signal source, the sound signal current passes through an electromagnetic coil, which causes vibration diaphragms to vibrate periodically to generate sounds. After receiving information on an upcoming earthquake, the buzzer can generate warning sounds to inform residents that a strong earthquake is approaching. Thus, they can implement necessary measures.

B. Door lock
When information on a strong upcoming earthquake is received, the system opens the locks of doors automatically (Fig. 2) to prevent door frames from being deformed under pressure from the earthquake or door leaves from being stuck. This prevents people from being trapped in their homes or emergency personnel being unable to enter homes for rescue.

C. Gas blocker
When information on a strong upcoming earthquake is received, gas blockers are activated immediately (Fig. 3). The gas switch is rotated 90° clockwise to cut off the gas supply to prevent fires that are caused by gas leaks from strong earthquakes. Thus, residents' safety can be ensured.

D. Display
The display used in this study is a 1602/16×2 liquid crystal display (LCD) monochrome character display module (Fig. 4). It displays the earthquake intensity and counts down the incoming time in seconds.

E. IFTTT
If This Then That (IFTTT) (20) is a service that allows users to construct an activity trigger on a component that executes a mission rule on another component. Recently, numerous such services have appeared. This type of service can be used in website connections, application procedures, commercial services, and even equipment such as telephones and family automation equipment. This allows millions of possible combinations of rules, triggers, and actions. (21) F. LINE notification system LINE communication (22) has become massively popular in recent years in Taiwan and other countries because of its online communication functions and the convenience of forming chat groups. It features one-on-one conversations and convenient group chat functions. LINE can be installed on smart phones and a PC version is also available. This communication platform allows the transmission of text, pictures, and videos. Communication and responses to topics in groups make it an extensively used tool for community communication and management. The IFTTT platform was used in this study. If an earthquake occurs, its information is transmitted to users and groups on LINE.

G. Relay
A relay (Fig. 5) is an electronically operated device that has a control system and a controlled system. It is often applied in automation control circuits. It typically uses an automatic switch that controls larger currents by using smaller currents. It contains automatic regulation, safety protection, and circuit switch functions.
H. D1 Mini control board D1 Mini (Fig. 6) is a single-chip development board that can be considered as a small computer. It can execute program calculations and procedure operations. It obtains information from external electronic components from the input and output pins on its two sides and controls the operation of external electronic components. In addition, D1 Mini connects to the Internet through Wi-Fi. It can transmit electronic component information outward, and remote control can be implemented using D1 Mini. The pins of D1 Mini and their functions are listed in Table 1.

I. Human body sensing detector
The proposed system uses an RCWL-0516 microwave radar human body sensing module (Fig. 7) to detect whether a resident is at home. The module uses Doppler radar technology  that specifically detects the movement of objects. It is characterized by high sensitivity, a long sensing distance, strong reliability, a large sensing angle, and a wide power supply voltage range. The performance and penetration detection capability of this sensor are better than those of traditional PIR sensors. Its sensing distance is 5-7 m and it can be widely used in various human body induction lighting and anti-theft alarms.   J. System control program We used Python (Fig. 8) to develop the system control program, which has the following functions: (a) Monitor the seismological center website (Fig. 9) of the CWB for information updates. (b) Immediately retrieve newly published earthquake information, including the epicenter, depth, and intensity. (c) Determine the system location. (d) Calculate the distance between the earthquake and the system, the intensity where the earthquake occurs, and the remaining number of seconds. (e) Activate the warning signals, control devices, and protection measures if the intensity of the earthquake is higher than the preset threshold.

Simulation scene design
In this study, we employed potential earthquake scenes to explore the execution of the proposed system. New earthquake information only appears when earthquakes occur. Consequently, the earthquake epicenter location, depth, and intensity can only be inputted manually to replace data captured from the seismological center of the CWB. A LINE notification system was created in advance. When an earthquake occurs, the system automatically transmits LINE messages to remind residents to adopt suitable evacuation measures.

System structure and wire information
The components and wires that were used in this experiment are displayed below. Every component was tested for its function before use. After the functions were verified, the development board and all components were installed onto the prototype board (Fig. 10). Then, testing, adjustment, and error detection were conducted for the prototype system functions.

Establishing LINE notification system
Earthquake information is sent through LINE messages to cell phones via the webhooks (23) of the IFTTT. The communication platform can transmit text, pictures, and videos. In addition, the communication and responses by people in LINE groups provide a tool for community communication and management. The IFTTT platform is used to quickly transmit information from different sensor components in smart homes to related users and groups.

Establishing earthquake warning system
In the proposed system, the Internet Protocol that is obtained from Wi-Fi connections in advance is used to control the control board B by using control board A. Control board B mainly activates gas blockers, opens doors, activates sound and light warnings, and notifies elevator control centers. Control board A mainly turns control board B on and off. After preparation, the results of the earthquake warning system can be seen. First, the activation and closing of the nearest control board were inputted, and the intensity and number of seconds remaining before the arrival of the earthquake were shown on the LED display.

Results
The proposed system framework is displayed in Fig. 11. The center images in Fig. 11 illustrate the D1 Mini control boards, in which the system programs designed in this study were installed. The first D1 Mini uses Python for data capture and calculation through the web crawler method. The human body detector is used to detect whether residents are at home. When a strong earthquake is about to strike and residents are at home, doors are opened and an alarm message is sent to notify residents to take appropriate evacuation measures. In addition, the second control board is used to control switches, open gates, and cut off the gas to realize an automated and smart scheme. The system transmits earthquake information to users' LINE accounts to provide them with the latest information on earthquakes.
The experiment verified that when the system detected an earthquake, and the intensity of the earthquake was predicted to exceed the preset threshold after it arrived at the location, the system immediately executed the following actions: A. The earthquake intensity and estimated arrival time in seconds were shown on the display (Fig.  12). B. The gas blocker was activated if residents were detected at home (Fig. 13). C. The gate was opened (Fig. 14). D. The sound and light warning system was activated. E. When the building has an elevator, the system sends a signal to the elevator management center to stop the elevator at the next floor and open the elevator door to allow people inside the elevator to evacuate.

Novelties
The novelties of this research include the following: A. The proposed system can automatically detect seismic data from the CWB at any time and calculate the intensity and time of arrival at a location as soon as there is an update, overcoming the original limit on the amount of information released from the CWB. B. The earthquake intensity and transmission time calculated at each calculation point are individually calculated, thus avoiding the problem of large-scale and inaccurate approximate values originally issued by the CWB. C. The system can open doors only after the human body sensing detector detects that residents are at home, so as to avoid possible theft from residents who are not at home but whose front door has automatically opened. D. The system can automatically notify elevator control centers. When there is a possibility of a strong earthquake, it can take charge of the elevator operation, stop the elevator at the nearest floor, and open the elevator door, allowing people to evacuate and minimizing possible disasters.

Discussion
Part of the content of this research is the same as that of Lee's team. (12) After detecting earthquake information, both systems can send a warning message to nearby equipment, and the connected smart home equipment (such as the gas supply) is automatically cut off. However, their system does not inform the user of the number of seconds until the earthquake will arrive or provide an automatic door opening function to prevent the door frame from jamming and hindering the evacuation of residents. A jammed door would also prevent outdoor emergency personnel from entering homes, seriously affecting the search and rescue function. Moreover, Lee's system does not have the capability to take over the control of elevators.
Lin's team's system (13) used the CWB's earthquake early report software to release data. The early warning time limit of the earthquake early information notification software is about 20 s before the earthquake. The alarm threshold is set by each receiving terminal to set the local seismic intensity threshold. Only a single computer device emits audio and video alarms, making its benefits relatively limited. It only uses the servers of the CWB to provide services. There are also certain limitations in its hardware and network resources. At present, it can provide only thousands of receiver connections, and it is difficult to implement comprehensive and extensive earthquake reports. In the proposed system, dynamic seismic data are obtained from the CWB, which will not impose too much burden on the server. In theory, there is no limit to the number of users that can retrieve data. Each application unit accurately calculates the number of seconds remaining until arrival and the estimated intensity from the distance from the epicenter, the depth of the earthquake, and geological data. This system can be used throughout Taiwan to achieve a good earthquake disaster prevention effect.

Conclusions
We used Internet of Things components to develop a smart earthquake disaster prevention system. After the system framework design, hardware connection, program development, functional tests, and inputting of simulated earthquake information, the proposed system was verified to function normally. The contributions of this study include the following: A. The proposed system can automatically retrieve instant earthquake warning information from the CWB. In addition, the arrival time and intensity of a location can be calculated from the location and intensity of the earthquake. B. If the earthquake is judged to be strong enough to damage buildings and endanger residents, the gas supply can be cut off immediately to prevent fires from broken gas pipelines. C. If residents are at home, the sound and light warning system is activated immediately to display earthquake information and notify residents of necessary protective measures. Door locks are automatically unlocked, and doors are opened to prevent the door leaves from being stuck during strong earthquakes, hindering residents' evacuation. D. Information on strong earthquakes is sent to elevator control centers to control elevators in buildings. Elevators are stopped at the nearest floor, and the elevator doors are opened. Elevator usage is thus controlled, and information on upcoming strong earthquakes is broadcast to notify residents of evacuation measures. Thus, casualties and property loss can be reduced.
In the current Internet era, the prevalence of Internet of Things applications is rapidly increasing. Numerous updates are being implemented in traditional industries to develop automatic and smart features. The smart building concept is being gradually developed and explored in the construction industry. The proposed smart earthquake disaster prevention system can be installed in new and existing buildings. The designed functions are not limited to door access control but can also be used for home security and industrial intelligentization.