# photobooth-app/photobooth-buzzer architecture

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

- Interactive diagram: https://gitdiagram.com/photobooth-app/photobooth-buzzer
- Repository: https://github.com/photobooth-app/photobooth-buzzer

## Overview

Photobooth Buzzer is ESP32 firmware for a battery-powered physical button that emulates a Bluetooth HID keyboard to trigger photo captures. On startup it configures the button and BLE HID services and starts a fuel-gauge task; while connected, a button tap sends the configured key as press/release reports for the paired photobooth host. The README also documents battery status reporting and USB-C charging/programming, while CAD assets describe the physical build. Firmware behavior is evidenced by the sole sampled source file; hardware capabilities beyond the code are described in the README.

Main entry points: [`src/main.cpp`](https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp) (Tap handler), [`cad/solidworks/buzzer-case.SLDASM`](https://github.com/photobooth-app/photobooth-buzzer/blob/main/cad/solidworks/buzzer-case.SLDASM) (Buzzer button), [`README.md`](https://github.com/photobooth-app/photobooth-buzzer/blob/main/README.md) (Battery gauge), [`cad/solidworks/buzzer.SLDASM`](https://github.com/photobooth-app/photobooth-buzzer/blob/main/cad/solidworks/buzzer.SLDASM) (Printed enclosure)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["ESP32 firmware"]
  node_button["Button input<br/>[main.cpp]"]
  node_tap["Tap handler<br/>[main.cpp]"]
  node_keyreports["Key reports<br/>[main.cpp]"]
  node_ble["BLE HID setup<br/>[main.cpp]"]
  node_fuel["Fuel gauge task<br/>[main.cpp]"]
  node_batteryreport["Battery status<br/>[main.cpp]"]
end

subgraph group_hardware["Device hardware"]
  node_buzzer["Buzzer button<br/>[buzzer-case.SLDASM]"]
  node_battery["Battery gauge<br/>[README.md]"]
  node_enclosure["Printed enclosure<br/>[buzzer.SLDASM]"]
  node_charging["USB-C charging<br/>[README.md]"]
end

node_user(("Photobooth user"))
node_host(("Photobooth host"))

node_user -->|"presses"| node_buzzer
node_buzzer -.->|"actuates"| node_button
node_button -->|"dispatches"| node_tap
node_tap -->|"checks connection"| node_ble
node_tap -->|"calls"| node_keyreports
node_keyreports -->|"sends keystrokes"| node_host
node_ble -->|"advertises HID"| node_host
node_battery -.->|"measures charge"| node_fuel
node_fuel -->|"reads charge"| node_batteryreport
node_batteryreport -->|"sets HID level"| node_ble
node_charging -->|"charges"| node_battery
node_enclosure -.->|"houses"| node_buzzer

click node_buzzer "https://github.com/photobooth-app/photobooth-buzzer/blob/main/cad/solidworks/buzzer-case.SLDASM"
click node_button "https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp"
click node_tap "https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp"
click node_keyreports "https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp"
click node_ble "https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp"
click node_battery "https://github.com/photobooth-app/photobooth-buzzer/blob/main/README.md"
click node_fuel "https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp"
click node_batteryreport "https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp"
click node_enclosure "https://github.com/photobooth-app/photobooth-buzzer/blob/main/cad/solidworks/buzzer.SLDASM"
click node_charging "https://github.com/photobooth-app/photobooth-buzzer/blob/main/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_button,node_tap,node_keyreports,node_ble,node_fuel,node_batteryreport,node_user toneBlue
class node_buzzer,node_battery,node_enclosure,node_charging toneAmber
class node_host toneIndigo
```

## Components

### ESP32 firmware

- [Button input](https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp): `src/main.cpp`
- [Tap handler](https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp): `src/main.cpp`
- [Key reports](https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp): `src/main.cpp`
- [BLE HID setup](https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp): `src/main.cpp`
- [Fuel gauge task](https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp): `src/main.cpp`
- [Battery status](https://github.com/photobooth-app/photobooth-buzzer/blob/main/src/main.cpp): `src/main.cpp`

### Device hardware

- [Buzzer button](https://github.com/photobooth-app/photobooth-buzzer/blob/main/cad/solidworks/buzzer-case.SLDASM): `cad/solidworks/buzzer-case.SLDASM`
- [Battery gauge](https://github.com/photobooth-app/photobooth-buzzer/blob/main/README.md): `README.md`
- [Printed enclosure](https://github.com/photobooth-app/photobooth-buzzer/blob/main/cad/solidworks/buzzer.SLDASM): `cad/solidworks/buzzer.SLDASM`
- [USB-C charging](https://github.com/photobooth-app/photobooth-buzzer/blob/main/README.md): `README.md`

### Other components

- **Photobooth user**
- **Photobooth host**

## Connections

- Photobooth user → Buzzer button: presses (evidence: `README.md`)
- Buzzer button → Button input: actuates
- Button input → Tap handler: dispatches (evidence: `src/main.cpp`)
- Tap handler → BLE HID setup: checks connection (evidence: `src/main.cpp`)
- Tap handler → Key reports: calls (evidence: `src/main.cpp`)
- Key reports → Photobooth host: sends keystrokes (evidence: `src/main.cpp`)
- BLE HID setup → Photobooth host: advertises HID (evidence: `src/main.cpp`)
- Battery gauge → Fuel gauge task: measures charge
- Fuel gauge task → Battery status: reads charge (evidence: `src/main.cpp`)
- Battery status → BLE HID setup: sets HID level (evidence: `src/main.cpp`)
- USB-C charging → Battery gauge: charges (evidence: `README.md`)
- Printed enclosure → Buzzer button: houses
