Inspiration

About 46 large earthquakes happen every single year around the world, and tons of tiny earthquakes happen almost every single hour. Between 1998 and 2017, 750 thousand people have lost their lives to earthquakes, accounting as over 50% of the total lives taken by natural disasters. A total of 125 million people have impacted in the same timeframe with brutal injuries, the loss of housing, and sometimes the loss of family/friends. And, what makes this worse, is that earthquakes isolate that specific area from the rest of the world. This means that the people who survived must immediately start rescuing those who fell victim to this natural disaster. Diverging from human lives, Earthquakes also lead to the destruction of many buildings. A strong example of this is the 2023 earthquakes in Syria and Turkey, which led to a collapse of 84,000 buildings. This displaces millions of people and sets the countries back YEARS in economic and technological progress. In the area where I live, there are tons of Earthquakes that are happening every single second. For example, the place that I live in faces over 1500 micro-quakes every single year. Living so close to the San Andreas fault, it makes it very necessary to have proper protection against Earthquakes. And, what is most surprising, is that despite all of the damage that earthquakes do, they still remain to be a very overlooked aspect in the world.

Hence, I wanted to solve this problem by providing users with a all-in-one system that limits the effect that earthquakes have on society. It automatically calls 911 when it senses danger to account for the isolation that occurs and it deems whether building's are structurally safe after earthquakes to ensure that no further lives are lost. Another main reason for this is due to the fact that earthquakes are major in California. As I apply for this challenge, I see that an earthquake has literally happened today morning about 43 miles from Fortuna, CA. Locally, earthquakes are a major problem, and it would be really useful to solve the harm that these natural disasters do to our community.

What it does

My app is an Native iOS app that is an advanced earthquake detection and safety platform combining physical hardware, real-world data, 3D simulation, and AI. It helps users detect earthquakes, understand their effects on buildings, monitor earthquake activity, and make informed safety decisions.

The Arduino Mega is connected to an accelerometer, motion sensor, sound sensor, and stepper motor. The three sensors detect unusual shaking and movement and send information to the Arduino. When an earthquake is detected, the Arduino activates the stepper motor, which rotates to symbolize shutting off water and electricity. I chose these utilities because electrical systems can become especially dangerous when water is present, creating additional hazards during earthquakes.

The 3D simulation demonstrates how a building could respond to earthquake forces. Building movement is exaggerated by 40 times so users can clearly see potential damage. Information such as building height, weight, and construction material is entered into a complex physics and mathematics calculator that determines how the structure should respond. The app calculates an estimated damage percentage and determines whether the building may be safe to re-enter. Additional calculations occur in the background, while a settings toggle allows users to view detailed numerical information.

The Map feature uses APIs including Tavily, Serper, OpenWeather, and Wikidata to gather real-world information. It combines this information into a large interactive map containing earthquake statistics and historical activity for different locations. The map can also identify buildings damaged by recent earthquakes and provide an estimated probability of future earthquake activity in an area.

The Home page summarizes information from other sections into clean, customizable widgets. Users can reorganize these widgets based on the information they want to see first.

The Network feature allows multiple hardware systems to communicate across a city, state, or potentially an entire country. When one system detects an earthquake, it can notify other connected households within the affected area.

The Feed provides a continuously updating tracker of earthquakes around the world, allowing users to monitor global seismic activity in real time.

The Library allows users to import real-world buildings into the simulator. APIs search for information about the building and provide statistics that can be entered into the physics simulation.

The Settings tab allows users to customize the app's background, haptics, and voice features. It also provides detailed explanations of the calculations, algorithms, and AI models used throughout the application.

The app supports Apple Login, Google Login, and traditional username-and-password authentication.

How we built it

I have designed and coded Seismic iOS app in Swift, SwiftUI, and Swift Package as a cross-cutting platform that unifies seismic-hazard detection, structural health monitoring, geospatial analysis, embedded systems, and three-dimensional simulation in a single engineering platform. The application is organized as seven distinct software modules called SeismicCore, SeismicSignal, SeismicGeo, SeismicStructures, SeismicDevice, SeismicData, and SeismicServices. Each module implements particular functions ranging from mathematical and signal-processing algorithms to structures analysis, device communication, data storage, and third-party services messaging. The overall design is aimed to decouple the algorithmic code from the application logic so that any algorithm could be validated in isolation without launching the iOS simulator.

