## 2 Materials and Methods
### System Design Requirements  
The project was developed using Microsoft Visual Studio Community 2022 (64-bit)-Current Version 17.7.5, along with a full suite of associated tools, including C#, ASP.NET MVC 5, and SQL Server Management Studio 19.1.56.0. The M5 Stack device was programmed using the Arduino IDE 2.3.3, leveraging the C programming language. The proposed IoT-based EAP is designed to meet specific requirements that ensure real-time data processing. M5 Stack is an IoT module using the ESP32 microcontroller with a compact design with built-in Wi-Fi and Bluetooth connectivity, a display, and a range of sensors and expansion modules, making it versatile for prototyping and developing embedded systems. M5 Stack employed in this research is produced by M5 Stack Technology Co., Ltd., Shenzhen, China. The M5 Stack device integrates the MPU-6050 sensor (manufactured by TDK InvenSense, Shenzhen, China), which has a range of \(\pm\)2 g, \(\pm\)4 g, \(\pm\)8 g, and \(\pm\)16 g for accelerometer readings and a full-scale range of \(\pm\)250, \(\pm\)500, \(\pm\)1000, and \(\pm\)2000 degrees per second for gyroscope measurements. The frequency of data collection is configurable, typically set at 100 Hz in the application, which allows for responsive data acquisition. For data transmission, the M5 Stack utilizes the Wi-Fi protocol to connect to the local network, enabling it to send data to the ASP.NET API hosted on Azure. This API manages the communication between the sensor data and the Azure SQL database, facilitating seamless data flow to the cloud for storage and further analysis. This choice of connectivity provides adequate bandwidth for the volume of data generated by the MPU-6050 sensor and is well-suited for real-time data processing. The MPU-6050 sensor provides high-frequency measurements of acceleration and gyroscopic data. In the setup, the latency is primarily influenced by the local network conditions and the Azure response time, which typically operates within a range of milliseconds, ensuring efficient data transmission. The data rate from the sensor set to 100 Hz allows for rapid updates without overwhelming the network capacity. The process of transmitting sensor data to the Azure SQL Database involves the M5 Stack sending HTTP POST requests to the ASP.NET API responsible for handling the incoming data. The main design requirements, presented in Figure 2, include:  
1. Real-Time Data Processing with High-Frequency Data Acquisition. The requirement is that the system must process data from the MPU-6050 sensor in real-time, capturing data at 100 Hz. High-frequency data collection detects rapid environmental changes, especially in applications like earthquake monitoring. The MPU-6050 sensor, configured to collect data at 100 Hz, provides frequent updates that allow the EAP to analyze subtle variations in acceleration and gyroscopic data. The backend architecture must support data ingestion and storage to handle this frequency, ensuring incoming data are processed immediately. Azure SQL Database and the Azure App Service API must be optimized for high-throughput performance, allowing continuous and reliable data streaming from multiple M5 Stack modules. 2. Scalable Cloud Infrastructure Using Azure Services. The requirement consists of that the platform must leverage Azure services that automatically scale resources based on workload demand, allowing it to handle fluctuating data loads without incurring unnecessary costs. The EAP data collection leads to variable data loads, particularly during seismic activity or in cases of frequent sensor measurements. Using Azure's auto-scaling capabilities, the EAP dynamically adjusts its computational resources to handle peak and off-peak times. Azure's serverless SQL configuration and App Service offer auto-scaling. This scaling capability ensures that the system remains responsive and handles increased loads during critical events while scaling down during inactivity to minimize operational costs. 3. Low-latency communication for Time-Sensitive Data Analysis.