# oskitone/scout architecture

> Architecture diagram of the GitHub repository oskitone/scout, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oskitone/scout
- Repository: https://github.com/oskitone/scout

## Overview

##### Main Components

a) Hardware Layer:
- Keyboard Matrix (PCB design in KiCad)
- Speaker System
- Battery Power System
- Headphone Jack Interface
- Volume Control
- Power Switch

b) Firmware Layer:
- Arduino Microcontroller
- Core Sound Generation Modules
- Input Processing System

##### Key Relationships to Highlight

Physical Layer:
- Relationship between the 3D-printed components (from OpenSCAD files) and the electronic components
- How the keyboard matrix connects to the microcontroller
- Power distribution from batteries to components

Firmware Layer:
- Relationship between the main Arduino components:
- Frequency handling (Frequency.cpp)
- Key input processing (KeyBuffer.cpp)
- Generation (Notes.cpp)

##### User Interface
- Keys (1.5 octaves)
- Volume Control
- Power Switch
- Audio Output Options

##### Core Processing
- Arduino Microcontroller
- Key Processing Pipeline
- Sound Generation System

##### Power and Output
- Battery System
- Speaker
- Headphone Jack

##### Data Flow Representation

- Power distribution (thick red lines)

##### Important Elements

- FTDI Programming Interface connection point
- Square wave generation pipeline
- Key matrix scanning system
- Audio output routing (speaker/headphone switching)

##### Technical Specifications

- Power requirements
- Audio output specifications
- Key range (1.5 octaves)
- Synthesis type (square wave)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        A[Physical Component]:::physical
        B([Firmware Module]):::firmware
        C{{User Interface}}:::ui
        D{Power Component}:::power
        E[/"Signal Flow"/]
        F["Physical Connection"]
    end

    subgraph "User Interface Layer"
        Keys{{Keyboard Matrix}}:::ui
        Volume{{Volume Control}}:::ui
        PowerSwitch{{Power Switch}}:::ui
        AudioOut{{Audio Output}}:::ui
    end

    subgraph "Core Processing Layer"
        Arduino[Arduino Microcontroller]:::physical
        KeyProcess([Key Processing]):::firmware
        SoundGen([Sound Generation]):::firmware
        FreqHandler([Frequency Handler]):::firmware
    end

    subgraph "Power and Output Layer"
        Battery{Battery System}:::power
        Speaker[Speaker System]:::physical
        Headphone[Headphone Jack]:::physical
        FTDI[FTDI Interface]:::physical
    end

    subgraph "Technical Specifications"
        Specs["• 1.5 Octave Range
        • Square Wave Synthesis
        • Monophonic Output
        • Battery Powered
        • Through-hole Design"]:::specs
    end

    %% Connections
    Battery -->|Power| Arduino
    Battery -->|Power| Speaker
    Keys --> KeyProcess
    KeyProcess --> FreqHandler
    FreqHandler --> SoundGen
    SoundGen --> Speaker
    SoundGen --> Headphone
    Volume --> Speaker
    Volume --> Headphone
    PowerSwitch -->|Power Control| Battery
    FTDI -.->|Programming| Arduino

    %% Styles
    classDef physical fill:#a8d1f0
    classDef firmware fill:#90EE90
    classDef ui fill:#FFB347
    classDef power fill:#FF6961
    classDef specs fill:#F0F0F0

    %% Click Events
    click Keys "https://github.com/oskitone/scout/blob/main/kicad/keyboard_matrix/keyboard_matrix.sch"
    click SoundGen "https://github.com/oskitone/scout/blob/main/arduino/scout/scout.ino"
    click FreqHandler "https://github.com/oskitone/scout/blob/main/arduino/scout/Frequency.cpp"
    click KeyProcess "https://github.com/oskitone/scout/blob/main/arduino/scout/KeyBuffer.cpp"
    click Speaker "https://github.com/oskitone/scout/blob/main/openscad/speaker.scad"
    click Battery "https://github.com/oskitone/scout/blob/main/openscad/batteries.scad"
    click Headphone "https://github.com/oskitone/scout/blob/main/openscad/headphone_jack.scad"
    click PowerSwitch "https://github.com/oskitone/scout/blob/main/openscad/switch.scad"
    click Arduino "https://github.com/oskitone/scout/blob/main/kicad/scout/scout.sch"
```