I have designed a seismic signal-processing pipeline that implements a set of industry-standard algorithms. These include waveform conditioning, event detection based on short-term average/long-term average thresholding, matched filtering, power spectral density estimation with Welch’s method, spectral peak picking, Hilbert envelope analysis, damping estimation, and response spectrum calculation. The pipeline plots the spectrogram that visualizes the time-varying spectral content and illustrates the peaks’ prominence to extract the most prominent modes. In addition, three different natural period estimation approaches are implemented to provide an opportunity to compare the results of various methods side by side. All calculations are visualized in plots that help the user understand the process’s logic and see the data that influence the outcome.

To support structural health monitoring, I have implemented a pipeline that estimates temporal trends of the structure’s natural period, residual displacement, and tilt. To reduce the impact of temperature variations on the vibration frequency, a building-specific temperature-frequency regression is estimated for each building. To mitigate the effect of outliers, a robust regression with outlier detection is applied to the same data sets. To combine the trends and provide an overall assessment of structural performance, I have designed an evidence-based reasoning engine that utilizes multiple evidence sources and applies different weights and textual annotations to the outcomes of each process step. This engine generates a structural assessment and produces a confidence interval as an estimate of certainty about the structural performance. Furthermore, I have implemented a Coordinate Modal Assurance Criterion analysis that compares the structural characteristics in two different states and designed a structural response-analysis engine that evaluates the structure’s seismic response.

I have designed and coded an interactive three-dimensional building simulator that utilizes the building description and historic seismic trace to visualize the impact of ground shaking on the structure. The application allows the user to select a building of interest and explore the building’s description, analyze the seismic response, and compare the simulation traces. The simulator includes a visualization of the vibration modes, response spectra with a building-specific natural period, comparison of building frequencies, animated spectrogram, and audio version of the seismic trace with natural periods shifted up by six octaves to hear the fundamental tones.

I have built an Arduino MEGA 2560 sensor node that communicates with the iOS application over Bluetooth Low Energy using a custom protocol. The sensor node is designed to monitor ground shaking, tilt, sound, temperature, and occupancy with multiple sensors. The node implements a multi-sensor fusion algorithm that uses a two-out-of-three voting scheme, provides real-time telemetry, countdown visualization, audible alerts, transistor-controlled power relays, and a stepper motor driver for a water-main shut-off valve. The node records audio and motion data with MPU6050, senses tilt, sound, temperature, and occupancy, and transmits this information to the iOS app over Bluetooth serial lines using a custom protocol. The communication protocol uses newline-delimited JSON, and messages are protected by a checksum. Furthermore, the node utilizes a chunked recording approach with selective chunk retransmission upon request. The power-down state is monitored with a photoresistor to ensure that the power indicator switch is activated.

I have designed the geospatial module for earthquake mapping, network analysis, geometry operations, and source localization. The application utilizes USGS earthquake data, including aftershock forecasts, OpenStreetMap mapping data, and building data from Wikidata services. The network-inversion tools are implemented to localize earthquakes based on sensor data and illustrate the relative location of the earthquake and the sensor network. In addition, the application stores historical earthquake information, building data, and synthetic sensor data to provide an overview of the system’s capabilities when launched for the first time.

I have designed the system with persistent data storage, tamper-evident measurement logging, configurable API tokens for third-party services, an optional AI-powered analysis module, and a deterministic on-device narration system. The user interface is unified around a Live Activity and Dynamic Island countdown, real-time sensor visualization, community earthquake map, structural-health assessment panel, and automated walkthrough upon launch. I have written nine hundred and sixty-six tests across seven software modules to validate the correct operation of algorithms, interfaces, numeric calculations, communication protocols, data storage, and network-client behavior. The tests help ensure the reliability of each individual algorithm while building confidence in the overall design that ties together scientific computing, embedded systems, and structural-engineering algorithms.

Also, as a side note, we did use Claude for debugging and writing the code when the calculations involved complex differential equations and matrix calculations. Apart from that, overall most of the work was mine!

Challenges we ran into

Overall, this project lasted me a TON of continuous building, dedication, and tinkering to land upon a final result. Over this timeline, I faced MANY problems, and I will list the major ones here:

BLE Connection with Phone: I used a Bluetooth Low Energy to connect my hardware with my phone. One of the main errors was the data that was sent was bugged with errors. I spent countless hours re-working out the hardware because I believed that the issue was with the data being sent. However, the main problem was that the BLE kept cutting out some of the data because the numbers were too big to send. Hence, I had to use a system that would constantly rotate between sending data at rapid speeds. While this increased the tempo of the data being sent it prevented from data corruption and ensured stability.

