# n1kdo/antennaswitchcontrol architecture

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

- Interactive diagram: https://gitdiagram.com/n1kdo/antennaswitchcontrol
- Repository: https://github.com/n1kdo/antennaswitchcontrol

## Overview

##### Main System Components

a) Hardware Layer:
- Antenna Switch Control Board (PCB designed in KiCAD)
- Array Solutions "SixPak" or 2x8 antenna switch
- Elecraft HF Radios (up to 2)
- Band Decoders (external components)
- WiFi connectivity module (Raspberry Pi Pico W)

b) Software Layer:
- Web Server Component (http_server.py)
- Control Logic (main.py)
- Network Management (picow_network.py)
- Relay Control System (relays.py)
- Configuration Management (data/config.json)
- User Interface Components (content/*.html)

**[Physical Layer]**
- Antennas (up to 8) ←→ SixPak Switch ←→ Control Board ←→ Band Decoders ←→ Radios (up to 2)
- ↑                                      ↑
**[Control Layer]**
- Relay Control Logic ←→ Main Controller ←→ WiFi Module
- ↑                     ↑               ↑
**[Application Layer]**
- Web Server ←→ Configuration Management ←→ Network Management
- ↑
**[User Interface Layer]**
- Control Panel UI, Antenna Setup UI, Radio Setup UI, Network Setup UI

##### Key Relationships to Highlight

- Red: RF signal path
- Blue: Control signals
- Green: Network communications
- Yellow: User interface elements

##### Implementation Details

- Use standard networking symbols for WiFi and network components
- Use electronic symbols for RF components and switches
- Annotations for critical features like:
- Maximum number of supported antennas (8)
- Number of supported radios (2)
- WiFi protection advantage
- Band decoder integration points

##### Technical Specifications

- Interface specifications for the SixPak switch
- WiFi module specifications
- Relay control parameters
- Web server port and protocol information
- Configuration file structure reference

##### Additional Notes

- Version information
- Reference to external Band Selector project
- Scalability options (6-antenna vs 8-antenna configurations)
- Maintenance access points

- Multiple layers
- Custom symbols
- Proper technical notation
- Export to high-resolution formats
- Easy updating for future modifications

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef hardware fill:#ffcccc,stroke:#ff0000
    classDef control fill:#cce5ff,stroke:#0066cc
    classDef network fill:#ccffcc,stroke:#006600
    classDef ui fill:#ffffcc,stroke:#999900
    classDef config fill:#e6ccff,stroke:#6600cc

    %% Physical Layer
    subgraph Physical
        Antennas["Antennas (1-8)"]
        SixPak["SixPak/2x8 Switch"]:::hardware
        ControlBoard["Control Board PCB"]:::hardware
        BandDecoders["Band Decoders"]:::hardware
        Radios["Radios (1-2)"]:::hardware
        WiFiModule["Raspberry Pi Pico W"]:::hardware
    end

    %% Control Layer
    subgraph Control
        RelayControl["Relay Control System"]:::control
        MainController["Main Controller"]:::control
        TxInhibit["TX INHIBIT Protection"]:::control
    end

    %% Application Layer
    subgraph Application
        WebServer["Web Server"]:::network
        ConfigMgmt["Configuration Management"]:::config
        NetworkMgmt["Network Management"]:::network
        Logger["Logging System"]:::control
        Utils["System Utilities"]:::control
    end

    %% UI Layer
    subgraph Interface
        AntennaUI["Antenna Control UI"]:::ui
        RadioUI["Radio Setup UI"]:::ui
        NetworkUI["Network Setup UI"]:::ui
        SwitchUI["Switch Control UI"]:::ui
    end

    %% Relationships
    Antennas --> SixPak
    SixPak --> ControlBoard
    ControlBoard --> BandDecoders
    BandDecoders --> Radios
    ControlBoard --> WiFiModule
    WiFiModule --> NetworkMgmt
    RelayControl --> ControlBoard
    MainController --> RelayControl
    MainController --> TxInhibit
    WebServer --> MainController
    ConfigMgmt --> MainController
    NetworkMgmt --> MainController
    Logger --> MainController
    Utils --> MainController
    AntennaUI --> WebServer
    RadioUI --> WebServer
    NetworkUI --> WebServer
    SwitchUI --> WebServer

    %% Click Events
    click ControlBoard "https://github.com/n1kdo/AntennaSwitchControl/blob/master/kicad/AntennaSwitchControl/AntennaSwitchControl.kicad_pcb"
    click WebServer "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/http_server.py"
    click MainController "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/main.py"
    click NetworkMgmt "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/picow_network.py"
    click RelayControl "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/relays.py"
    click ConfigMgmt "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/data/config.json.example"
    click AntennaUI "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/content/antennas.html"
    click RadioUI "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/content/radios.html"
    click NetworkUI "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/content/network.html"
    click SwitchUI "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/content/switch.html"
    click WiFiModule "https://github.com/n1kdo/AntennaSwitchControl/blob/master/kicad/AntennaSwitchControl/parts.pretty/RPi_PicoW_SMD_TH.kicad_mod"
    click Utils "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/utils.py"
    click Logger "https://github.com/n1kdo/AntennaSwitchControl/blob/master/src/switch_control/micro_logging.py"

    %% Legend
    subgraph Legend
        H["Hardware Components"]:::hardware
        C["Control Components"]:::control
        N["Network Components"]:::network
        U["UI Components"]:::ui
        CF["Configuration"]:::config
    end
```
