# ayman-charef/distributeur-automatique-des-toasts-tartin-s architecture

> Architecture diagram of the GitHub repository ayman-charef/distributeur-automatique-des-toasts-tartin-s, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayman-charef/distributeur-automatique-des-toasts-tartin-s
- Repository: https://github.com/ayman-charef/distributeur-automatique-des-toasts-tartin-s

## Overview

##### Project Type and Purpose
- This is an IoT-enabled robotics system for automating toast spreading.
- Combines hardware (ESP32 microcontroller, sensors, motors) with embedded software (Arduino sketch) and optional cloud/remote control.

##### File Structure and README
- File tree is minimal: an `1/1.ino` sketch plus design/report PDFs.
- Key components from README: ESP32, ultrasonic sensor, stepper & servo motors, conveyor, robotic arm, IoT connectivity.

##### Main Components
a. Hardware Layer
- ESP32 Microcontroller
- HC-SR04 Ultrasonic Sensor
- 28BYJ-48 Stepper Motor + ULN2003 Driver
- MG995 Servo Motor
- Conveyor Belt Assembly
- Robotic Arm & Spreading Nozzles
b. Software & Firmware Layer
- Arduino Sketch (control logic, sensor reading, motor commands)
- IoT Communication Module (Wi-Fi/Bluetooth interface on ESP32)
c. External Services / User Interfaces
- Remote Control App / Web Dashboard
- Cloud Service (optional for OTA updates, data logging)

##### Relationships and Data Flows
- Sensor → ESP32: Ultrasonic readings trigger conveyor & arm actions.
- ESP32 → Motor Drivers: Stepper/servo control signals move conveyor & arm.
- ESP32 ↔ Remote App: Wi-Fi/Bluetooth bi-directional messages for commands/status.
- (Optional) ESP32 → Cloud: Telemetry upload, firmware update.

##### Architectural Patterns & Design Principles
- Event-driven control loop on the ESP32: sensor events → actuator commands.
- Layered separation:
1) Hardware abstraction (drivers for sensors/motors),
2) Control logic (state machine for toast detection and spreading),
3) Communication layer (IoT interface).
- Safety interlock module: emergency stop path hardwired or in firmware.

- Six hardware components and their drivers.
- Firmware layers in the Arduino sketch (Hardware Abstraction, Control Logic, Communication).
- Out the data/control flows explicitly.
- Safety and emergency-stop mechanism.
- IoT connectivity and potential cloud integration.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Interfaces"
        RemoteApp["Remote Control App/Web Dashboard"]:::external
        CloudService["Cloud Service (Telemetry, OTA)"]:::external
    end

    subgraph "Software & Firmware Layer"
        Sketch["Arduino Sketch"]:::control
        HA["Hardware Abstraction"]:::control
        CL["Control Logic"]:::control
        COM["Communication Module"]:::control
    end

    subgraph "Hardware Layer"
        ESP32["ESP32 Microcontroller"]:::control
        Ultra["HC-SR04 Ultrasonic Sensor"]:::sensor
        Stepper["28BYJ-48 Stepper Motor + ULN2003 Driver"]:::actuator
        Servo["MG995 Servo Motor"]:::actuator
        Conveyor["Conveyor Belt Assembly"]:::actuator
        Arm["Robotic Arm & Spreading Nozzles"]:::actuator
        Safety["Safety Interlock Module"]:::hardware
    end

    subgraph "Documentation"
        README["README.md"]:::doc
        Rapport["Detailed Design Report"]:::doc
        Presentation["Presentation Slides"]:::doc
        Archive["Technical Report Archive"]:::doc
    end

    %% Connections
    Ultra -->|"Distance reading"| ESP32
    ESP32 -->|"Step command"| Stepper
    ESP32 -->|"Servo position"| Servo
    ESP32 -->|"Conveyor control"| Conveyor
    ESP32 -->|"Arm command"| Arm
    ESP32 -->|"Emergency stop"| Safety
    ESP32 <-->|"Wi-Fi/BLE"| RemoteApp
    ESP32 -->|"Telemetry"| CloudService
    CloudService -->|"OTA Update"| ESP32

    %% Firmware layering
    Sketch --> HA
    Sketch --> CL
    Sketch --> COM
    HA --> ESP32
    CL --> ESP32
    COM --> ESP32

    %% Documentation links
    README --> Sketch
    Rapport --> Sketch
    Presentation --> Sketch
    Archive --> Sketch

    %% Click Events
    click Sketch "https://github.com/ayman-charef/distributeur-automatique-des-toasts-tartin-s/blob/main/1/1.ino"
    click README "https://github.com/ayman-charef/distributeur-automatique-des-toasts-tartin-s/blob/main/README.md"
    click Rapport "https://github.com/ayman-charef/distributeur-automatique-des-toasts-tartin-s/blob/main/Rapport_PFA_1A.pdf"
    click Presentation "https://github.com/ayman-charef/distributeur-automatique-des-toasts-tartin-s/blob/main/Presentation_PFA_1A .pdf"
    click Archive "https://github.com/ayman-charef/distributeur-automatique-des-toasts-tartin-s/blob/main/Rapport_1.zip"

    %% Styles
    classDef sensor fill:#ADD8E6,stroke:#000,color:#000
    classDef actuator fill:#90EE90,stroke:#000,color:#000
    classDef control fill:#FFA500,stroke:#000,color:#000
    classDef external fill:#D3D3D3,stroke:#000,color:#000
    classDef hardware fill:#FF6347,stroke:#000,color:#000
    classDef doc fill:#F0F0F0,stroke:#000,color:#000
```
