# jerware/startrekchair architecture

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

- Interactive diagram: https://gitdiagram.com/jerware/startrekchair
- Repository: https://github.com/jerware/startrekchair

## Overview

##### Project Type and Purpose
- This is an embedded hardware/software system that adds synchronized sound and lighting effects to Adam Savage’s Star Trek captain’s chair.
- It consists of two Teensy-based Arduino projects running in parallel:
- starTrekChairSND (sound/master)
- starTrekChairLED (LED/slave)
- The sound board reads user input (buttons), plays audio via a Teensy Audio Board, and drives the LED board over a serial link.

##### File Structure Analysis
Top-level:
- LICENSE – project license
- PCB/… – Gerber files, BOM, Eagle board & schematic for the combined hardware
- readme.txt – usage overview
- starTrekChairLED/starTrekChairLED.ino – Arduino sketch for the LED slave board
- starTrekChairSND/starTrekChairSND.ino – Arduino sketch for the sound master board

Key architectural clues:
- Two independent Arduino sketches ➔ two on-board microcontrollers
- PCB artifacts ➔ custom hardware design
- README description of master/slave revision and serial comms ➔ clear division of responsibilities

##### README Insights
- starTrekChairSND is the “master”:
- All button inputs are wired here
- Controls audio playback via Teensy Audio Board
- Sends LED commands to the slave via hardware serial
- Uses a pin-expander IC to free up Teensy GPIO
- starTrekChairLED is the “slave”:
- Receives serial commands and translates into LED driver signals
- Power distribution, speaker, buttons, LED strips, and optional OSH Park PCB all play roles

a. Main Components
1. Sound Board Assembly (Teensy 3.1 + Audio Board + Pin Expander + Buttons + Speaker)
2. LED Board Assembly (Teensy 3.1 + LED drivers or direct LED strip connections)
3. Communication Link (UART / Hardware Serial Rx/Tx lines)
4. Power Supply (5 V rail, common ground)
5. Custom PCBs (for mechanical integration and signal routing)

b. Interactions
- User presses a button → Signal to Sound Board GPIO/expander
- Sound Board processes input →
– Triggers audio playback on Audio Board → Speaker outputs sound
– Forms LED command packets → Sends over Serial TX → LED Board RX
- LED Board receives commands → Updates LED strips

c. Architectural Patterns
- Master/Slave microcontroller pattern
- Clear separation of I/O concerns: sound vs. light
- Serial messaging protocol for decoupling
- Hardware abstraction via pin-expander IC

d. Key Technologies & Frameworks
- Arduino (.ino) code targeting Teensy 3.1
- PJRC’s Teensy Audio Library
- Hardware serial (UART) for inter-board communication
- Eagle CAD for PCB design

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraph for Sound Board Assembly
    subgraph "Sound Board Assembly" 
        SB["Sound Board Assembly"]:::module
        MCU["Teensy 3.1 (MCU)"]:::mcu
        Audio["Audio Board"]:::periph
        Expander["Pin Expander IC"]:::periph
        Buttons["Buttons (User Input)"]:::periph
        Speaker["Speaker"]:::audio
    end

    %% Subgraph for LED Board Assembly
    subgraph "LED Board Assembly"
        LB["LED Board Assembly"]:::module
        LEDMCU["Teensy 3.1 (MCU)"]:::mcu
        LEDDrv["LED Drivers/Strips"]:::led
    end

    %% Communication Link
    UART[(UART Serial Link)]:::comms

    %% Power Supply
    Power[(5V Power Supply & GND)]:::power

    %% Custom PCB Design Files
    subgraph "Custom PCB Design Files"
        SCH["PCB Schematic (.sch)"]:::pcb
        BRD["PCB Board Layout (.brd)"]:::pcb
        GERB["Gerbers (.zip)"]:::pcb
        BOM["BOM (.xlsx)"]:::pcb
    end

    %% Documentation
    README["Usage Documentation (readme.txt)"]:::doc
    LICENSE["Project License (LICENSE)"]:::doc

    %% Connections for Sound Board
    Buttons -->|press| MCU
    MCU -->|I²C/SPI| Expander
    MCU -->|audio command| Audio
    Audio -->|sound output| Speaker
    MCU -->|serial TX| UART

    %% Connections for LED Board
    UART -->|serial RX| LEDMCU
    LEDMCU -->|drive| LEDDrv

    %% Power distribution
    Power --> SB
    Power --> LB
    Power --> Audio
    Power --> LEDDrv

    %% PCB Files grouped
    SB --> SCH
    SB --> BRD
    SB --> GERB
    SB --> BOM

    %% Documentation links 
    SB --> README
    SB --> LICENSE

    %% Click Events
    click SB "https://github.com/jerware/startrekchair/blob/master/starTrekChairSND/starTrekChairSND.ino"
    click LB "https://github.com/jerware/startrekchair/blob/master/starTrekChairLED/starTrekChairLED.ino"
    click SCH "https://github.com/jerware/startrekchair/blob/master/PCB/starTrekChair.sch"
    click BRD "https://github.com/jerware/startrekchair/blob/master/PCB/starTrekChair.brd"
    click GERB "https://github.com/jerware/startrekchair/blob/master/PCB/StarTrekChairGerbers.zip"
    click BOM "https://github.com/jerware/startrekchair/blob/master/PCB/Captains Chair PCB BOM.xlsx"
    click README "https://github.com/jerware/startrekchair/blob/master/readme.txt"
    click LICENSE "https://github.com/jerware/startrekchair/tree/master/LICENSE"

    %% Styles
    classDef module fill:#FFD580,stroke:#FFAA00,stroke-width:2px;
    classDef mcu fill:#80D4FF,stroke:#0099CC,stroke-width:2px;
    classDef periph fill:#D9D9D9,stroke:#666666,stroke-width:1px;
    classDef audio fill:#FF9999,stroke:#CC0000,stroke-width:1px;
    classDef led fill:#99FF99,stroke:#00CC00,stroke-width:1px;
    classDef comms fill:#E6CCFF,stroke:#9933FF,stroke-width:2px,dasharray: 5 5;
    classDef power fill:#FFFF99,stroke:#CCCC00,stroke-width:2px;
    classDef pcb fill:#FFCCCC,stroke:#CC0000,stroke-width:1px;
    classDef doc fill:#CCCCFF,stroke:#6666CC,stroke-width:1px;
```
