# cbachhuber/g2gdelay architecture

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

- Interactive diagram: https://gitdiagram.com/cbachhuber/g2gdelay
- Repository: https://github.com/cbachhuber/g2gdelay

## Overview

This is a Glass-to-Glass video-delay measurement system: an LED and phototransistor provide the optical measurement setup, Arduino firmware produces delay samples, and a Python tool collects or reloads samples, computes statistics, and plots a histogram. The README also identifies Arduino Serial Monitor as a direct way to view measurements. The Arduino sketch was not excerpted, so its internal measurement stages and any use of TimerOne cannot be verified; those links are omitted.

Main entry points: [`delayrecorder.py`](https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py) (Recorder options), [`Arduino_code/Arduino_code.ino`](https://github.com/cbachhuber/g2gdelay/blob/master/Arduino_code/Arduino_code.ino) (Arduino firmware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Measurement device"]
  node_optical_setup["LED and sensor"]
  node_firmware["Arduino firmware<br/>[Arduino_code.ino]"]
  node_timer["TimerOne utility<br/>[TimerOne.cpp]"]
  node_arduino["Arduino board"]
end

subgraph group_recorder["Measurement recorder"]
  node_cli["Recorder options<br/>[delayrecorder.py]"]
  node_serial_capture["Serial capture<br/>[delayrecorder.py]"]
  node_csv_store["CSV results<br/>[delayrecorder.py]"]
  node_csv_load["CSV reload<br/>[delayrecorder.py]"]
  node_serial_monitor["Serial Monitor"]
end

subgraph group_analysis["Results analysis"]
  node_stats["Statistics<br/>[delayrecorder.py]"]
  node_histogram["Histogram plot<br/>[delayrecorder.py]"]
end

node_operator(("Operator"))

node_operator -->|"positions"| node_optical_setup
node_optical_setup -->|"provides light signal"| node_firmware
node_operator -->|"runs"| node_cli
node_cli -->|"selects capture"| node_serial_capture
node_serial_capture -->|"reads serial"| node_arduino
node_firmware -.->|"runs on"| node_arduino
node_arduino -->|"displays samples"| node_serial_monitor
node_cli -->|"selects reload"| node_csv_load
node_csv_load -->|"reads"| node_csv_store
node_serial_capture -->|"passes samples"| node_stats
node_stats -->|"writes samples and stats"| node_csv_store
node_stats -->|"provides statistics"| node_histogram
node_csv_load -->|"provides samples"| node_histogram
node_operator -->|"views samples"| node_serial_monitor

click node_firmware "https://github.com/cbachhuber/g2gdelay/blob/master/Arduino_code/Arduino_code.ino"
click node_timer "https://github.com/cbachhuber/g2gdelay/blob/master/Arduino_code/TimerOne.cpp"
click node_cli "https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py"
click node_serial_capture "https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py"
click node_csv_store "https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py"
click node_csv_load "https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py"
click node_stats "https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py"
click node_histogram "https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.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_optical_setup,node_firmware,node_timer,node_arduino toneBlue
class node_cli,node_serial_capture,node_csv_store,node_csv_load,node_serial_monitor toneAmber
class node_stats,node_histogram toneMint
class node_operator toneIndigo
```

## Components

### Measurement device

- **LED and sensor**
- [Arduino firmware](https://github.com/cbachhuber/g2gdelay/blob/master/Arduino_code/Arduino_code.ino): `Arduino_code/Arduino_code.ino`
- [TimerOne utility](https://github.com/cbachhuber/g2gdelay/blob/master/Arduino_code/TimerOne.cpp): `Arduino_code/TimerOne.cpp`
- **Arduino board**

### Measurement recorder

- [Recorder options](https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py): `delayrecorder.py`
- [Serial capture](https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py): `delayrecorder.py`
- [CSV results](https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py): `delayrecorder.py`
- [CSV reload](https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py): `delayrecorder.py`
- **Serial Monitor**

### Results analysis

- [Statistics](https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py): `delayrecorder.py`
- [Histogram plot](https://github.com/cbachhuber/g2gdelay/blob/master/delayrecorder.py): `delayrecorder.py`

### Other components

- **Operator**

## Connections

- Operator → LED and sensor: positions (evidence: `README.md`)
- LED and sensor → Arduino firmware: provides light signal (evidence: `README.md`)
- Operator → Recorder options: runs (evidence: `README.md`)
- Recorder options → Serial capture: selects capture (evidence: `delayrecorder.py`)
- Serial capture → Arduino board: reads serial (evidence: `delayrecorder.py`)
- Arduino firmware → Arduino board: runs on
- Arduino board → Serial Monitor: displays samples (evidence: `README.md`)
- Recorder options → CSV reload: selects reload (evidence: `delayrecorder.py`)
- CSV reload → CSV results: reads (evidence: `delayrecorder.py`)
- Serial capture → Statistics: passes samples (evidence: `delayrecorder.py`)
- Statistics → CSV results: writes samples and stats (evidence: `delayrecorder.py`)
- Statistics → Histogram plot: provides statistics (evidence: `delayrecorder.py`)
- CSV reload → Histogram plot: provides samples (evidence: `delayrecorder.py`)
- Operator → Serial Monitor: views samples (evidence: `README.md`)
