Steam Controller Auto-Charge – pilot to magnetic charging puck using CV
This open-source project showcases an ingenious method for a Steam Controller to autonomously navigate to its magnetic charging puck. It employs optical flow computer vision, WebHID telemetry, and haptic feedback to guide the controller to its charging point. This blend of hardware interaction, low-level control, and visual processing makes it a classic Hacker News favorite for its sheer technical cleverness.
The Lowdown
The "Steam Controller Auto-Charge" project by FossPrime presents a fascinating open-source solution for automating the charging process of a Steam Controller. Utilizing an overhead camera and advanced computer vision, the system guides the controller to its magnetic charging puck through precise haptic feedback, transforming a mundane task into a display of engineering ingenuity.
- Optical Flow Tracking: The system uses OpenCV.js to track user-selected points on the controller and the charging puck in real-time via an overhead camera.
- WebHID & Haptic Navigation: It connects to the Steam Controller natively via WebHID, streaming telemetry and using 70Hz asymmetric haptic pulses from the internal Linear Resonant Actuators (LRAs) to steer the controller.
- Proximity Creep Mode: To ensure a gentle dock, the haptic pulse frequency is automatically halved when the controller is within 150 pixels of the puck.
- Battery Status Polling: The project intercepts specific WebHID reports to confirm successful charging and display live battery percentage and voltage.
- Simplified Setup: Requires a Chromium-based browser with WebHID support, an overhead webcam, and leverages Nix Package Manager for easy dependency management and WASM module building.
- Autonomous Operation: Once set up, the controller autonomously navigates to the puck using a Lucas-Kanade optical flow loop combined with object avoidance powered by an in-browser Rust/WASM Convolutional Neural Network (CNN).
- Architectural Highlights: Built with Vue 3, it separates concerns with
App.vuefor logic,steamController.tsfor WebHID abstraction, and offloads object detection to a Web Worker using Rust compiled to WebAssembly for performance.
This project stands out as a prime example of creative problem-solving through advanced technological integration, demonstrating how sophisticated computer vision and low-level hardware control can be combined for a surprisingly practical, albeit whimsical, automation task.