# n4haiham/n4haigeodetector architecture

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

- Interactive diagram: https://gitdiagram.com/n4haiham/n4haigeodetector
- Repository: https://github.com/n4haiham/n4haigeodetector

## Overview

n4haiGeoDetector is a Raspberry Pi GPS geolocation display: it turns GPS fixes and boundary data into county/city and grid-square status, then renders the result on an LCD, with optional HDMI mirroring and web views. The principal runtime is GPS detection → display state/history → image rendering → framebuffer output. The README documents additional operating modes and settings; unsampled wiring is omitted or marked unverified.

Main entry points: [`displaygeo.py`](https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo.py) (Display State), [`arGeoDetector.py`](https://github.com/n4haiham/n4haigeodetector/blob/main/arGeoDetector.py) (GPS Detector), [`hdmi_mirror.py`](https://github.com/n4haiham/n4haigeodetector/blob/main/hdmi_mirror.py) (HDMI Mirror), [`county_history_web.py`](https://github.com/n4haiham/n4haigeodetector/blob/main/county_history_web.py) (County History Web)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_location["Location Detection"]
  node_detector["GPS Detector<br/>[arGeoDetector.py]"]
  node_boundaries["KML Boundaries"]
end

subgraph group_display["Display Output"]
  node_display_state["Display State<br/>[displaygeo.py]"]
  node_lcd_renderer["LCD Renderer<br/>[displaygeo.py]"]
  node_lcd_fb["LCD Framebuffer"]
  node_hdmi["HDMI Mirror<br/>[hdmi_mirror.py]"]
  node_hdmi_fb["HDMI Framebuffer"]
end

subgraph group_history["History and Web"]
  node_history_csv[("County Entry CSV<br/>[displaygeo.py]")]
  node_history_web["County History Web"]
  node_preview_web["LCD Preview Web<br/>[displaygeo_web.py]"]
end

subgraph group_host["Pi Status"]
  node_pi_status["Pi Status Cycle<br/>[pi_status.py]"]
end

node_gps(("GPS Receiver"))
node_browser(("Browser User"))

node_gps -.->|"sends NMEA"| node_detector
node_display_state -->|"starts detector"| node_detector
node_display_state -->|"loads KML"| node_boundaries
node_detector -->|"sends location updates"| node_display_state
node_display_state -->|"logs entries"| node_history_csv
node_display_state -->|"provides display data"| node_lcd_renderer
node_lcd_renderer -->|"gets status text"| node_pi_status
node_lcd_renderer -->|"writes pixels"| node_lcd_fb
node_lcd_renderer -->|"passes image"| node_hdmi
node_hdmi -->|"writes pixels"| node_hdmi_fb
node_display_state -->|"starts history server"| node_history_web
node_history_web -->|"reads entries"| node_history_csv
node_browser -->|"requests preview"| node_preview_web
node_preview_web -->|"renders image"| node_lcd_renderer

click node_detector "https://github.com/n4haiham/n4haigeodetector/blob/main/arGeoDetector.py"
click node_display_state "https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo.py"
click node_lcd_renderer "https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo.py"
click node_hdmi "https://github.com/n4haiham/n4haigeodetector/blob/main/hdmi_mirror.py"
click node_pi_status "https://github.com/n4haiham/n4haigeodetector/blob/main/pi_status.py"
click node_history_csv "https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo.py"
click node_history_web "https://github.com/n4haiham/n4haigeodetector/blob/main/county_history_web.py"
click node_preview_web "https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo_web.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_detector,node_boundaries,node_browser toneBlue
class node_display_state,node_lcd_renderer,node_lcd_fb,node_hdmi,node_hdmi_fb toneAmber
class node_history_csv,node_history_web,node_preview_web toneMint
class node_pi_status toneRose
class node_gps toneIndigo
```

## Components

### Location Detection

- [GPS Detector](https://github.com/n4haiham/n4haigeodetector/blob/main/arGeoDetector.py): `arGeoDetector.py`
- **KML Boundaries**

### Display Output

- [Display State](https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo.py): `displaygeo.py`
- [LCD Renderer](https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo.py): `displaygeo.py`
- **LCD Framebuffer**
- [HDMI Mirror](https://github.com/n4haiham/n4haigeodetector/blob/main/hdmi_mirror.py): `hdmi_mirror.py`
- **HDMI Framebuffer**

### History and Web

- [County Entry CSV](https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo.py): `displaygeo.py`
- [County History Web](https://github.com/n4haiham/n4haigeodetector/blob/main/county_history_web.py): `county_history_web.py`
- [LCD Preview Web](https://github.com/n4haiham/n4haigeodetector/blob/main/displaygeo_web.py): `displaygeo_web.py`

### Pi Status

- [Pi Status Cycle](https://github.com/n4haiham/n4haigeodetector/blob/main/pi_status.py): `pi_status.py`

### Other components

- **GPS Receiver**
- **Browser User**

## Connections

- GPS Receiver → GPS Detector: sends NMEA (evidence: `README.md`)
- Display State → GPS Detector: starts detector (evidence: `displaygeo.py`)
- Display State → KML Boundaries: loads KML (evidence: `displaygeo.py`)
- GPS Detector → Display State: sends location updates (evidence: `arGeoDetector.py`)
- Display State → County Entry CSV: logs entries (evidence: `displaygeo.py`)
- Display State → LCD Renderer: provides display data (evidence: `displaygeo.py`)
- LCD Renderer → Pi Status Cycle: gets status text (evidence: `displaygeo.py`)
- LCD Renderer → LCD Framebuffer: writes pixels (evidence: `displaygeo.py`)
- LCD Renderer → HDMI Mirror: passes image (evidence: `displaygeo.py`)
- HDMI Mirror → HDMI Framebuffer: writes pixels (evidence: `hdmi_mirror.py`)
- Display State → County History Web: starts history server (evidence: `displaygeo.py`)
- County History Web → County Entry CSV: reads entries (evidence: `county_history_web.py`)
- Browser User → LCD Preview Web: requests preview (evidence: `displaygeo_web.py`)
- LCD Preview Web → LCD Renderer: renders image (evidence: `displaygeo_web.py`)
