How hika583/edgingthebuilding works
1. Overall shape
- This repo is a multi-tier IoT/building telemetry system: ESP32 devices at the edge, a Jetson-based gateway/preprocessor in the middle, and a cloud backend plus dashboard on top.
- The main boundary is between device firmware and Python services; data is normalized by shared schemas before reaching backend consumers.
2. Device layer: ESP32-C6 sensor nodes
- esp-firmware/esp32-c6-sensors contains firmware and examples for sensor nodes and output nodes.
- The examples (jetson_sensor_node_demo, jetson_output_node_demo, jetson_gateway_dashboard_demo, jetson_register_test) show the intended flows: register devices, emit sensor readings, and interact with a Jetson gateway.
- packet-format.md documents the wire format these devices use, so this is a protocol boundary rather than just a firmware repo.
3. Device layer: ESP32-S3 camera nodes
- esp-firmware/esp32-s3-camera is a separate firmware subtree for camera devices.
- firmware/camera_stream_portal includes the actual camera streaming implementation (app_httpd.cpp, pin/preset configs, secrets), which indicates direct streaming from the device rather than sending camera frames through the same sensor pipeline.
- stream-format.md documents the camera stream contract, which is distinct from the sensor packet format.
4. Jetson gateway / edge hub
- jetson-device-gateway is the on-prem edge service, packaged for containerized deployment via Dockerfile and docker-compose.yml.
- Its app/ folder (main.py, database.py, schemas.py) suggests it receives device traffic, stores local state, and exposes an API for downstream use.
- scripts/setup_jetson_orin.sh and data/ indicate it is meant to run on a Jetson Orin as a persistent field gateway.
5. Edge preprocessing
- edge-preprocessing/app/esp32-c6-sensors/sensor_data_processor.py is a dedicated processing step for sensor telemetry.
- This is the clearest place where raw ESP32 sensor packets are transformed before being forwarded, aggregated, or analyzed.
- Architecturally, it sits between low-level device packets and higher-level backend records.
6. Cloud backend
- cloud-backend is the centralized server-side API and persistence layer.
- The structure (app/main.py, routes.py, models.py, schemas.py, database.py) shows a classic separation of request handling, data models, validation contracts, and storage access.
- cloud-backend/data/ suggests local persisted state or a database file/bucket mounted into the service.
7. Dashboard
- cloud-dashboard/index.html is a static frontend, not a large client application.
- It likely consumes the cloud backend API directly to render device status, sensor readings, and camera-related events.
- Because there is no build pipeline in the tree, the dashboard is a lightweight presentation layer rather than a separate frontend subsystem.
8. Shared contract layer
- shared/schemas/*.schema.json defines the canonical JSON shapes for camera-event, device-status, and sensor-reading.
- shared/sample-payloads/*.example.json provides example messages for those same event types.
- This shared folder is important architecturally: it keeps the Jetson service, cloud backend, dashboard, and device-facing tooling aligned on payload structure.
9. Documentation as an architecture boundary
- docs/architecture.md, docs/api-contract.md, docs/device-packet-format.md, and docs/team-responsibilities.md indicate the repo treats contracts and subsystem boundaries as first-class artifacts.
- The top-level CS131 Phase 2_ Design.pdf likely captures the system design narrative, while jetson-esp-wifi-topology.md documents the network deployment pattern.
10. Deployment model
- There are two operational environments: edge/local on the Jetson (jetson-device-gateway, device firmware, preprocessing) and cloud (cloud-backend, cloud-dashboard).
- docker-compose.jetson.yml and the Jetson service’s compose file reinforce that the gateway is expected to run as a deployable field stack.
- The ESP firmware repos are separate from the Python services, so device builds and server deployments are intentionally decoupled.
11. Primary data flow
- ESP32 sensors and cameras generate packets/streams.
- The Jetson gateway and preprocessing layer handle local ingestion and normalization, using the shared payload contracts.
- The cloud backend persists and serves the normalized data.
- The dashboard reads from the cloud backend to present the system state to users.
Main entry points: cloud-backend/app Cloud API · schemas Schemas · jetson-device-gateway/app Gateway app · camera_stream_portal Camera portal
Components 19
Device firmware
ESP32 firmware for sensor and camera nodes
- ESP32 C6 · Sensor and output node firmware for the ESP32-C6 device family
esp-firmware/esp32-c6-sensors - C6 demos · Reference device flows for sensor, output, registration, and gateway interaction
esp-firmware/esp32-c6-sensors/examples - Packet format · Wire format for ESP32-C6 sensor packets
esp-firmware/esp32-c6-sensors/packet-format.md - ESP32 S3 · ESP32-S3 camera device subtree
esp-firmware/esp32-s3-camera - Camera portal · Camera streaming implementation and device-side portal
esp-firmware/esp32-s3-camera/firmware/camera_stream_portal - Stream format · Contract for camera stream payloads and framing
esp-firmware/esp32-s3-camera/stream-format.md
Edge / Jetson
On-prem gateway and preprocessing services
- Gateway app · Edge gateway entrypoint for device ingestion and API handling
jetson-device-gateway/app - Gateway store · Local state and persistence used by the Jetson gateway
jetson-device-gateway/app/database.py - Gateway schemas · Gateway request and response validation models
jetson-device-gateway/app/schemas.py - Sensor processor · Edge preprocessing step that normalizes ESP32-C6 sensor telemetry
edge-preprocessing/app/esp32-c6-sensors/sensor_data_processor.py
Cloud
Central backend and dashboard
- Cloud API · Central backend entrypoint for persistence and serving data
cloud-backend/app - API routes · HTTP route handling for backend endpoints
cloud-backend/app/routes.py - Data models · Backend domain entities and persistence models
cloud-backend/app/models.py - Backend schemas · Backend validation and response contracts
cloud-backend/app/schemas.py - Cloud store · Backend persistence layer and data storage access
cloud-backend/app/database.py - Dashboard · Lightweight browser-based presentation layer
cloud-dashboard/index.html
Shared contracts
Canonical payload schemas and examples
- Schemas · Canonical event and reading schemas shared across the stack
shared/schemas - Payload examples · Example payloads for the shared event contracts
shared/sample-payloads
Docs
Repository-level design and contract documentation
- Architecture docs · Repository documentation for system boundaries and deployment model
docs/architecture.md
Connections 20
- ESP32 C6 → Packet format: emits · Device firmware follows the packet boundary when producing telemetry
- C6 demos → ESP32 C6: demonstrates · Examples show the intended sensor, output, and registration flows
- ESP32 S3 → Camera portal: contains · Camera subtree includes the streaming portal implementation
- Camera portal → Stream format: uses · Camera portal is governed by its own stream contract
- Packet format → Sensor processor: feeds · Raw sensor packets are the input to edge preprocessing
- Sensor processor → Schemas: normalizes to · Edge preprocessing converts telemetry into shared message shapes
- Gateway app → Gateway schemas: validates with · Gateway API relies on local request/response schemas
- Gateway app → Gateway store: persists to · Gateway stores local state and device records
- Gateway app → Sensor processor: ingests from · Gateway and preprocessing together form the edge normalization path
- Schemas → Gateway schemas: aligns · Shared payload shapes keep gateway contracts consistent
- Schemas → Backend schemas: aligns · Cloud backend uses the same canonical event shapes
- Cloud API → API routes: exposes · Backend routes handle external requests
- Cloud API → Data models: defines · Backend service is organized around domain models
- Cloud API → Backend schemas: validates with · Backend request and response contracts are schema-driven
- Cloud API → Cloud store: persists to · Backend reads and writes through its storage layer
- Gateway app → Cloud API: forwards · Edge-normalized data is forwarded to the cloud backend
- Payload examples → Schemas: illustrates · Examples document the canonical payload shapes
- Cloud API → Dashboard: serves · Dashboard consumes backend data directly
- Camera portal → Cloud API: publishes metadata · Camera subsystem is represented upstream through backend-facing events
- Architecture docs → Schemas: documents · Repository docs call out contracts as a first-class boundary