CompassLink – Live Android Orientation & Motion Control
An Android-to-PC live orientation dashboard and customizable controller bridge streaming smartphone SensorManager quaternion data into a 3D handset visualization and Windows input engine.
Contribution: Built the Kotlin Android sensor service reading rotation-vector events via SensorManager.getQuaternionFromVector.

Problem & Audience
Problem: Real-time phone orientation visualization and motion input typically depend on fragile LAN discovery or opaque drivers without live telemetry diagnostics.
Target Audience: PC simulation users, developers inspecting live mobile IMU telemetry, and gamers experimenting with phone-based motion controls.
Role: Sole Author & Systems Developer
Outcome & Personal Contribution
Delivered a Kotlin SensorManager companion streaming normalized quaternions over USB/wireless ADB reverse tunneling into a Node.js + HTML5 Canvas 3D dashboard and Windows virtual input bridge.
- Built the Kotlin Android sensor service reading rotation-vector events via SensorManager.getQuaternionFromVector.
- Implemented newline-delimited JSON streaming over ADB reverse TCP tunneling (:8765) for zero-firewall USB and wireless ADB links.
- Created the local Node.js telemetry server, interactive HTML5 Canvas 3D handset wireframe, and Windows virtual Xbox/keyboard/mouse profile bridge.
Architecture & Data Flow
Motion input from Android SensorManager streams as normalized [x, y, z, w] quaternions across an ADB reverse TCP tunnel to a Node.js signal processor that drives the 3D Canvas dashboard and Windows host input.
Kotlin Android service samples device rotation vectors via SensorManager.getQuaternionFromVector into normalized [x, y, z, w] frames.
- 1. Motion Input (SensorManager): Kotlin Android service samples device rotation vectors via SensorManager.getQuaternionFromVector into normalized [x, y, z, w] frames.
[Quaternion [x, y, z, w] stream] - 2. Controller Bridge (ADB Reverse :8765): ADB reverse TCP forwarding routes phone frames to localhost:8765 over USB or wireless ADB without router multicast fragility.
[NDJSON over TCP :8765] - 3. Signal Processing (Node.js Parser): Node.js built-ins parse quaternion frames, compute heading, pitch, and roll Euler angles, and track measured sensor cadence.
[Heading / Pitch / Roll Euler readout] - 4. Host Interface (3D Canvas & Input): Renders the interactive 3D handset wireframe in HTML5 Canvas and maps motion/touch-look to hybrid keyboard/mouse or Windows XInput.
[3D Canvas + XInput readback]
Engineering Decisions & Trade-Offs
ADB Reverse Tunneling vs. Raw LAN UDP Broadcast
Decision: Chose ADB reverse TCP forwarding on port 8765 with newline-delimited JSON as the primary transport.
Trade-off: Requires ADB debugging enabled on the handset, in exchange for reliable USB/wireless connectivity across restrictive campus and public Wi-Fi networks.
Zero-Dependency HTML5 Canvas 3D Projection
Decision: Built a custom 3D rotation and perspective projection pipeline directly on HTML5 2D Canvas instead of bundling WebGL/Three.js.
Trade-off: Simpler wireframe and plane shading compared to full PBR meshes, while keeping the PC dashboard lightweight with Node.js built-ins and instant theme synchronization.
Testing & Verification Evidence
- Verified live USB and wireless ADB telemetry streaming against the local pc/index.html 3D Canvas dashboard.
- Validated drag-to-orbit inspection and XInput readback profiles on Windows.
- Browser Lab simulation includes deterministic unit tests for Euler-to-3D rotation projection and quaternion readout bounds.
Known Limitations & Scope
- Live phone streaming requires Android USB/wireless debugging (ADB) and Windows host tooling; the browser Lab runs a self-contained simulated handset model.
- Virtual Xbox controller output depends on Windows virtual gamepad driver availability on the host machine.
Captured Application Interfaces
