# kenchangh/kensat architecture

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

- Interactive diagram: https://gitdiagram.com/kenchangh/kensat
- Repository: https://github.com/kenchangh/kensat

## Overview

KENSAT is a CubeSat flight system built around scheduled, power-gated on-orbit LLM inference, with an OBC coordinating payload operation, housekeeping, antenna deployment, and open UHF telemetry. The principal workflow sends a prompt from the PIC24 to the Jetson, returns inference text to the OBC, frames it for beacon downlink, and decodes it at a ground station. README-level integrations are shown where source excerpts are unavailable; those links reflect documented behavior, not inspected implementation.

Main entry points: [`firmware/obc/app/main.c`](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/main.c) (OBC scheduler), [`firmware/obc/app/task_jetson.c`](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_jetson.c) (Inference task), [`firmware/obc/app/task_cmd.c`](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_cmd.c) (Command parser), [`firmware/obc/app/task_beacon.c`](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_beacon.c) (Beacon task)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flight["Flight control"]
  node_obc["OBC scheduler<br/>[main.c]"]
  node_commands["Command parser<br/>[task_cmd.c]"]
  node_deployment["Burn-wire state<br/>[deploy.h]"]
  node_housekeeping["Housekeeping tasks<br/>[task_5sec.c]"]
  node_sensors["IMU task<br/>[task_bmi088.c]"]
  node_logging["SD logging<br/>[task_sdlog.c]"]
  node_watchdog["Watchdog task<br/>[task_wdt.c]"]
  node_bsp["Board peripherals<br/>[csk_io.c]"]
end

subgraph group_payload["AI payload"]
  node_jetson_task["Inference task<br/>[task_jetson.c]"]
  node_jetson_listener["UART prompt listener<br/>[prompt_listener.py]"]
  node_llama["llama-server"]
end

subgraph group_radio["Radio link"]
  node_telemetry["Telemetry framing<br/>[telemetry.h]"]
  node_beacon["Beacon task<br/>[task_beacon.c]"]
  node_ax25["AX.25 framing<br/>[ax25.c]"]
  node_si4463["Si4463 radio<br/>[task_si4463.c]"]
  node_air{{"UHF radio link"}}
end

subgraph group_ground["Ground station"]
  node_ground_decoder["AX.25 decoder<br/>[pluto_rx_ax25.py]"]
  node_ground_tools["SDR tools<br/>[pluto_rx.py]"]
end

subgraph group_rf["RF engineering"]
  node_rf_optimizer["Matching optimizer"]
  node_rf_measurement["Smith chart tuning<br/>[vna_smith_plot.py]"]
end

node_mission(("Mission operator"))
node_ground_user(("Ground operator"))

node_mission -->|"sends commands"| node_commands
node_obc -->|"schedules"| node_commands
node_obc -->|"schedules"| node_jetson_task
node_obc -->|"schedules"| node_beacon
node_obc -->|"schedules"| node_sensors
node_obc -->|"schedules"| node_logging
node_obc -->|"schedules"| node_watchdog
node_commands -->|"requests inference"| node_jetson_task
node_commands -->|"requests deployment"| node_deployment
node_deployment -->|"drives GPIO"| node_bsp
node_jetson_task -->|"sends prompts"| node_jetson_listener
node_jetson_listener -->|"returns results"| node_jetson_task
node_jetson_listener -->|"queries"| node_llama
node_sensors -->|"provides readings"| node_telemetry
node_jetson_task -->|"provides results"| node_telemetry
node_telemetry -->|"supplies payload"| node_beacon
node_beacon -->|"frames packets"| node_ax25
node_beacon -->|"dispatches transmit"| node_si4463
node_si4463 -->|"transmits"| node_air
node_air -->|"carries beacons"| node_ground_decoder
node_ground_user -->|"receives frames"| node_ground_decoder
node_air -.->|"carries signals"| node_ground_tools
node_rf_optimizer -.->|"informs tuning"| node_rf_measurement

