How danieltone/cubesat-simulator-using-esp32s works
1. What this repo is
- This is a CubeSat telemetry simulation and ground-segment prototype, not a full mission stack.
- It produces realistic-looking bus telemetry, moves it over either USB serial or ESP-NOW, and turns it into CSV/SQLite, reports, and HTML dashboards.
2. Onboard / “spacecraft” simulator
- cubesat_simulator.ino is the main flight-side telemetry generator.
- It emits a full telemetry JSON line every 15 seconds over Serial and can also send a compact heartbeat over ESP-NOW.
- The simulated fields cover orbit, EPS, thermal, ADCS, comms health, and general fault/watchdog state.
- This is the primary data source for the rest of the system.
3. Optional over-the-air relay path
- ground_station_receiver.ino is the dedicated receiver firmware for a second ESP32 board.
- In the tested architecture, the XIAO ESP32-C3 transmits via ESP-NOW to this receiver, and the receiver forwards data to the host over USB serial.
- The receiver MAC address is a key boundary value: the transmitter must be configured with the receiver’s MAC before the link works.
4. Host ingestion and decoding
- ground_station_logger.py is the ground-side ingestion service.
- It reads telemetry from either a serial port or stdin, parses JSON lines, and writes records to persistent storage.
- It is the boundary between raw transport and mission data products.
5. Persistence layer
- The logger writes both data/telemetry.csv and data/telemetry.db.
- SQLite is the primary structured store for downstream analytics and dashboards; CSV is a simple export/archive path.
- The repo also includes demo SQLite databases under demo/db/ for presentation and offline use.
6. Analytics and reporting
- telemetry_report.py reads the SQLite database and computes summary statistics, anomaly counts, and latest-state reporting.
- This is the “ops reporting” layer: it consumes stored telemetry rather than live transport.
- Thresholds are configurable, which makes anomaly detection a post-ingest analysis step rather than part of the simulator.
7. Offline dashboard generation
- telemetry_dashboard.py turns SQLite telemetry into a static HTML dashboard with charts and anomaly tables.
- The dashboard is generated from stored data, so the visualization layer is decoupled from the logger and can be rebuilt from history.
- generate_demo_dashboards.py produces the prebuilt demo HTML pages in demo/dashboards/.
8. Live dashboard serving
- live_dashboard_server.py adds a thin local web-serving layer that regenerates the dashboard on a timer and serves it on localhost.
- This creates a near-real-time operator view without changing the ingestion pipeline.
- The live server depends on the SQLite database produced by the logger.
9. Demo mode vs live mode
- The repo is split into two operating modes:
- Live mode: hardware telemetry path from simulator/receiver to logger to dashboard.
- Demo mode: pre-generated databases and HTML dashboards under demo/ for offline presentation.
- run_live_demo.sh ties the live workflow together, while the demo/ directory provides ready-made sample outputs.
10. Firmware build and hardware packaging
- pio_upload/ and pio_receiver_upload/ are PlatformIO projects for the simulator and receiver firmware variants.
- cubesat_3d_printfiles/ contains STL parts for a physical CubeSat mock enclosure, which is adjacent to but separate from the telemetry pipeline.
- The repo therefore spans both software and physical mockup artifacts.
11. Operational/documentation boundary
- The root markdown files describe setup, wiring, telemetry flow, serial connections, and operator usage.
- PIPELINE_FLOWCHART.md and TELEMETRY_PIPELINE.md are especially relevant for diagramming because they document the intended end-to-end data path and system boundaries.
12. Key architecture diagram takeaway
- The central flow is: telemetry generation on ESP32 firmware → transport over Serial or ESP-NOW → PC logger/decoder → SQLite/CSV storage → report/dashboard generation → optional local web serving.
- The biggest boundary is between the embedded telemetry source and the host-side ground software; a second important boundary is between live ingestion and offline/demo visualization.
Main entry points: cubesat_simulator.ino Simulator · ground_station_logger.py Logger · ground_station_receiver.ino Receiver · TELEMETRY_PIPELINE.md Pipeline docs
Components 16
Embedded side
Flight-side telemetry generation and optional ESP-NOW relay
Ground segment
Host-side ingestion, storage, reporting, and serving
- Logger · Reads serial or stdin, parses JSON telemetry, and writes persistent records
ground_station_logger.py - Telemetry DB · Persistent telemetry storage used by downstream analytics and dashboards
- Report · Computes summaries, anomaly counts, and latest-state operational reporting
telemetry_report.py - Dashboard · Builds charted HTML dashboards and anomaly tables from SQLite telemetry
telemetry_dashboard.py - Live server · Regenerates dashboards on a timer and serves them on localhost
live_dashboard_server.py - Live demo · Convenience script tying together the live telemetry workflow
run_live_demo.sh
Demo assets
Prebuilt sample data and static dashboard outputs
- Demo builder · Creates the prebuilt demo dashboards from sample databases
generate_demo_dashboards.py - Demo DBs · Prebuilt telemetry databases used for offline demos and presentation
demo/db - Demo HTML · Pre-rendered dashboard examples for nominal and anomaly scenarios
demo/dashboards
Docs
Operator and pipeline documentation
- Pipeline docs · Architecture and operator documentation for the telemetry flow and setup
TELEMETRY_PIPELINE.md - Operator guides · Setup, wiring, serial connection, and operator cheat-sheet material
README.md
Hardware packaging
Firmware build projects and physical mockup parts
- Flight build · Build/upload project for the simulator firmware variant
pio_upload/src/main.ino - Receiver build · Build/upload project for the ESP-NOW receiver firmware variant
pio_receiver_upload/src/main.cpp - CubeSat parts · 3D-printable mockup enclosure and frame components
cubesat_3d_printfiles
Connections 17
- Simulator → Logger: USB serial · Direct host ingestion path when simulator is connected by serial
- Simulator → Receiver: ESP-NOW · Wireless telemetry/heartbeat path to the receiver board
- Receiver → Logger: USB serial · Forwarded telemetry stream into the host logger
- Logger → Telemetry DB: write · Persists telemetry to CSV and SQLite
- Telemetry DB → Report: read · Report layer consumes stored telemetry for summaries and anomalies
- Telemetry DB → Dashboard: read · Dashboard generator renders charts from database history
- Dashboard → Live server: serve · Live server serves regenerated dashboard content locally
- Demo DBs → Demo builder: input · Sample databases used to build demo pages
- Demo builder → Demo HTML: output · Produces prebuilt static dashboard examples
- Logger → Live demo: orchestrate · Live workflow wrapper invokes ingestion and display steps
- Telemetry DB → Live demo: depends on · Live demo assumes the logger has populated the database
- Pipeline docs → Simulator: documents · Documents end-to-end telemetry flow and boundaries
- Pipeline docs → Logger: documents · Describes the host ingestion and storage boundary
- Operator guides → Receiver: documents · Covers serial wiring and receiver setup
- Flight build → Simulator: builds · PlatformIO packaging for simulator firmware
- Receiver build → Receiver: builds · PlatformIO packaging for receiver firmware
- CubeSat parts → Simulator: physical mockup · Mechanical parts adjacent to the telemetry prototype