# adq/kiln-controller architecture

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

- Interactive diagram: https://gitdiagram.com/adq/kiln-controller
- Repository: https://github.com/adq/kiln-controller

## Overview

##### Core Control System
- lib/oven.py (main control logic)
- lib/ovenWatcher.py (monitoring)
- lib/max31855.py/max31856.py (sensor interfaces)

##### Web Interface
- public/assets/* (frontend resources)
- public/index.html (main UI)
- kiln-controller.py (web server)

##### Storage System
- storage/profiles/* (kiln schedules)
- config.py (system configuration)

c) User Interface Layer (Top Level):
- Web browsers/clients
- Multiple device access points

##### Key Interactions to Highlight

a) Control Flow:
- Thermocouple → MAX31855/MAX31856 → Raspberry Pi
- Raspberry Pi → SSR → Kiln
- PID control loop within the software

b) Data Flow:
- Web clients ⇄ Web server
- Profile storage ↔ Control system
- Configuration ↔ All components

##### Additional Elements

- PID Controller logic
- WebSocket real-time updates
- Profile management system
- Simulation mode switch

##### Notes Section

Callouts for:
- GPIO pin configurations
- Safety considerations
- Supported thermocouple types
- Operating parameters

##### Configuration flexibility

- Hardware interface layer
- Control logic layer
- Web service layer
- User interface layer

This will create a comprehensive visualization that captures both the hardware and software aspects of the kiln controller system while maintaining clarity and usefulness for development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Hardware
        RPI[Raspberry Pi]
        MAX[MAX31855/MAX31856]
        TC[K-Type Thermocouple]
        SSR[Solid State Relay]
        KILN[Electric Kiln]
    end

    subgraph "Core Control"
        OVEN[Main Control Logic]:::core
        WATCH[Monitoring System]:::core
        SENSOR[Thermocouple Interface]:::core
        PID[PID Controller]:::core
    end

    subgraph "Web Layer"
        WS[Web Server]:::web
        UI[Frontend UI]:::web
        ASSETS[Frontend Resources]:::web
        LOGIC[Frontend Logic]:::web
        STYLE[Frontend Styling]:::web
    end

    subgraph "Storage Layer"
        PROF[Kiln Profiles]:::storage
        CONFIG[System Configuration]:::storage
    end

    subgraph "Tools & Services"
        LOGGER[Logging System]:::tools
        TUNER[PID Tuning Tool]:::tools
        SERVICE[Service Config]:::tools
    end

    subgraph "Documentation"
        API[API Docs]:::docs
        PIDGUIDE[PID Tuning Guide]:::docs
        TROUBLE[Troubleshooting]:::docs
        ZIEGLER[Ziegler Tuning]:::docs
        LOGDOC[Logging Docs]:::docs
    end

    %% Hardware Connections
    TC --> MAX
    MAX --> RPI
    RPI --> SSR
    SSR --> KILN

    %% Software Connections
    MAX --> SENSOR
    SENSOR --> OVEN
    OVEN --> PID
    PID --> SSR
    WATCH --> OVEN
    OVEN --> WS
    WS --> UI
    UI --> ASSETS
    UI --> LOGIC
    UI --> STYLE
    CONFIG --> OVEN
    PROF --> OVEN
    LOGGER --> OVEN
    TUNER --> PID

    %% Component Mappings
    click OVEN "https://github.com/adq/kiln-controller/blob/master/lib/oven.py"
    click WATCH "https://github.com/adq/kiln-controller/blob/master/lib/ovenWatcher.py"
    click SENSOR "https://github.com/adq/kiln-controller/blob/master/lib/max31855.py"
    click WS "https://github.com/adq/kiln-controller/blob/master/kiln-controller.py"
    click UI "https://github.com/adq/kiln-controller/blob/master/public/index.html"
    click ASSETS "https://github.com/adq/kiln-controller/tree/master/public/assets/"
    click LOGIC "https://github.com/adq/kiln-controller/blob/master/public/assets/js/picoreflow.js"
    click STYLE "https://github.com/adq/kiln-controller/blob/master/public/assets/css/picoreflow.css"
    click PROF "https://github.com/adq/kiln-controller/tree/master/storage/profiles/"
    click CONFIG "https://github.com/adq/kiln-controller/blob/master/config.py"
    click SERVICE "https://github.com/adq/kiln-controller/blob/master/lib/init/kiln-controller.service"
    click LOGGER "https://github.com/adq/kiln-controller/blob/master/kiln-logger.py"
    click TUNER "https://github.com/adq/kiln-controller/blob/master/kiln-tuner.py"
    click API "https://github.com/adq/kiln-controller/blob/master/docs/api.md"
    click PIDGUIDE "https://github.com/adq/kiln-controller/blob/master/docs/pid_tuning.md"
    click TROUBLE "https://github.com/adq/kiln-controller/blob/master/docs/troubleshooting.md"
    click ZIEGLER "https://github.com/adq/kiln-controller/blob/master/docs/ziegler_tuning.md"
    click LOGDOC "https://github.com/adq/kiln-controller/blob/master/docs/logs.md"

    %% Styling
    classDef core fill:#f9f,stroke:#333,stroke-width:2px
    classDef web fill:#9cf,stroke:#333,stroke-width:2px
    classDef storage fill:#9f9,stroke:#333,stroke-width:2px
    classDef tools fill:#ff9,stroke:#333,stroke-width:2px
    classDef docs fill:#ddd,stroke:#333,stroke-width:2px
```
