# bold-code-universal/ai-blind-assistant architecture

> Architecture diagram of the GitHub repository bold-code-universal/ai-blind-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bold-code-universal/ai-blind-assistant
- Repository: https://github.com/bold-code-universal/ai-blind-assistant

## Overview

This is a wearable visual-assistance system: an ESP32-CAM captures a scene, a laptop server sends the image to a vision model, cleans the description, and speaks it aloud. The README also names ultrasonic obstacle sensing, but the firmware was not sampled, so its behavior and connection to the server cannot be verified. The graph separates documented device capabilities from the server’s visible processing stages; dashed links mark unverified device-to-server integration.

Main entry points: [`laptopserver.py`](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py) (Speech generation), [`freshhhcam.ino`](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/freshhhcam.ino) (ESP32-CAM capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wearable["Wearable Device"]
  node_camera["ESP32-CAM capture<br/>[freshhhcam.ino]"]
  node_ultrasonic["Ultrasonic sensing<br/>[freshhhcam.ino]"]
end

subgraph group_server["Laptop Server"]
  node_upload["Image upload route<br/>[laptopserver.py]"]
  node_vision["Vision description<br/>[laptopserver.py]"]
  node_cleanup["Text cleanup<br/>[laptopserver.py]"]
  node_result[("Last result state<br/>[laptopserver.py]")]
  node_last_route["Last-result route<br/>[laptopserver.py]"]
end

subgraph group_speech["Speech Output"]
  node_tts["Speech generation<br/>[laptopserver.py]"]
  node_playback["Audio playback<br/>[laptopserver.py]"]
end

node_user(("Visually impaired user"))
node_gtts["gTTS service"]
node_ffmpeg["FFmpeg conversion"]
node_speaker["Laptop audio output"]
node_openrouter["OpenRouter vision API"]

node_camera -.->|"uploads image"| node_upload
node_upload -->|"sends image"| node_vision
node_vision -->|"requests description"| node_openrouter
node_vision -->|"cleans response"| node_cleanup
node_cleanup -->|"updates state"| node_result
node_cleanup -->|"generates speech"| node_tts
node_tts -->|"creates MP3"| node_gtts
node_tts -->|"converts audio"| node_ffmpeg
node_tts -->|"plays WAV"| node_playback
node_playback -->|"outputs audio"| node_speaker
node_speaker -.->|"guides"| node_user
node_last_route -->|"reads state"| node_result

click node_camera "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/freshhhcam.ino"
click node_ultrasonic "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/freshhhcam.ino"
click node_upload "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py"
click node_vision "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py"
click node_cleanup "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py"
click node_result "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py"
click node_last_route "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py"
click node_tts "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py"
click node_playback "https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.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_camera,node_ultrasonic,node_user toneBlue
class node_upload,node_vision,node_cleanup,node_result,node_last_route toneAmber
class node_tts,node_playback,node_openrouter toneMint
class node_gtts,node_ffmpeg,node_speaker toneIndigo
```

## Components

### Wearable Device

- [ESP32-CAM capture](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/freshhhcam.ino): `freshhhcam.ino`
- [Ultrasonic sensing](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/freshhhcam.ino): `freshhhcam.ino`

### Laptop Server

- [Image upload route](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py): `laptopserver.py`
- [Vision description](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py): `laptopserver.py`
- [Text cleanup](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py): `laptopserver.py`
- [Last result state](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py): `laptopserver.py`
- [Last-result route](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py): `laptopserver.py`

### Speech Output

- [Speech generation](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py): `laptopserver.py`
- [Audio playback](https://github.com/bold-code-universal/ai-blind-assistant/blob/main/laptopserver.py): `laptopserver.py`

### Other components

- **Visually impaired user**
- **gTTS service**
- **FFmpeg conversion**
- **Laptop audio output**
- **OpenRouter vision API**

## Connections

- ESP32-CAM capture → Image upload route: uploads image
- Image upload route → Vision description: sends image (evidence: `laptopserver.py`)
- Vision description → OpenRouter vision API: requests description (evidence: `laptopserver.py`)
- Vision description → Text cleanup: cleans response (evidence: `laptopserver.py`)
- Text cleanup → Last result state: updates state (evidence: `laptopserver.py`)
- Text cleanup → Speech generation: generates speech (evidence: `laptopserver.py`)
- Speech generation → gTTS service: creates MP3 (evidence: `laptopserver.py`)
- Speech generation → FFmpeg conversion: converts audio (evidence: `laptopserver.py`)
- Speech generation → Audio playback: plays WAV (evidence: `laptopserver.py`)
- Audio playback → Laptop audio output: outputs audio (evidence: `laptopserver.py`)
- Laptop audio output → Visually impaired user: guides
- Last-result route → Last result state: reads state (evidence: `laptopserver.py`)
