# redteamskier/optical-data-transmitter architecture

> Architecture diagram of the GitHub repository redteamskier/optical-data-transmitter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redteamskier/optical-data-transmitter
- Repository: https://github.com/redteamskier/optical-data-transmitter

## Overview

This is a classroom optical data-transfer demonstration: a browser sends text or files as flashing light, an Arduino streams sensor readings, and a host decodes and prints or saves the result. The graph follows that workflow and includes the decoder’s signal-processing stages, offline replay/recording, and the documented teaching guide. Decoder internals are sampled only partially; edges for the main processing sequence rely on the README’s explicit workflow where noted.

Main entry points: [`decoder/optical_rx.py`](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py) (Live capture), [`transmitter/Optical_Tx.html`](https://github.com/redteamskier/optical-data-transmitter/blob/main/transmitter/Optical_Tx.html) (Transmit page), [`firmware/optical_receiver_stream/optical_receiver_stream.ino`](https://github.com/redteamskier/optical-data-transmitter/blob/main/firmware/optical_receiver_stream/optical_receiver_stream.ino) (Sample streamer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_transmit["Optical transmitter"]
  node_tx_page["Transmit page<br/>[Optical_Tx.html]"]
  node_light_link{{"Light link"}}
end

subgraph group_receiver["Optical receiver"]
  node_sensor{{"Phototransistor"}}
  node_firmware["Sample streamer"]
  node_serial{{"USB serial"}}
end

subgraph group_decode["Host decoding"]
  node_capture["Live capture<br/>[optical_rx.py]"]
  node_alignment["Sample alignment<br/>[optical_rx.py]"]
  node_signal["Signal conditioning<br/>[optical_rx.py]"]
  node_clock["Clock recovery<br/>[optical_rx.py]"]
  node_manchester["Manchester decode<br/>[optical_rx.py]"]
  node_frames["Frame and CRC check<br/>[optical_rx.py]"]
  node_results["Text or file output<br/>[optical_rx.py]"]
  node_recording["Raw recording<br/>[optical_rx.py]"]
  node_replay["Offline replay<br/>[optical_rx.py]"]
end

subgraph group_learning["Teaching materials"]
  node_education["Teaching guide<br/>[README.md]"]
end

node_sender(("User"))

node_sender -->|"enters message"| node_tx_page
node_tx_page -->|"flashes encoded data"| node_light_link
node_light_link -->|"transmits light"| node_sensor
node_sensor -->|"provides sensor signal"| node_firmware
node_firmware -->|"streams raw samples"| node_serial
node_serial -->|"supplies samples"| node_capture
node_capture -->|"reads and aligns"| node_alignment
node_alignment -->|"prepares samples"| node_signal
node_signal -->|"detects edges"| node_clock
node_clock -->|"recovers bit timing"| node_manchester
node_manchester -->|"parses decoded bits"| node_frames
node_frames -->|"emits valid payload"| node_results
node_capture -->|"writes samples"| node_recording
node_recording -->|"replays waveform"| node_replay
node_replay -->|"decodes samples"| node_alignment

click node_tx_page "https://github.com/redteamskier/optical-data-transmitter/blob/main/transmitter/Optical_Tx.html"
click node_firmware "https://github.com/redteamskier/optical-data-transmitter/blob/main/firmware/optical_receiver_stream/optical_receiver_stream.ino"
click node_capture "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_alignment "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_signal "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_clock "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_manchester "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_frames "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_results "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_recording "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_replay "https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py"
click node_education "https://github.com/redteamskier/optical-data-transmitter/blob/main/Education/README.md"

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_tx_page,node_light_link,node_sender toneBlue
class node_sensor,node_firmware,node_serial toneAmber
class node_capture,node_alignment,node_signal,node_clock,node_manchester,node_frames,node_results,node_recording,node_replay toneMint
class node_education toneRose
```

## Components

### Optical transmitter

- [Transmit page](https://github.com/redteamskier/optical-data-transmitter/blob/main/transmitter/Optical_Tx.html): `transmitter/Optical_Tx.html`
- **Light link**

### Optical receiver

- **Phototransistor**
- [Sample streamer](https://github.com/redteamskier/optical-data-transmitter/blob/main/firmware/optical_receiver_stream/optical_receiver_stream.ino): `firmware/optical_receiver_stream/optical_receiver_stream.ino`
- **USB serial**

### Host decoding

- [Live capture](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Sample alignment](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Signal conditioning](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Clock recovery](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Manchester decode](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Frame and CRC check](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Text or file output](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Raw recording](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`
- [Offline replay](https://github.com/redteamskier/optical-data-transmitter/blob/main/decoder/optical_rx.py): `decoder/optical_rx.py`

### Teaching materials

- [Teaching guide](https://github.com/redteamskier/optical-data-transmitter/blob/main/Education/README.md): `Education/README.md`

### Other components

- **User**

## Connections

- User → Transmit page: enters message (evidence: `README.md`)
- Transmit page → Light link: flashes encoded data (evidence: `README.md`)
- Light link → Phototransistor: transmits light (evidence: `README.md`)
- Phototransistor → Sample streamer: provides sensor signal (evidence: `README.md`)
- Sample streamer → USB serial: streams raw samples (evidence: `README.md`)
- USB serial → Live capture: supplies samples (evidence: `decoder/optical_rx.py`)
- Live capture → Sample alignment: reads and aligns (evidence: `decoder/optical_rx.py`)
- Sample alignment → Signal conditioning: prepares samples (evidence: `README.md`)
- Signal conditioning → Clock recovery: detects edges (evidence: `decoder/optical_rx.py`)
- Clock recovery → Manchester decode: recovers bit timing (evidence: `decoder/optical_rx.py`)
- Manchester decode → Frame and CRC check: parses decoded bits (evidence: `README.md`)
- Frame and CRC check → Text or file output: emits valid payload (evidence: `README.md`)
- Live capture → Raw recording: writes samples (evidence: `README.md`)
- Raw recording → Offline replay: replays waveform (evidence: `README.md`)
- Offline replay → Sample alignment: decodes samples (evidence: `README.md`)