click node_obc "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/main.c"
click node_commands "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_cmd.c"
click node_deployment "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/deploy.h"
click node_housekeeping "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_5sec.c"
click node_sensors "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_bmi088.c"
click node_logging "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_sdlog.c"
click node_watchdog "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_wdt.c"
click node_bsp "https://github.com/kenchangh/kensat/blob/main/firmware/obc/bsp/csk_io.c"
click node_jetson_task "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_jetson.c"
click node_jetson_listener "https://github.com/kenchangh/kensat/blob/main/jetson/prompt_listener.py"
click node_telemetry "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/telemetry.h"
click node_beacon "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_beacon.c"
click node_ax25 "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/ax25.c"
click node_si4463 "https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_si4463.c"
click node_ground_decoder "https://github.com/kenchangh/kensat/blob/main/ground-station/pluto_rx_ax25.py"
click node_ground_tools "https://github.com/kenchangh/kensat/blob/main/ground-station/pluto_rx.py"
click node_rf_optimizer "https://github.com/kenchangh/kensat/blob/main/radio/rf-design/matching_network_skrf.py"
click node_rf_measurement "https://github.com/kenchangh/kensat/blob/main/radio/rf-design/vna_smith_plot.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_obc,node_commands,node_deployment,node_housekeeping,node_sensors,node_logging,node_watchdog,node_bsp toneBlue
class node_jetson_task,node_jetson_listener,node_llama toneAmber
class node_telemetry,node_beacon,node_ax25,node_si4463,node_air toneMint
class node_ground_decoder,node_ground_tools toneRose
class node_rf_optimizer,node_rf_measurement,node_mission,node_ground_user toneIndigo
```

## Components

### Flight control

- [OBC scheduler](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/main.c): `firmware/obc/app/main.c`
- [Command parser](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_cmd.c): `firmware/obc/app/task_cmd.c`
- [Burn-wire state](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/deploy.h): `firmware/obc/app/deploy.h`
- [Housekeeping tasks](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_5sec.c): `firmware/obc/app/task_5sec.c`
- [IMU task](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_bmi088.c): `firmware/obc/app/task_bmi088.c`
- [SD logging](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_sdlog.c): `firmware/obc/app/task_sdlog.c`
- [Watchdog task](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_wdt.c): `firmware/obc/app/task_wdt.c`
- [Board peripherals](https://github.com/kenchangh/kensat/blob/main/firmware/obc/bsp/csk_io.c): `firmware/obc/bsp/csk_io.c`

### AI payload

- [Inference task](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_jetson.c): `firmware/obc/app/task_jetson.c`
- [UART prompt listener](https://github.com/kenchangh/kensat/blob/main/jetson/prompt_listener.py): `jetson/prompt_listener.py`
- **llama-server**

### Radio link

- [Telemetry framing](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/telemetry.h): `firmware/obc/app/telemetry.h`
- [Beacon task](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_beacon.c): `firmware/obc/app/task_beacon.c`
- [AX.25 framing](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/ax25.c): `firmware/obc/app/ax25.c`
- [Si4463 radio](https://github.com/kenchangh/kensat/blob/main/firmware/obc/app/task_si4463.c): `firmware/obc/app/task_si4463.c`
- **UHF radio link**

### Ground station

- [AX.25 decoder](https://github.com/kenchangh/kensat/blob/main/ground-station/pluto_rx_ax25.py): `ground-station/pluto_rx_ax25.py`
- [SDR tools](https://github.com/kenchangh/kensat/blob/main/ground-station/pluto_rx.py): `ground-station/pluto_rx.py`

### RF engineering

- [Matching optimizer](https://github.com/kenchangh/kensat/blob/main/radio/rf-design/matching_network_skrf.py): `radio/rf-design/matching_network_skrf.py`
- [Smith chart tuning](https://github.com/kenchangh/kensat/blob/main/radio/rf-design/vna_smith_plot.py): `radio/rf-design/vna_smith_plot.py`

### Other components

- **Mission operator**
- **Ground operator**

## Connections

- Mission operator → Command parser: sends commands
- OBC scheduler → Command parser: schedules
- OBC scheduler → Inference task: schedules
- OBC scheduler → Beacon task: schedules
- OBC scheduler → IMU task: schedules
- OBC scheduler → SD logging: schedules
- OBC scheduler → Watchdog task: schedules
- Command parser → Inference task: requests inference
- Command parser → Burn-wire state: requests deployment
- Burn-wire state → Board peripherals: drives GPIO
- Inference task → UART prompt listener: sends prompts
- UART prompt listener → Inference task: returns results
- UART prompt listener → llama-server: queries
- IMU task → Telemetry framing: provides readings
- Inference task → Telemetry framing: provides results
- Telemetry framing → Beacon task: supplies payload
- Beacon task → AX.25 framing: frames packets
- Beacon task → Si4463 radio: dispatches transmit
- Si4463 radio → UHF radio link: transmits
- UHF radio link → AX.25 decoder: carries beacons
- Ground operator → AX.25 decoder: receives frames
- UHF radio link → SDR tools: carries signals
- Matching optimizer → Smith chart tuning: informs tuning
