# omarelmelegy/icarus architecture

> Architecture diagram of the GitHub repository omarelmelegy/icarus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/omarelmelegy/icarus
- Repository: https://github.com/omarelmelegy/icarus

## Overview

The ICARUS project is a dual-module sensor and communication system designed for a Cubesat competition using ESP32 boards. It consists of two primary modules: a Satellite Module (named THEFLYINGTRASHMAN in the file tree) and a Ground Station Module (under GROUNDSTATION). The Satellite Module is responsible for gathering sensor data (IMU, environmental, magnetometer, GPS), logging it onto an SD card, and transmitting it via ESP-NOW, while the Ground Station Module receives the data and displays it in real time for monitoring and debugging purposes.

##### Main Components
- Satellite Module (THEFLYINGTRASHMAN):
- ESP32 board
- Integrated sensors: IMU (MPU6050), BME280 environmental sensor, HMC5883 magnetometer, GPS module.
- SD card for local data logging.
- ESP-NOW wireless communication functionality.
- Ground Station Module (GROUNDSTATION):
- ESP32 board
- Data reception via ESP-NOW.
- Real-time data processing and display (via Serial Monitor).

##### Out the Interactions
- Within the Satellite Module, illustrate data flow from the sensors to the SD card as well as to the ESP32 where the data is processed and prepared for wireless transmission.
- Within the Ground Station Module, show data flowing from the ESP32’s receiver (via ESP-NOW) to a processing component that outputs the data on the Serial Monitor.

##### Relevant Architectural Patterns and Design Principles
- Modular Design: Clearly separate the system into two modules—Satellite and Ground Station—with individual responsibilities.
- Embedded System Architecture: Emphasize that both modules use ESP32 as the central microcontroller for sensor processing and communication.
- Wireless Communication: Indicate use of ESP-NOW as the chosen peer-to-peer communication protocol for low latency data exchange.

##### Relevant Technologies, Frameworks, and Protocols
- Hardware: ESP32, various sensors (MPU6050, BME280, HMC5883, GPS), and SD card for logging.
- Communication: ESP-NOW protocol for wireless data transfer.
- Software: Arduino IDE configuration and potential libraries for sensor data acquisition and communication.
- Configuration Files: Although not extensively detailed in the file tree, mention that the project’s READMEs provide setup and troubleshooting instructions for each individual module.

##### Final Advice
- Be meticulous in separating the components: at the highest level, split the system into two key modules (with their internal elements clearly defined).
- Use clear, easy-to-read labels for all components.
- Every major data flow (sensor data collection, local logging, wireless transmission, and real-time monitoring).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Satellite Module Subgraph
    subgraph "Satellite Module"
        direction TB
        TF["THEFLYINGTRASHMAN (ESP32)"]:::module
        Sensor_IMU["IMU (MPU6050)"]:::sensor
        Sensor_BME["BME280 Sensor"]:::sensor
        Sensor_MAG["HMC5883 Sensor"]:::sensor
        Sensor_GPS["GPS Module"]:::sensor
        SD["SD Card (Data Logging)"]:::storage
        Doc_Sat["Satellite README"]:::doc

        Sensor_IMU -->|"data"| TF
        Sensor_BME -->|"data"| TF
        Sensor_MAG -->|"data"| TF
        Sensor_GPS -->|"data"| TF
        TF -->|"logs"| SD
        Doc_Sat --- TF
    end

    %% Ground Station Module Subgraph
    subgraph "Ground Station Module"
        direction TB
        GS["GROUNDSTATION (ESP32)"]:::module
        Serial["Serial Monitor (Display)"]:::display
        Doc_GS["Ground Station README"]:::doc

        GS -->|"outputs"| Serial
        Doc_GS --- GS
    end

    %% ESP-NOW Wireless Communication between Modules
    TF ---|"ESP-NOW"| GS

    %% Project Documentation
    Doc_Project["Project README"]:::doc
    Doc_Project --- TF
    Doc_Project --- GS

    %% Click Events
    click TF "https://github.com/omarelmelegy/icarus/blob/main/THEFLYINGTRASHMAN/THEFLYINGTRASHMAN.ino"
    click GS "https://github.com/omarelmelegy/icarus/blob/main/GROUNDSTATION/GROUNDSTATION.ino"
    click Doc_Sat "https://github.com/omarelmelegy/icarus/blob/main/THEFLYINGTRASHMAN/README.md"
    click Doc_GS "https://github.com/omarelmelegy/icarus/blob/main/GROUNDSTATION/README.md"
    click Doc_Project "https://github.com/omarelmelegy/icarus/blob/main/README.md"

    %% Styling
    classDef module fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef sensor fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef storage fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef display fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef doc fill:#FFFACD,stroke:#000,stroke-width:2px,stroke-dasharray:5,5
```
