This project simulates the Raspberry Pi CAN bus reader for testing the SC2 mobile app.
Real System: Firmware → Raspberry Pi (CAN) → Supabase → Mobile App
This Tester: CSV/Fake Data → Parser → Supabase → Mobile App
-
Install dependencies:
npm install
-
Configure environment variables:
Create a
.envfile or set environment variables:export SUPABASE_URL="https://your-project.supabase.co" export SUPABASE_ANON_KEY="your-anon-key"
-
Set up Supabase database:
Run the SQL schema in
sql/create_tables.sqlin your Supabase SQL Editor.
Uploads data row by row with 1-second intervals, simulating real-time telemetry:
npm start
# or
node src/upload_telemetry.js streamUploads all data at once:
npm run batch
# or
node src/upload_telemetry.js batchCreates new test data with all 140+ signals:
npm run generateVerify Supabase connection:
npm testsc2-telemetry-tester/
├── data/
│ ├── data_format.json # Official firmware data format (shared)
│ └── test_telemetry.csv # Test data for simulation
├── src/
│ ├── upload_telemetry.js # Main upload script
│ ├── generate_test_data.js # Generate realistic test data
│ └── test_connection.js # Test Supabase connection
├── sql/
│ └── create_tables.sql # Supabase schema
└── package.json
The data_format.json contains the official firmware data format with 140+ signals:
{
"signal_name": [num_bytes, "data_type", "units", nominal_min, nominal_max, "Category;Subsystem"]
}Categories:
- MCC - Motor Controller Computer
- High Voltage - Shutdown, MPS
- Battery - BMS CAN, BMS, Supplemental
- Main IO - Sensors, Lights, Firmware
- Solar Array - MPPT, Sensors
- Software - Timestamp, GPS, Lap Counter
- Race Strategy - Model Outputs
The mobile app should ONLY read from Supabase. This tester handles:
- Reading data from CSV or generating fake data
- Parsing to match the official data format
- Uploading to Supabase
telemetry_latesttable - The mobile app subscribes to real-time updates
The data_format.json should be identical across:
- This tester project
- The mobile app project
- The firmware project
Consider using a git submodule or npm package for the shared format.