Lag on Phone: This problem was created due to the solution of the previous problem. As the cycle occurred with fast reiterations, the constant data in my phone made the app lag. I once remember keeping the app open for 30 seconds and watching my phone crash as it was overwhelmed with the data that the Arduino sent. To fix this, I created a "middle" stage in the process of the data transfer. I figured much of the lag was happening with the rendering of the graph and the translation of the numbers if human-readable text. Hence, I made a "storage" space of the screen when the iPhone would store the raw numbers of the data. It would then slowly take data from that storage and compress it into chunks, which would then be translated into the graph and the sentences/statistics of information.

Simulation Spacial Rendering: For the early stages of the simulation feature in my app, I continuously tested and compared the simulations with those in another project that I have made. I constantly noticed errors in the motion and the output data. What happened was an error in the rendering of the data, and hence the simulation was skewed. To fix this, I made a separate hidden simulation that used spacial linear averages and regression lines to calculate the average structural points of the building. After finding those important points, I incorporated their 3D coordinates and the vectors of the force, and then used differential equations to ensure that the simulation was rendered accurately.

Accomplishments that we're proud of

One of my proudest achievements was evolving Seismic from an initial concept into a cohesive engineering platform that weaves together iOS-native development, embedded electronics, structural engineering, scientific computing, geospatial analysis, and artificial intelligence. Instead of an application that simply alerts the user to an earthquake, I designed an interconnected suite in which sensors detect seismic activity, algorithms analyze measurements, a 3D simulator acts as a test bed, and an evidence-based assessment engine compiles findings about likely building damage. My proudest achievement was bringing together these disparate fields of engineering into a unified application.

Another achievement of which I am particularly proud was designing the application’s scientific computing engine. Within Seismic, I implemented 74 algorithms for signal processing, structural engineering, statistical analysis, geospatial computing, and mathematical modeling. These include STA/LTA-based earthquake detection, matched filtering, Welch power spectral density, spectral peak picking, Hilbert-envelope analysis, damping estimation, response-spectrum calculation, and COMAC analysis. In addition, I implemented three independent algorithms to estimate a building’s natural vibration period. Rather than presenting the user with an unexplained number, I provided interactive visualizations that exposed the underlying waveforms, spectra, peaks, and calculations.

I am also incredibly proud of the contribution that I made to Seismic’s structural health monitoring system. Rather than use a naive approach that relied on a single metric, I designed an algorithm that used diverse lines of evidence to evaluate buildings. First, I implemented a temperature-frequency regression model that accounted for temperature-induced shifts in resonance frequencies. Second, I applied statistical techniques to remove outliers. Third, I designed an evidence-based assessment algorithm that weighted natural-period shifts, residual displacement, and tilt meters. With this approach, I provided interactive explanations for every metric while estimating the likelihood of damage with a confidence interval. In doing so, I had to reconcile mathematical precision with real-world engineering intuition.

Another accomplishment that I made was designing the application’s interactive 3D simulator. Within the application, I designed a system that allowed the user to load building models, query building information, select past earthquakes, and view the resulting response. In addition, I implemented visualizations of vibration modes, response spectra, animated spectrograms, and comparisons of natural frequencies. In addition, I synthesized an audio representation of the building’s vibrations by virtue of shifting its natural frequencies up six octaves while preserving amplitude ratios. Finally, I tied together these disparate elements into a simulator that allowed the user to interact with the building model and grasp the connections between building response and earthquake physics.

I am also proud of the contribution that I made to the software-hardware integration that powers Seismic. In particular, I designed the sensor fusion logic that feeds into the application’s analysis engine. Specifically, I fused together the data from an accelerometer, tilt switch, sound sensor, thermistor, photoresistor, and occupancy sensor in a custom sensor array. A microcontroller within an Arduino MEGA 2560 acted upon this information and communicated with the smartphone over Bluetooth Low Energy. In particular, I implemented a custom newline-delimited JSON-based protocol that allowed the smartphone to process sensor data, receive seismic recordings, send countdown information, provide alarms, manage power switching with transistors, and control stepper motors that emulate utility switches. Perhaps my most creative contribution to the system, however, was implementing photoresistor feedback to the smartphone in order to verify that the on/off state of the power indicator has changed.

In addition to the application itself, I am also incredibly proud of the seven software modules that comprise it. These independent modules manage the core mathematics, signal processing, geospatial analysis, structural health monitoring, device communication, persistence, and services that power the application. In addition to developing original algorithms, I also integrated USGS earthquake feeds and aftershock forecasts, OpenStreetMap maps and building information, historical earthquake data, and local demonstrations. Finally, I designed the application to demonstrate its core capabilities without API keys or external service access by virtue of local data and demonstration data sets that populated the simulator at launch.

