# ali-hassan2005/float_mate_2024 architecture

> Architecture diagram of the GitHub repository ali-hassan2005/float_mate_2024, 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/ali-hassan2005/float_mate_2024
- Repository: https://github.com/ali-hassan2005/float_mate_2024

## Overview

##### Project Overview & Main Components
- NANO_CLOCK – the high-precision timing module.
- float – the core backend logic which handles floating-point computations, sensor processing, and motor control for the Arduino client.
- gui_float – the front-end interface built with JavaScript, EJS, and CSS.
- A separate or embedded component for the Arduino client, which acts as the bridge between sensor/motor control and WiFi/network communication.

##### Detailing the Architecture
a. For the NANO_CLOCK module:
- Role in providing timekeeping services that synchronize events between the backend and the Arduino client.
b. For the float module:
- It as the “Core Logic” component which implements high-precision floating-point operations.
- Sub-components or annotations indicating that it handles sensor data (e.g., pressure readings), calibration, and interfaces with the NANO_CLOCK.
c. For the gui_float module:
- It as the “Graphical User Interface” that provides a dynamic, real-time display of data.
- That it is built using Node.js with an Express-based server (as seen from files like bin/www, routes, and views) and EJS templates for dynamic rendering.
d. For the Arduino Client (embedded controller):
- Role in sensor and motor control, WiFi connectivity, and endpoint communications (described in the README with endpoints such as /getdata, /start, /ping, etc.).
- Direct interactions with the float module (for core logic and computations) and possibly the GUI via RESTful endpoints.

##### Relationships and Interactions
- From NANO_CLOCK to float, indicating that timing information is provided to ensure real-time accurate processing.
- From float to the Arduino Client: sensor readings, motor control actions, and core computation results are delivered here.
- From the Arduino Client (or float, depending on deployment) to the gui_float interface, reflecting the use of REST/HTTP APIs to relay data for user interaction.
- Bidirectional communication between the GUI and the embedded controller (e.g., endpoints for control commands like /up, /down, calibration via /sendVal).

##### Architectural Patterns & Design Principles
- Separation of concerns: the timing module is isolated from the core logic, and the GUI is decoupled from the low-level embedded processing.
- Integration points—such as how HTTP endpoints in the Arduino client provide a simple microservices/API-like interface for external consumption.
- Use of modular design within the C++ core (float module) and a clear delineation between client and server in the gui_float module.

##### Relevant Technologies and Frameworks
- For the NANO_CLOCK and float modules: mention C++ as the implementation language.
- For the Arduino Client: note the use of Arduino libraries (WiFi.h, ArduinoJson, SPI.h, uRTCLib) and its reliance on an HTTP server for communication.

- Provide clear labels for each component.
- Backend (NANO_CLOCK & float) vs. Frontend (gui_float).
- Hardware components (Arduino Client) vs. Software modules.

Final Layout Suggestion:
- Optionally, add a “cloud” or network symbol to represent WiFi communication managing connectivity between the embedded client and the front-end, reinforcing the idea of a networked system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    NanoClock["NANO_CLOCK: High-Precision Timing\n(C++)"]:::backend
    Float["float: Core Logic\n(Floating-point computations,\nSensor data & Calibration,\nInterfaces with NanoClock)"]:::backend
    Pressure["Pressure Sensor Connection"]:::backend
    Arduino["Arduino Client\n(Sensor/Motor Control,\nWiFi Connectivity, Endpoints)"]:::hardware
    GUI["gui_float: Graphical User Interface\n(Node.js, Express, EJS)"]:::frontend

    %% Relationships
    NanoClock -->|"provides-timing"| Float
    Pressure -.->|"supports"| Float
    Float -->|"processes-data"| Arduino
    Float -->|"pushes-updates"| GUI
    Arduino -->|"HTTP-sensor-data"| GUI
    GUI -->|"sends-control"| Arduino

    %% Click Events
    click NanoClock "https://github.com/ali-hassan2005/float_mate_2024/blob/main/NANO_CLOCK/NANO_CLOCK.ino"
    click Float "https://github.com/ali-hassan2005/float_mate_2024/blob/main/float/float.ino"
    click Pressure "https://github.com/ali-hassan2005/float_mate_2024/blob/main/float/PressureSensor Connection.txt"
    click GUI "https://github.com/ali-hassan2005/float_mate_2024/tree/main/gui_float/"

    %% Styles
    classDef backend fill:#E0F7FA,stroke:#006064,stroke-width:2px;
    classDef frontend fill:#E8F5E9,stroke:#1B5E20,stroke-width:2px;
    classDef hardware fill:#FFF3E0,stroke:#E65100,stroke-width:2px;
```
