# thewriterben/wildcam_esp32 architecture

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

- Interactive diagram: https://gitdiagram.com/thewriterben/wildcam_esp32
- Repository: https://github.com/thewriterben/wildcam_esp32

## Overview

WildCAM_ESP32 is an ESP32-based wildlife monitoring platform: motion initiates image capture, on-device AI can classify wildlife, and images plus metadata are stored for later review or upload. The repository also contains gateway, cloud/API, web/mobile, networking, and distributed-learning capabilities. The README supports the core workflow and feature branches; sampled firmware references confirm several initialization dependencies, while many advanced implementations were not sampled, so those connections are omitted or marked unverified.

Main entry points: [`firmware/main.cpp`](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/main.cpp) (Firmware Runtime), [`backend/app.py`](https://github.com/thewriterben/wildcam_esp32/blob/main/backend/app.py) (Backend API), [`firmware/ml_models/wildlife_detector.h`](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/ml_models/wildlife_detector.h) (Wildlife Classifier), [`firmware/core/storage_manager.cpp`](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/core/storage_manager.cpp) (Image Storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Field Capture"]
  node_firmware["Firmware Runtime<br/>[main.cpp]"]
  node_camera["Camera Capture<br/>[camera_manager.h]"]
  node_storage[("Image Storage")]
  node_power["Power Control<br/>[power_manager.h]"]
end

subgraph group_analysis["AI and Sensing"]
  node_detector["Wildlife Classifier"]
  node_sensors["Environmental Sensors"]
  node_audio["Acoustic Detection"]
end

subgraph group_connectivity["Networking and Sync"]
  node_mesh["LoRa Mesh"]
  node_satellite["Satellite Link"]
  node_gateway["Raspberry Pi Gateway<br/>[main.py]"]
  node_edge_gateway["Edge Gateway<br/>[main.py]"]
  node_cloud_sync["Cloud Sync<br/>[cloud_sync.py]"]
end

subgraph group_services["Cloud and Services"]
  node_backend["Backend API<br/>[app.py]"]
  node_cloud_services["Cloud Services"]
  node_population["Population Analytics"]
  node_model_pipeline["Model Deployment"]
end

subgraph group_interfaces["User Interfaces"]
  node_web_dashboard["Web Dashboard<br/>[App.js]"]
  node_mobile_app["Mobile App<br/>[App.js]"]
  node_notifications["Push Notifications"]
end

node_wildlife(("Wildlife"))

node_wildlife -->|"triggers motion"| node_firmware
node_firmware -->|"initializes"| node_camera
node_firmware -->|"initializes"| node_detector
node_firmware -->|"initializes"| node_storage
node_firmware -->|"initializes"| node_power
node_firmware -->|"initializes"| node_sensors
node_camera -.->|"stores images"| node_storage
node_detector -->|"adds classification metadata"| node_storage
node_firmware -.->|"communicates over"| node_mesh
node_firmware -.->|"uses fallback link"| node_satellite
node_mesh -->|"sends detections"| node_gateway
node_gateway -->|"bridges data"| node_backend
node_edge_gateway -->|"dispatches sync"| node_cloud_sync
node_cloud_services -.->|"exposes cloud data"| node_backend
node_backend -.->|"serves analytics"| node_population
node_model_pipeline -->|"deploys models"| node_detector
node_backend -.->|"serves monitoring data"| node_web_dashboard
node_backend -.->|"serves camera data"| node_mobile_app
node_backend -.->|"triggers alerts"| node_notifications

click node_firmware "https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/main.cpp"
click node_camera "https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/src/camera/camera_manager.h"
click node_storage "https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/core/storage_manager.cpp"
click node_power "https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/power/power_manager.h"
click node_detector "https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/ml_models/wildlife_detector.h"
click node_sensors "https://github.com/thewriterben/wildcam_esp32/tree/main/firmware/src/sensors"
click node_gateway "https://github.com/thewriterben/wildcam_esp32/blob/main/edge/raspberry_pi/gateway/main.py"
click node_edge_gateway "https://github.com/thewriterben/wildcam_esp32/blob/main/edge_gateway/main.py"
click node_cloud_sync "https://github.com/thewriterben/wildcam_esp32/blob/main/edge_gateway/sync/cloud_sync.py"
click node_backend "https://github.com/thewriterben/wildcam_esp32/blob/main/backend/app.py"
click node_cloud_services "https://github.com/thewriterben/wildcam_esp32/blob/main/ESP32WildlifeCAM-main/firmware/src/production/enterprise/cloud/cloud_service_orchestrator.cpp"
click node_population "https://github.com/thewriterben/wildcam_esp32/blob/main/backend/routes/population_routes.py"
click node_model_pipeline "https://github.com/thewriterben/wildcam_esp32/blob/main/backend/ml/deployment_pipeline.py"
click node_web_dashboard "https://github.com/thewriterben/wildcam_esp32/blob/main/frontend/src/App.js"
click node_mobile_app "https://github.com/thewriterben/wildcam_esp32/blob/main/frontend/mobile/App.js"
click node_notifications "https://github.com/thewriterben/wildcam_esp32/blob/main/frontend/mobile/src/services/NotificationService.js"

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_firmware,node_camera,node_storage,node_power toneBlue
class node_detector,node_sensors,node_audio toneAmber
class node_mesh,node_satellite,node_gateway,node_edge_gateway,node_cloud_sync toneMint
class node_backend,node_cloud_services,node_population,node_model_pipeline toneRose
class node_web_dashboard,node_mobile_app,node_notifications,node_wildlife toneIndigo
```

## Components

### Field Capture

- [Firmware Runtime](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/main.cpp): `firmware/main.cpp`
- [Camera Capture](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/src/camera/camera_manager.h): `firmware/src/camera/camera_manager.h`
- [Image Storage](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/core/storage_manager.cpp): `firmware/core/storage_manager.cpp`
- [Power Control](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/power/power_manager.h): `firmware/power/power_manager.h`

### AI and Sensing

- [Wildlife Classifier](https://github.com/thewriterben/wildcam_esp32/blob/main/firmware/ml_models/wildlife_detector.h): `firmware/ml_models/wildlife_detector.h`
- [Environmental Sensors](https://github.com/thewriterben/wildcam_esp32/tree/main/firmware/src/sensors): `firmware/src/sensors`
- **Acoustic Detection**

### Networking and Sync

- **LoRa Mesh**
- **Satellite Link**
- [Raspberry Pi Gateway](https://github.com/thewriterben/wildcam_esp32/blob/main/edge/raspberry_pi/gateway/main.py): `edge/raspberry_pi/gateway/main.py`
- [Edge Gateway](https://github.com/thewriterben/wildcam_esp32/blob/main/edge_gateway/main.py): `edge_gateway/main.py`
- [Cloud Sync](https://github.com/thewriterben/wildcam_esp32/blob/main/edge_gateway/sync/cloud_sync.py): `edge_gateway/sync/cloud_sync.py`

### Cloud and Services

- [Backend API](https://github.com/thewriterben/wildcam_esp32/blob/main/backend/app.py): `backend/app.py`
- [Cloud Services](https://github.com/thewriterben/wildcam_esp32/blob/main/ESP32WildlifeCAM-main/firmware/src/production/enterprise/cloud/cloud_service_orchestrator.cpp): `ESP32WildlifeCAM-main/firmware/src/production/enterprise/cloud/cloud_service_orchestrator.cpp`
- [Population Analytics](https://github.com/thewriterben/wildcam_esp32/blob/main/backend/routes/population_routes.py): `backend/routes/population_routes.py`
- [Model Deployment](https://github.com/thewriterben/wildcam_esp32/blob/main/backend/ml/deployment_pipeline.py): `backend/ml/deployment_pipeline.py`

### User Interfaces

- [Web Dashboard](https://github.com/thewriterben/wildcam_esp32/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Mobile App](https://github.com/thewriterben/wildcam_esp32/blob/main/frontend/mobile/App.js): `frontend/mobile/App.js`
- [Push Notifications](https://github.com/thewriterben/wildcam_esp32/blob/main/frontend/mobile/src/services/NotificationService.js): `frontend/mobile/src/services/NotificationService.js`

### Other components

- **Wildlife**

## Connections

- Wildlife → Firmware Runtime: triggers motion
- Firmware Runtime → Camera Capture: initializes (evidence: `firmware/main.cpp`)
- Firmware Runtime → Wildlife Classifier: initializes (evidence: `firmware/main.cpp`)
- Firmware Runtime → Image Storage: initializes (evidence: `firmware/main.cpp`)
- Firmware Runtime → Power Control: initializes (evidence: `firmware/main.cpp`)
- Firmware Runtime → Environmental Sensors: initializes (evidence: `firmware/main.cpp`)
- Camera Capture → Image Storage: stores images
- Wildlife Classifier → Image Storage: adds classification metadata
- Firmware Runtime → LoRa Mesh: communicates over
- Firmware Runtime → Satellite Link: uses fallback link
- LoRa Mesh → Raspberry Pi Gateway: sends detections
- Raspberry Pi Gateway → Backend API: bridges data
- Edge Gateway → Cloud Sync: dispatches sync (evidence: `edge_gateway/main.py`)
- Cloud Services → Backend API: exposes cloud data
- Backend API → Population Analytics: serves analytics
- Model Deployment → Wildlife Classifier: deploys models (evidence: `backend/ml/deployment_pipeline.py`)
- Backend API → Web Dashboard: serves monitoring data
- Backend API → Mobile App: serves camera data
- Backend API → Push Notifications: triggers alerts
