Skip to main content

End-to-End System Architecture

📌 What is this for? (Quick Summary for New Interns)​

In Simple Words:
This page shows the big picture of how all the pieces connect.
If someone asks: "How does the speed number on my laptop screen actually get there from the vehicle?" — this page explains that journey:

  1. Physical sensors on the vehicle measure speed, battery voltage, and temperatures.
  2. A Raspberry Pi on the vehicle collects these numbers and sends them over cellular or Wi-Fi to AWS cloud servers.
  3. Cloud databases store the numbers.
  4. Your web browser requests the latest numbers every second and displays them on dials and in an interactive 3D simulation.

1. Multi-Tier Architecture Diagram​

graph TB
subgraph Trackside["1. Physical Vehicle on Track"]
Sensors["CAN Sensor Nodes\n• Speed & Accel\n• Battery Temperatures (4 cells)\n• Inverter 3-Phase Temperatures\n• LIM Temperature\n• Main Contactor Status"]
CAM["Dual IP Cameras\n• CAM 1: Forward Track\n• CAM 2: Rear Cabin / Dock"]
RPi["Raspberry Pi 5 Gateway / EC2 Testbed\n• go_server (:20006)\n• emulator (600m Run)\n• stream_service (RTSP Forwarder)"]
end

subgraph Transport["2. Wireless Transport"]
MQTT_Line["AWS IoT Core MQTT (tutr/telemetry)"]
Influx_Line["HTTPS Line Protocol (influxdb.tutr.tech)"]
RTSP_Line["RTSP TCP Streams (:8554/cam1, :8554/cam2)"]
end

subgraph Cloud["3. AWS Cloud Servers (ap-south-1 Mumbai)"]
MediaMTX["MediaMTX Live Video Server\n• RTSP Listener: :8554\n• WebRTC Engine: :8889\n• HLS Muxer: :8888"]
InfluxCloud["InfluxDB Cloud\n• Bucket: telemetry\n• Metric Retention: 30 days"]
IoTCore["AWS IoT Core Broker\n• Topic: tutr/control\n• Topic: tutr/telemetry"]
Cognito["AWS Cognito Login\n• Pool: ap-south-1_IXNCZVwj4\n• Client: 5eup0104notrn3fn4415u3fq3b"]
APIGateway["AWS API Gateway v2 HTTP API\n• ID: npig3gpgck\n• Route: POST /api\n• JWT Authorizer: CognitoAuth"]
Lambda["PodDashboardRouter (Node.js 20)\n• Influx Flux Query Pipeline\n• DynamoDB Session Bouncer\n• AWS IoT Control Publisher"]
Dynamo["DynamoDB Tables\n• PodOperations (Audit Logs)\n• ActiveSessions (Single-Login Tracker)"]
end

subgraph Clients["4. Operator Web Dashboards"]
Dash2D["2D Operations Dashboard (dashboard.tutr.tech)\n• React 19 + Lucide + Tailwind\n• Closed-loop Contactor Verification\n• Emergency Radio Voice Alarms"]
Twin3D["3D Simulation Dashboard (ThreeJsForDemoPurpose)\n• React Three Fiber + 600m Track Model\n• Smooth 60 FPS Motion\n• WebRTC Glassmorphic CAM 1 PiP"]
end

Sensors -->|Binary CAN Frames 0x16..0x21| RPi
CAM -->|RTSP 554| RPi
RPi --> MQTT_Line --> IoTCore
RPi --> Influx_Line --> InfluxCloud
RPi --> RTSP_Line --> MediaMTX

MediaMTX -->|WebRTC :8889| Dash2D
MediaMTX -->|WebRTC :8889| Twin3D

Cognito -->|ID Token (JWT)| Dash2D
Cognito -->|ID Token (JWT)| Twin3D

Dash2D <-->|POST /api with Bearer Token| APIGateway
Twin3D <-->|POST /api with Bearer Token| APIGateway

APIGateway --> Lambda
Lambda <--> InfluxCloud
Lambda <--> Dynamo
Lambda --> IoTCore

2. The 3 Data Pipelines Explained​

2.1 Sensor Numbers Pipeline (Every 1 Second)​

  1. Sensors broadcast: Sensors on the vehicle broadcast their measurements 10 times a second over the vehicle's internal CAN network wires.
  2. Raspberry Pi ingests: A program called go_server reads these raw bytes on port 20006, converts them into normal numbers (like 364 Volts or 45 km/h), and uploads them.
  3. Cloud stores: The numbers are saved in InfluxDB Cloud (a time-series database designed for sensor charts).
  4. Dashboard displays: The web dashboard asks our AWS API Gateway for the newest numbers once a second, updating the gauges and the 3D position.

2.2 Operator Control Pipeline (Instant Action)​

  1. Operator clicks a button: The operator clicks Enable Battery or Launch Pod.
  2. Permission check: The dashboard verifies that the logged-in user is an Admin or Engineer (managers have view-only rights).
  3. AWS IoT command: A lightweight command is sent through AWS IoT Core down to the vehicle within 200 milliseconds.
  4. Physical switch engages: The vehicle's main battery switch closes, turning on 364V power.
  5. Voltage confirmation: The dashboard waits to physically see the battery voltage read above 48 Volts before enabling the Launch button.

2.3 Live Camera Pipeline (Under 1 Second Delay)​

  1. Two IP cameras on the vehicle point forward down the track (CAM 1) and backwards into the dock (CAM 2).
  2. The stream_service program optimizes the video feed so that keyframes are sent every second with zero buffering delays.
  3. MediaMTX converts the stream to WebRTC so web browsers can play it immediately with zero plugins.

3. Network Ports & Firewall Rules​

ServiceProtocolPortWho ConnectsWhat It Is Used For
Go Gateway ServerTCP20006Vehicle sensors / SimulatorIngestion of raw CAN sensor packets
Emulator Web UIHTTP5001EngineersLocal test control panel to start simulated runs
MediaMTX RTSPTCP8554Pod Camera ForwarderIngestion of video from the vehicle
MediaMTX WebRTCHTTP/HTTPS8889Web BrowsersUltra-fast video playback in your browser
MediaMTX MediaUDP8189Web BrowsersVideo data packets
AWS API GatewayHTTPS443Web BrowsersMain backend REST API (POST /api)
InfluxDB CloudHTTPS443Gateway & LambdaStoring and querying historical sensor numbers