# mikhail-ramirez/spartn architecture

> Architecture diagram of the GitHub repository mikhail-ramirez/spartn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mikhail-ramirez/spartn
- Repository: https://github.com/mikhail-ramirez/spartn

## Overview

SPARTN is a distributed drone-detection system: microphone towers feed audio to a Raspberry Pi, which estimates location and classifies audio, then sends live results to an Android tablet over TCP. The README also describes RF sensing and tablet visualization; those branches are represented without implying that the sampled main loop integrates them. The main-loop excerpt is partial, so only its visible recorder, classification, transmission, and logging calls are shown; RF wiring and Android internals were not inspected.

Main entry points: [`src/main.py`](https://github.com/mikhail-ramirez/spartn/blob/master/src/main.py) (Pi Main Loop), [`android_app/app/src/main/java`](https://github.com/mikhail-ramirez/spartn/tree/master/android_app/app/src/main/java) (Android Tablet App), [`src/utils/logger.py`](https://github.com/mikhail-ramirez/spartn/blob/master/src/utils/logger.py) (Measurement Logger), [`src/communications/tower_config.py`](https://github.com/mikhail-ramirez/spartn/blob/master/src/communications/tower_config.py) (Tower Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_coordination["Pi Coordination"]
  node_main["Pi Main Loop<br/>[main.py]"]
  node_settings["System Settings<br/>[settings.py]"]
  node_logger["Measurement Logger<br/>[logger.py]"]
  node_logdata["Measurement Logs"]
  node_towerconfig["Tower Configuration<br/>[tower_config.py]"]
end

subgraph group_audio["Audio Detection"]
  node_recorder["Audio Recorder<br/>[audio_recorder.py]"]
  node_microphones(("Microphone Array"))
  node_trilateration["Audio Localization<br/>[trilateration.py]"]
  node_classifier["Audio Classifier"]
end

subgraph group_rf["RF Sensing"]
  node_hackrf["HackRF Sweep<br/>[hsLS.py]"]
  node_wifi["Wi-Fi Scanner"]
end

subgraph group_tablet["Tablet Interface"]
  node_tabletcomm["Tablet TCP Sender<br/>[tablet_comm.py]"]
  node_android["Android Tablet App"]
end

node_operator(("Operator"))
node_hackrf_device(("HackRF Device"))
node_wifi_network(("Nearby Wi-Fi"))

node_operator -->|"views detections"| node_android
node_android -->|"sends configuration"| node_towerconfig
node_towerconfig -->|"configures tower"| node_main
node_settings -->|"provides settings"| node_main
node_main -->|"updates buffers"| node_recorder
node_microphones -->|"audio input"| node_recorder
node_main -->|"analyzes audio"| node_trilateration
node_main -->|"classifies sample"| node_classifier
node_main -->|"sends results"| node_tabletcomm
node_tabletcomm -->|"TCP updates"| node_android
node_main -->|"logs measurements"| node_logger
node_logger -->|"writes logs"| node_logdata
node_hackrf_device -.->|"RF measurements"| node_hackrf
node_hackrf -.->|"sweep data"| node_android
node_wifi_network -.->|"scan results"| node_wifi

click node_main "https://github.com/mikhail-ramirez/spartn/blob/master/src/main.py"
click node_settings "https://github.com/mikhail-ramirez/spartn/blob/master/config/settings.py"
click node_logger "https://github.com/mikhail-ramirez/spartn/blob/master/src/utils/logger.py"
click node_logdata "https://github.com/mikhail-ramirez/spartn/tree/master/data"
click node_towerconfig "https://github.com/mikhail-ramirez/spartn/blob/master/src/communications/tower_config.py"
click node_recorder "https://github.com/mikhail-ramirez/spartn/blob/master/src/sensors/audio_recorder.py"
click node_trilateration "https://github.com/mikhail-ramirez/spartn/blob/master/src/processing/trilateration.py"
click node_classifier "https://github.com/mikhail-ramirez/spartn/blob/master/src/processing/ai_classification.py"
click node_hackrf "https://github.com/mikhail-ramirez/spartn/blob/master/src/sensors/HackRF/hsLS.py"
click node_wifi "https://github.com/mikhail-ramirez/spartn/tree/master/src/sensors/droneWifiScan"
click node_tabletcomm "https://github.com/mikhail-ramirez/spartn/blob/master/src/communications/tablet_comm.py"
click node_android "https://github.com/mikhail-ramirez/spartn/tree/master/android_app/app/src/main/java"

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_main,node_settings,node_logger,node_logdata,node_towerconfig toneBlue
class node_recorder,node_microphones,node_trilateration,node_classifier toneAmber
class node_hackrf,node_wifi toneMint
class node_tabletcomm,node_android toneRose
class node_operator,node_hackrf_device,node_wifi_network toneIndigo
```

## Components

### Pi Coordination

- [Pi Main Loop](https://github.com/mikhail-ramirez/spartn/blob/master/src/main.py): `src/main.py`
- [System Settings](https://github.com/mikhail-ramirez/spartn/blob/master/config/settings.py): `config/settings.py`
- [Measurement Logger](https://github.com/mikhail-ramirez/spartn/blob/master/src/utils/logger.py): `src/utils/logger.py`
- [Measurement Logs](https://github.com/mikhail-ramirez/spartn/tree/master/data): `data`
- [Tower Configuration](https://github.com/mikhail-ramirez/spartn/blob/master/src/communications/tower_config.py): `src/communications/tower_config.py`

### Audio Detection

- [Audio Recorder](https://github.com/mikhail-ramirez/spartn/blob/master/src/sensors/audio_recorder.py): `src/sensors/audio_recorder.py`
- **Microphone Array**
- [Audio Localization](https://github.com/mikhail-ramirez/spartn/blob/master/src/processing/trilateration.py): `src/processing/trilateration.py`
- [Audio Classifier](https://github.com/mikhail-ramirez/spartn/blob/master/src/processing/ai_classification.py): `src/processing/ai_classification.py`

### RF Sensing

- [HackRF Sweep](https://github.com/mikhail-ramirez/spartn/blob/master/src/sensors/HackRF/hsLS.py): `src/sensors/HackRF/hsLS.py`
- [Wi-Fi Scanner](https://github.com/mikhail-ramirez/spartn/tree/master/src/sensors/droneWifiScan): `src/sensors/droneWifiScan`

### Tablet Interface

- [Tablet TCP Sender](https://github.com/mikhail-ramirez/spartn/blob/master/src/communications/tablet_comm.py): `src/communications/tablet_comm.py`
- [Android Tablet App](https://github.com/mikhail-ramirez/spartn/tree/master/android_app/app/src/main/java): `android_app/app/src/main/java`

### Other components

- **Operator**
- **HackRF Device**
- **Nearby Wi-Fi**

## Connections

- Operator → Android Tablet App: views detections
- Android Tablet App → Tower Configuration: sends configuration
- Tower Configuration → Pi Main Loop: configures tower
- System Settings → Pi Main Loop: provides settings
- Pi Main Loop → Audio Recorder: updates buffers
- Microphone Array → Audio Recorder: audio input
- Pi Main Loop → Audio Localization: analyzes audio
- Pi Main Loop → Audio Classifier: classifies sample
- Pi Main Loop → Tablet TCP Sender: sends results
- Tablet TCP Sender → Android Tablet App: TCP updates
- Pi Main Loop → Measurement Logger: logs measurements
- Measurement Logger → Measurement Logs: writes logs
- HackRF Device → HackRF Sweep: RF measurements
- HackRF Sweep → Android Tablet App: sweep data
- Nearby Wi-Fi → Wi-Fi Scanner: scan results
