This repository contains a collection of projects and utilities for controlling addressable LEDs (such as WLED) using SteamVR-compatible VR controllers. The main focus is on mapping and controlling LEDs in real-time based on VR controller position and orientation, with additional features and experimental scripts for advanced LED effects and games.
A Python package to control LED strips using a VR controller. It allows you to map the physical positions of LEDs in 3D space and light them up interactively using your VR controller.
- LED Mapping: Map the physical positions of LEDs using a VR controller.
- Real-Time Control: Light up LEDs in real-time based on the VR controller's position and orientation.
- Fading Effects: Smooth fading effects for LEDs.
- WLED Integration: Send LED data to a WLED controller using the DDP protocol.
- Customizable: Configure LED count, IP address, and other settings.
- Mini-Games: Includes a Battleship game using the LED strip and VR controllers.
VR_LED_Project/
│
├── vr_led_controller/ # Main package for VR LED control
│ ├── audio_manager.py # Handles sound effects for games and feedback
│ ├── battleship.py # Battleship game logic using LEDs and VR
│ ├── config.py # Configuration (WLED IP, LED count, etc.)
│ ├── controller.py # VR controller abstraction and input handling
│ ├── helpers.py # Utility functions (math, orientation, etc.)
│ ├── led_manager.py # LED state, DDP protocol, and effects
│ ├── main.py # Main entry point for mapping/controlling LEDs
│ ├── requirements.txt # Python dependencies
│ ├── vr_manager.py # VR system setup, mapping, and tracking
│ ├── sounds/ # Sound files for feedback and games
│ └── readme.md # Detailed documentation for the package
│
├── README.md # (This file) Project overview and usage
├── LICENSE # MIT License
├── CODE_OF_CONDUCT.md # Contributor code of conduct
├── CONTRIBUTING.md # Contribution guidelines
├── SECURITY.md # Security policy
├── DDP_LED_Test.py # Test script for DDP LED communication
├── VR_WLED_Test.py # Test script for VR to WLED integration
└── led_mapping.json # Example or generated LED mapping data
- Clone the Repository
git clone https://github.com/your-username/VR_LED_Project.git cd VR_LED_Project/vr_led_controller
- Install Dependencies
pip install -r requirements.txt - Configure WLED
- Ensure your WLED controller is on the same network.
- Edit
config.pyand setWLED_IPto your controller's IP address.
-
Map LED Positions
python -m vr_led_controller.main- Choose
mapwhen prompted. - Point your VR controller at each LED and pull the trigger to save its position.
- Choose
-
Control LEDs
- Run the program again and choose
loadto use the saved mapping. - Point your VR controller to light up LEDs in real time.
- Run the program again and choose
-
Change LED Colors
- Grip Button: Green
- Menu Button: Blue
- Trigger: Red
-
Play Battleship (Experimental)
- Run
battleship.pyfor a VR LED-based Battleship game.
- Run
Edit vr_led_controller/config.py to adjust:
WLED_IP: IP address of your WLED controllerNUM_LEDS: Number of LEDsPOINTER_ACCURACY: Pointer sensitivityDEFAULT_COLOR: Default LED colorFADETIME,FADEDELAY: Fading effect parameters
- ModuleNotFoundError: Ensure
vr_led_controlleris in yourPYTHONPATH. - VR Controller Not Detected: Check VR hardware and OpenVR drivers.
- WLED Not Responding: Verify
WLED_IPand network connection.
- Fork the repository and create a new branch for your changes.
- Submit a pull request with a clear description.
MIT License. See LICENSE for details.
For questions or feedback, open an issue or contact Christopher at [email protected].
Enjoy controlling your LEDs with VR! 🎮✨