# kl3m4n/connected-flowers architecture

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

- Interactive diagram: https://gitdiagram.com/kl3m4n/connected-flowers
- Repository: https://github.com/kl3m4n/connected-flowers

## Overview

##### Project type and purpose
- This is an IoT-enabled, full-stack academic project (“Connected Flowers”) that integrates embedded firmware (on Arduino), edge computing (on a Raspberry Pi 3 B+), a MySQL relational database, and a C-based analytics/interaction client.
- The goal is to monitor plant parameters (e.g., soil moisture) with Arduino sensors, ship that data to a Raspberry Pi, store it in MySQL, and drive a C application that queries and processes the data.

##### File structure
Top-level:
- algorithmique/ – C code (`algo_plante.c`), database-API based analytics, plus design docs (`Algo_Client.vsdx`)
- merise/ – database model (`MCD.mcd`) and schema/load script (`uf_dev.sql`)
- arduino/ – firmware sketches and sensor-reading code (not shown in listing but implied by directory)
- raspberry/ – Python script (`add_info_DB.py`) that reads sensor data (e.g., via serial or network) and inserts into MySQL; subfolder photos
- README.md – high-level description, tech stack, setup instructions

##### README for additional insights
- Tech stack: C, MySQL API, Arduino, Raspberry Pi
- Workflow:
1) Arduino reads sensors
2) Raspberry Pi collects sensor data and calls MySQL
3) C binary queries the same MySQL DB to compute or display results
- The MySQL schema is created via `uf_dev.sql` based on the Merise MCD.

##### Main components & interactions
a) Components
- Arduino device (soil-moisture sensor + firmware)
- Raspberry Pi 3 B+ running `add_info_DB.py`
- MySQL Database (hosted on the Pi or a separate DB server)
- C client application (`algo_plante.c`) running on a host PC
- (Optionally) Merise/Data Modeling artifacts as reference, and any graphical UI layer if present
b) Relationships & data flows
1) Arduino → (serial or network) → Raspberry Pi
2) Raspberry Pi → (MySQL API) → MySQL Database
3) C client → (MySQL API) → MySQL Database
c) Architectural patterns / design principles
– Clear separation of concerns:
- Embedded sensing layer (Arduino)
- Edge ingestion & storage layer (Raspberry Pi + MySQL)
- Analytics / UI layer (C client)
– Standard client–server DB pattern for data persistence
d) Key technologies & libraries
– Arduino C/C++ sensor code
– Python + MySQL Connector on Raspberry Pi
– MySQL 5.x or 8.x
– C application built with `mysql_config` for DB connectivity
– Merise modeling (MCD, SQL schema)

##### Detailed architectural capture
- Inside: “add_info_DB.py (Python)”, “MySQL Server”
- “algo_plante.c → app (C-MySQL Client)”
- Blue for devices, green for data store, orange for applications

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Embedded Layer
    subgraph "Embedded Layer"
        Arduino["Arduino Sensor Node\nFirmware"]:::devices
    end

    %% Edge Layer
    subgraph "Edge Layer"
        Python["add_info_DB.py"]:::service
        DB["MySQL Database"]:::database
    end

    %% Host Layer
    subgraph "Host Layer"
        CClient["C Client App\nalgo_plante.c"]:::app
    end

    %% Artifacts
    subgraph "Project Artifacts"
        MeriseMCD["Merise Conceptual Model\nMCD.mcd"]:::docs
        SQLSchema["DB Schema & Load Script\nuf_dev.sql"]:::docs
        DesignDoc["C Client Design Doc\nAlgo_Client.vsdx"]:::docs
        Readme["Project README\nREADME.md"]:::docs
    end

    %% Connections
    Arduino -->|"Serial/USB"| Python
    Python -->|"TCP/MySQL"| DB
    CClient -->|"TCP/MySQL"| DB

    %% Click Events
    click Arduino "https://github.com/kl3m4n/connected-flowers/tree/master/arduino/"
    click Python "https://github.com/kl3m4n/connected-flowers/blob/master/raspberry/add_info_DB.py"
    click SQLSchema "https://github.com/kl3m4n/connected-flowers/blob/master/merise/uf_dev.sql"
    click MeriseMCD "https://github.com/kl3m4n/connected-flowers/blob/master/merise/MCD.mcd"
    click CClient "https://github.com/kl3m4n/connected-flowers/blob/master/algorithmique/algo_plante.c"
    click DesignDoc "https://github.com/kl3m4n/connected-flowers/blob/master/algorithmique/Algo_Client.vsdx"
    click Readme "https://github.com/kl3m4n/connected-flowers/blob/master/README.md"

    %% Styles
    classDef devices fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef service fill:#FFA500,stroke:#333,stroke-width:1px
    classDef database fill:#90EE90,stroke:#333,stroke-width:1px
    classDef app fill:#FFB347,stroke:#333,stroke-width:1px
    classDef docs fill:#D3D3D3,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
