# valery3107/minipc architecture

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

- Interactive diagram: https://gitdiagram.com/valery3107/minipc
- Repository: https://github.com/valery3107/minipc

## Overview

1. **Repository shape**
   - This is a **single-firmware embedded project**: one Arduino-style sketch, `arquitectura.ino`, plus a README.
   - There are no separate services or packages; the architecture is concentrated in one ESP32 application that directly manages peripherals.

2. **Core runtime**
   - The **ESP32** is the central controller and execution environment.
   - It orchestrates all hardware interactions: touch input, display output, sensor reading, SD card access, and the Snake game loop.

3. **Primary hardware subsystems**
   - **ILI9341 touch screen**: main user interface and visual output.
   - **DHT11 sensor**: provides temperature and humidity data.
   - **SD card reader**: persistent storage / asset access layer.
   - **Snake game**: built-in interactive application running inside the same firmware.

4. **User interaction flow**
   - The user interacts primarily through the **touchscreen**.
   - Touch events drive **navigation** across the interface and likely also control the Snake game.
   - The screen acts as both the **input surface** and the **presentation layer**.

5. **Sensor data flow**
   - The DHT11 is a distinct input source feeding **environmental readings** into the application.
   - Those readings are intended to be **presented visually** on the screen as part of the embedded dashboard experience.

6. **Storage / content subsystem**
   - The SD card adds a separate persistence boundary from live sensor input.
   - In an architecture diagram, treat it as an **optional data source or asset store** accessed by the ESP32 firmware, not as a networked dependency.

7. **Game subsystem**
   - The Snake game is not a separate app; it is **one mode within the embedded UI**.
   - It shares the same display and touch infrastructure as the rest of the system, which means the firmware likely behaves like a **mode-based state machine**.

8. **Feedback layer**
   - The README mentions **visual and sound feedback** as part of the experience.
   - Visually, this is clearly handled by the ILI9341 display; any audio feedback would be another direct peripheral/output path from the ESP32 if implemented in the sketch.

9. **Important architectural boundary**
   - The key boundary is between:
     - **hardware peripherals** on one side, and
     - **application logic / UI state management** on the other.
   - The firmware sits in the middle and translates hardware events into screen updates and game or menu behavior.

10. **Likely control model**
   - The system is best understood as a **single event-driven loop**:
     - read touch input,
     - poll/update sensor values,
     - update UI/game state,
     - render to the display,
     - optionally access SD content.
   - This is typical of embedded interactive firmware and is the right abstraction for diagramming.

11. **What to emphasize in a diagram**
   - Put **ESP32** at the center.
   - Connect it directly to **ILI9341 touchscreen**, **DHT11**, and **SD card**.
   - Show two main application paths:
     - **dashboard / sensor display**
     - **Snake game mode**
   - Show the touchscreen as both **input** and **output** path.

12. **Overall interpretation**
   - Architecturally, this repo is a **monolithic embedded HMI system** rather than a distributed system.
   - Its purpose is to demonstrate **integration of multiple peripherals** into one cohesive interactive experience on the ESP32.

Main entry points: [`arquitectura.ino`](https://github.com/valery3107/minipc/blob/main/arquitectura.ino) (ESP32 app), [`README.md`](https://github.com/valery3107/minipc/blob/main/README.md) (README)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["Docs"]
  node_readme["README<br/>doc<br/>[README.md]"]
end

subgraph group_firmware["Firmware"]
  node_sketch["ESP32 app<br/>firmware<br/>[arquitectura.ino]"]
  node_loop(("Main loop<br/>runtime"))
  node_state{{"UI state<br/>controller"}}
end

subgraph group_hardware["Hardware"]
  node_touch["Touchscreen<br/>HMI"]
  node_display["Render layer<br/>output"]
  node_dht11(("DHT11<br/>sensor"))
  node_sdcard[("SD card<br/>storage")]
  node_audio(("Sound<br/>feedback"))
end

subgraph group_modes["Modes"]
  node_dashboard["Dashboard<br/>ui mode"]
  node_snake["Snake<br/>game mode"]
end

node_readme -.->|"describes"| node_sketch
node_sketch -->|"runs"| node_loop
node_loop -->|"updates"| node_state
node_loop -->|"reads"| node_touch
node_loop -->|"polls"| node_dht11
node_loop -->|"accesses"| node_sdcard
node_state -->|"selects"| node_dashboard
node_state -->|"selects"| node_snake
node_dashboard -->|"renders"| node_display
node_snake -->|"renders"| node_display
node_touch -.->|"shares panel"| node_display
node_dht11 -->|"feeds"| node_dashboard
node_sdcard -.->|"supplies"| node_dashboard
node_sketch -.->|"may drive"| node_audio

click node_readme "https://github.com/valery3107/minipc/blob/main/README.md"
click node_sketch "https://github.com/valery3107/minipc/blob/main/arquitectura.ino"

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_readme toneBlue
class node_sketch,node_loop,node_state toneAmber
class node_touch,node_display,node_dht11,node_sdcard,node_audio toneMint
class node_dashboard,node_snake toneRose
```

## Components

### Docs

Repository documentation

- [README](https://github.com/valery3107/minipc/blob/main/README.md): doc · Project overview and usage notes · `README.md`

### Firmware

Single ESP32 sketch and runtime control

- [ESP32 app](https://github.com/valery3107/minipc/blob/main/arquitectura.ino): firmware · Main Arduino-style firmware running on the ESP32 · `arquitectura.ino`
- **Main loop**: runtime · Event-driven control loop that polls inputs and refreshes outputs
- **UI state**: controller · Mode switching and shared application state

### Hardware

Directly managed peripherals and inputs/outputs

- **Touchscreen**: HMI · ILI9341 touch display used for input and presentation
- **Render layer**: output · On-screen drawing and visual feedback
- **DHT11**: sensor · Temperature and humidity source
- **SD card**: storage · Persistent storage and asset source
- **Sound**: feedback · Optional audio feedback path

### Modes

Embedded UI and game behaviors

- **Dashboard**: ui mode · Sensor-oriented screen for environmental readings
- **Snake**: game mode · Interactive game mode inside the same firmware

## Connections

- README → ESP32 app: describes · Documentation points to the single firmware entrypoint
- ESP32 app → Main loop: runs · The firmware executes as one embedded control loop
- Main loop → UI state: updates · Loop advances the shared UI and mode state
- Main loop → Touchscreen: reads · Touch input drives navigation and game actions
- Main loop → DHT11: polls · Environmental readings are collected during runtime
- Main loop → SD card: accesses · Firmware can read from persistent storage
- UI state → Dashboard: selects · State machine enters the sensor display mode
- UI state → Snake: selects · State machine enters the game mode
- Dashboard → Render layer: renders · Dashboard visuals are drawn to the screen
- Snake → Render layer: renders · Game frame updates are shown on the screen
- Touchscreen → Render layer: shares panel · The touchscreen is both input surface and visual output
- DHT11 → Dashboard: feeds · Sensor values are presented in the dashboard UI
- SD card → Dashboard: supplies · Stored content can support the interface experience
- ESP32 app → Sound: may drive · Firmware can trigger optional feedback output if implemented