Finally, I am proud of the work that I did to implement the application’s automated testing framework. The application’s test suite contains 966 assertions across all seven modules. In addition to testing core algorithms, I also performed unit tests and visual assertions across the app’s mathematical, signal-processing, geospatial, structural health monitoring, data persistence, and device communication modules. Furthermore, I implemented automated demonstrations that tied together the building simulator, earthquake sequences, hardware telemetry, building response, and geospatial analysis. All in all, my contributions to Seismic went well beyond simply designing an application. By virtue of my work, I built an end-to-end engineering platform that touches upon diverse fields of mathematics, electronics, software development, and real-world earthquake preparedness.

What we learned

There were many things that I took away from participating in the Congressional App Challenge. Many of the items that I took away were technical, but some were also non technical.

Technical: On this journey to making this project, I learned a lot about coding. When I say a lot, I mean a LOT. Although this seems pretty-obvious for a App Challenge, I learned the many wonders of coding native iOS apps, initializing a Google Sign-in, setting the live data from the app into servers from Supabase, and using the various API's and learning about their functions. Also, I learned how to do much more complex projects with the Arduino including using capacitors, resistor chains, and displays to show information. Last but not least, another major technical item that I learned was how to establish connections between the hardware and the software using a BLE.

Non-Technical: I always thought that making an app was something simple. Something that could be done in days, maximum weeks. However, making this application took months for me and it goes to show the true dedication that all the engineers around the world take. The true dedication that it takes to make all of these projects. Each application on app store was made by countless developers, each website on the internet was made by countless developers, and an OS or a computer itself was made by countless of developers. Making hardware and software applications truly takes a next-level of dedication from the human race. Additionally, I learned more about the statistics and physics of earthquakes. I spent a lot of time simply researching information about the effects of earthquakes and the causes of earthquakes. To make this app, I had to use many of my learnings about earthquakes like the rhythmic frequencies, the structural integrity of buildings and many other calculations.

Overall, while making this project gave me many teachings about the technical side, it also gave me a lot of learning on the other side. In addition to learning more about coding and hardware, I also learned more about earthquakes and the effort that it takes into making applications. This truly was a beautiful learning experience for me and I would definitely do it again.

What's next for Seismic

Overall, though this application was complex, I still believe there is tons of room for improvement!

Worldwide Accessibility: Currently, all the words and sentences of my application are in English. This is mainly because the API is only accurate in English and the built-in algorithms are only meant to work in English. If this application was meant to work for the entire world, I would need to ensure that there are multiple language features in the application. I would also hope to include many native dialects for the languages so that this application is open to everyone around the world.

Hardware/Arduino Appearance: Currently at this point in time, the Arduino side of the project looks like a jumble of wires. It appears very hard to differentiate the connections and identify errors in the problem. If I had access to a 3D printer, I would CAD (computer-aided design) a container that could organize the position of the sensors, sort and position the wires to ensure easy connection readability, and protect the device from any external forces. If I ever want to monetize the hardware, I would have to ensure that it comes in a proper package and ensures a 100% success rate of wire connections and other sensor functions. Also, currently the Arduino remains connected to my MacBook. To ensure the Arduino's easy mobility, it must be connected with a battery that is preferably rechargeable. Also the Arduino must send signals to the phone to recharge the battery whenever it feels that the power is low.

Hardware/Software Connection: As of right now, the connection between my Arduino and my iPhone is pretty weak. I would have to figure out a way to ensure that the connection between the 2 can remain strong throughout the whole house, and even maybe the neighborhood. Sometimes after shutting off my iPhone, the connection with the hardware disappears. This simply cannot happen as that would mean that closing your phone completely destroys the Arduino's purpose. I would have to use devices apart from Bluetooth to ensure a long range and stable connection.

UI/App Fixes: Currently the functionality of the app is perfect in my opinion and I cannot find any flaws. However, other people might have other preferences and would sometimes consider the UI as overwhelming. Hence, I believe I must clean up the UI a bit to ensure higher readability for the user.

Built With

  • applesign-in
  • arduinomega2560
  • bluetoothlowenergyble
  • c++
  • cerebrasapi
  • coremotion
  • firebaseconsole
  • geminiapi
  • googlecloudconsole
  • googlesign-in
  • ios
  • json
  • mapkit
  • openweatherapi
  • restapiintegration
  • scenekit
  • serperapi
  • supabase
  • swift
  • swiftpackagemanager
  • swiftui
  • tavilyapi
  • usgsearthquakeapi
  • wikidataapi
  • xcode
Share this project:

Updates

Submission history