# tompi/cheapino architecture

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

- Interactive diagram: https://gitdiagram.com/tompi/cheapino
- Repository: https://github.com/tompi/cheapino

## Overview

##### Project Type and Purpose
- The project is centered around hardware design, specifically for a DIY split keyboard. It covers both the physical/mechanical aspects (case, plates, PCB) and the firmware side (QMK customization, onboard LED control via RP2040-Zero).
- The design’s goal is to produce an affordable keyboard with a unique reversible PCB connected through RJ45, optionally supporting hotswap or soldered switches.

##### Analyzing the File Structure
- Directories like “case,” “plates,” “pcb” – contain manufacturing files (SCAD for 3D printing, STL/STEP files for parts, and KiCad files for electronics).
- “doc” houses guides (build guides, ordering guides, troubleshooting, firmware instructions) and visual galleries showing build progress.
- “project_libraries” holds shared resources such as 3D models (STP, WRL) and PCB footprints for different components.
- The README links to essential guides and indicates how firmware customization (via QMK) is pivotal.
- Although this is not a “full-stack” software project, the same architectural design principles apply—identifying distinct subsystems (mechanical design, electronics design, and firmware) and showing their interactions.

a. Main Components to Include:
– Mechanical Subsystem:
- Case: Identify files under “case” (SCAD files) that define the physical enclosure parts.
- Plates: Show the “plates” directory contents (STL files) that interact with the case and the PCB.
– Electronics Subsystem:
- PCB: Include the “pcb” directory elements (KiCad files, STEP files) and note that the PCB is reversible and uses an RJ45 for connectivity.
- Project Libraries – Footprints and 3D Models: Indicate external libraries that provide definitions of components such as the MCU and switch housings.
– Firmware/Software Subsystem:
- Firmware guides and support files: Mention documentation for QMK firmware customization, onboard LED control via RP2040-Zero, and use of a Japanese duplex matrix.
- Integration point between hardware (the PCB) and firmware.

b. Relationships and Interactions:
– Illustrate data/control flows between the firmware running on the MCU and the physical switch matrix.
– Show the dependency/integration point where firmware (QMK) interacts with the hardware components (PCB, LED on RP2040-Zero, and the hotswap or soldered switches).
– Highlight the interaction between the mechanical enclosure (case and plates) and the PCB, ensuring proper alignment and support.

c. Architectural Patterns and Design Principles:
– Modular Design: Separate the project into clear, independent components (mechanical, electronic, firmware) that are integrated.
– Reusability: The “project_libraries” shows a reuse of common 3D models and PCB footprints, facilitating consistency across designs.
– Flexibility: The reversible PCB and multiple build options (hotswap vs permanent soldering) indicate flexible hardware design options.
– Documentation-Driven Integration: The comprehensive docs are a central node in the system’s architecture that guides assembly, troubleshooting, and customization.

d. Relevant Technologies, Frameworks, or Libraries:
– Hardware Design: OpenSCAD for case design, KiCad for PCB design.
– Firmware: QMK (with support for custom modifications, handles the onboard LED).
– 3D Modeling: STL and STEP file formats for parts using possibly CAD software.
– Libraries: External “project_libraries” that supply models and PCB footprints.

##### Specific Elements
- A node for “Case” linking to its design files (SCAD files under the case directory).
- A node for “Plates” showing STL segments from the plates directory.
- A node for “PCB” including elements like KiCad schematic/layout files and STEP models.
- A node for the “Firmware” indicating that QMK is used and the MCU (RP2040-Zero) controls both the keyboard matrix and onboard LED.
- Nodes for “Project Libraries” which would impact both the PCB design (footprints) and the 3D models used in the case and plate design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Mechanical Subsystem"
        CASE["Case"]:::mechanical
        PLATES["Plates"]:::mechanical
    end

    subgraph "Electronics Subsystem"
        PCB_LEFT["PCB (Left)"]:::electronics
        PCB_RIGHT["PCB (Right)"]:::electronics
        PROJECT_LIBS["Project Libraries"]:::electronics
    end

    subgraph "Firmware Subsystem"
        FIRMWARE["Firmware Docs (QMK & onboard LED)"]:::firmware
    end

    CASE -->|"supports"| PLATES
    PLATES -->|"interfaces"| PCB_LEFT
    PLATES -->|"interfaces"| PCB_RIGHT
    PCB_LEFT -->|"RJ45"| PCB_RIGHT
    PROJECT_LIBS -->|"supplies"| PCB_LEFT
    PROJECT_LIBS -->|"supplies"| PCB_RIGHT
    FIRMWARE -->|"controls"| PCB_LEFT
    FIRMWARE -->|"controls"| PCB_RIGHT

    click CASE "https://github.com/tompi/cheapino/blob/master/case/cheapino.scad"
    click PLATES "https://github.com/tompi/cheapino/tree/master/plates/"
    click PCB_LEFT "https://github.com/tompi/cheapino/tree/master/pcb/"
    click PCB_RIGHT "https://github.com/tompi/cheapino/tree/master/pcb/"
    click PROJECT_LIBS "https://github.com/tompi/cheapino/tree/master/project_libraries/"
    click FIRMWARE "https://github.com/tompi/cheapino/blob/master/doc/firmware.md"

    classDef mechanical fill:#f8b400,stroke:#333,stroke-width:2px,color:#000;
    classDef electronics fill:#1f77b4,stroke:#333,stroke-width:2px,color:#fff;
    classDef firmware fill:#2ca02c,stroke:#333,stroke-width:2px,color:#fff;
```
