# aswina1636/earthquake-detection-system architecture

> Architecture diagram of the GitHub repository aswina1636/earthquake-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aswina1636/earthquake-detection-system
- Repository: https://github.com/aswina1636/earthquake-detection-system

## Overview

This repository packages an Edge Impulse on-device inference library for an ESP32 earthquake-and-fire alert system. The documented user workflow samples accelerometer and temperature data, extracts features, classifies hazards, smooths seismic detections over time, and activates alerts and safety outputs. The tree primarily contains the generated model and inference runtime, not the application sketch described in the README, so application-side control and hardware behavior are shown as documented but unlocated. Runtime relationships are limited to those supported by excerpts, the source index, or README statements.

Main entry points: [`ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h`](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h) (Classifier API), [`ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/tflite-model/tflite_learn_793663_3_compiled.cpp`](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/tflite-model/tflite_learn_793663_3_compiled.cpp) (Compiled model), [`ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h`](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h) (DSP extraction), [`ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/engines.h`](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/engines.h) (Inference engines)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Sensing inputs"]
  node_sensors["MPU6500 + DHT11"]
end

subgraph group_inference["Inference pipeline"]
  node_feature["Magnitude feature"]
  node_voting["Temporal voting"]
  node_classify["Classifier API"]
  node_dsp["DSP extraction<br/>[ei_run_dsp.h]"]
  node_dsp_math["DSP math<br/>[numpy.hpp]"]
  node_engine["Inference engines<br/>[engines.h]"]
  node_metadata["Model metadata<br/>[model_metadata.h]"]
  node_postprocess["Result postprocessing"]
end

subgraph group_runtime["Embedded runtime"]
  node_model["Compiled model"]
  node_tflite["TensorFlow Lite Micro<br/>[common.h]"]
  node_micro_context["Micro context<br/>[micro_context.h]"]
  node_tensor_types["Tensor interfaces<br/>[common.h]"]
  node_cmsis_types["CMSIS DSP types<br/>[arm_math_types.h]"]
  node_cmsis_nn["CMSIS NN kernels<br/>[arm_nnfunctions.h]"]
end

subgraph group_response["Hazard response"]
  node_thresholds["Hazard thresholds"]
  node_recovery["Recovery classifier"]
  node_display["OLED status"]
  node_alarms["Relay + buzzer + LED"]
  node_sms["CircuitDigest SMS"]
end

node_operator(("System operator"))
node_wifi(("WiFi network"))

node_operator -->|"monitors"| node_sensors
node_sensors -->|"provides readings"| node_feature
node_feature -->|"feeds samples"| node_voting
node_voting -->|"confirms hazard"| node_thresholds
node_sensors -.->|"supplies inference data"| node_classify
node_classify -.->|"extracts features"| node_dsp
node_dsp -->|"uses math"| node_dsp_math
node_classify -.->|"dispatches engines"| node_engine
node_engine -.->|"runs model"| node_model
node_model -->|"invokes operators"| node_tflite
node_model -.->|"uses configuration"| node_metadata
node_classify -.->|"formats results"| node_postprocess
node_micro_context -->|"uses tensor API"| node_tensor_types
node_model -.->|"uses NN kernels"| node_cmsis_nn
node_classify -.->|"uses DSP types"| node_cmsis_types
node_thresholds -->|"tracks stable readings"| node_recovery
node_thresholds -->|"triggers cutoff"| node_alarms
node_recovery -->|"updates outputs"| node_alarms
node_recovery -->|"sends alerts"| node_sms
node_thresholds -->|"updates status"| node_display
node_recovery -->|"shows recovery"| node_display
node_wifi -->|"enables delivery"| node_sms

click node_classify "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h"
click node_dsp "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h"
click node_dsp_math "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/dsp/numpy.hpp"
click node_engine "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/engines.h"
click node_metadata "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/model-parameters/model_metadata.h"
click node_postprocess "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/postprocessing/ei_postprocessing_common.h"
click node_model "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/tflite-model/tflite_learn_793663_3_compiled.cpp"
click node_tflite "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/core/c/common.h"
click node_micro_context "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/micro_context.h"
click node_tensor_types "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/c/common.h"
click node_cmsis_types "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/CMSIS/DSP/Include/arm_math_types.h"
click node_cmsis_nn "https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sensors toneBlue
class node_feature,node_voting,node_classify,node_dsp,node_dsp_math,node_engine,node_metadata,node_postprocess toneAmber
class node_model,node_tflite,node_micro_context,node_tensor_types,node_cmsis_types,node_cmsis_nn toneMint
class node_thresholds,node_recovery,node_display,node_alarms,node_sms toneRose
class node_operator,node_wifi toneIndigo
```

## Components

### Sensing inputs

- **MPU6500 + DHT11**

### Inference pipeline

- **Magnitude feature**
- **Temporal voting**
- [Classifier API](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h`
- [DSP extraction](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h`
- [DSP math](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/dsp/numpy.hpp): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/dsp/numpy.hpp`
- [Inference engines](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/engines.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/engines.h`
- [Model metadata](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/model-parameters/model_metadata.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/model-parameters/model_metadata.h`
- [Result postprocessing](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/postprocessing/ei_postprocessing_common.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/postprocessing/ei_postprocessing_common.h`

### Embedded runtime

- [Compiled model](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/tflite-model/tflite_learn_793663_3_compiled.cpp): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/tflite-model/tflite_learn_793663_3_compiled.cpp`
- [TensorFlow Lite Micro](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/core/c/common.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/core/c/common.h`
- [Micro context](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/micro_context.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/micro_context.h`
- [Tensor interfaces](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/c/common.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/c/common.h`
- [CMSIS DSP types](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/CMSIS/DSP/Include/arm_math_types.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/CMSIS/DSP/Include/arm_math_types.h`
- [CMSIS NN kernels](https://github.com/aswina1636/earthquake-detection-system/blob/main/ml%20to%20C%2B%2B%20library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h): `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h`

### Hazard response

- **Hazard thresholds**
- **Recovery classifier**
- **OLED status**
- **Relay + buzzer + LED**
- **CircuitDigest SMS**

### Other components

- **System operator**
- **WiFi network**

## Connections

- System operator → MPU6500 + DHT11: monitors
- MPU6500 + DHT11 → Magnitude feature: provides readings
- Magnitude feature → Temporal voting: feeds samples
- Temporal voting → Hazard thresholds: confirms hazard
- MPU6500 + DHT11 → Classifier API: supplies inference data
- Classifier API → DSP extraction: extracts features
- DSP extraction → DSP math: uses math (evidence: `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h`)
- Classifier API → Inference engines: dispatches engines
- Inference engines → Compiled model: runs model
- Compiled model → TensorFlow Lite Micro: invokes operators (evidence: `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/tflite-model/tflite_learn_793663_3_compiled.cpp`)
- Compiled model → Model metadata: uses configuration
- Classifier API → Result postprocessing: formats results
- Micro context → Tensor interfaces: uses tensor API (evidence: `ml to C++ library/Earthquake_Detection_Pro_2_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/micro_context.h`)
- Compiled model → CMSIS NN kernels: uses NN kernels
- Classifier API → CMSIS DSP types: uses DSP types
- Hazard thresholds → Recovery classifier: tracks stable readings
- Hazard thresholds → Relay + buzzer + LED: triggers cutoff
- Recovery classifier → Relay + buzzer + LED: updates outputs
- Recovery classifier → CircuitDigest SMS: sends alerts
- Hazard thresholds → OLED status: updates status
- Recovery classifier → OLED status: shows recovery
- WiFi network → CircuitDigest SMS: enables delivery
