ELK-BLEDOM Bluetooth LED Strip Controller
A Rust library for controlling ELK-BLEDOM and similar Bluetooth LED strips. Works with multiple device types including ELK-BLE, LEDBLE, MELK, ELK-BULB, and ELK-LAMPL.
Features
- Power on/off control
- RGB color control
- Color temperature control (2700K-6500K)
- Brightness adjustment
- Various effect modes (fade, jump, blink)
- Effect speed control
- Schedule on/off functionality
- Audio-reactive lighting visualization
- Support for multiple compatible device types
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
use *;
use Error;
async
Command-Line Tool
This package includes a command-line utility to control your LED device. After installing, you can run:
# Build and install the CLI tool
# Run commands (after installing)
# Set custom RGB color
# Set brightness
# Set color temperature
# Set effect with custom speed
# Schedule to turn on at 8:30 AM on weekdays
# Schedule to turn off at 11:45 PM on weekdays
# Start audio visualization with default settings (system audio reacts to LEDs)
# Audio visualization with specific mode and settings
# Use enhanced color mapping (warm colors for bass, cool/white for highs)
# Use BPM sync mode for rhythm-synchronized effects
# Run in test mode to see audio levels without controlling LEDs
# Use with specific audio device
For development, you can also use cargo run:
Device Compatibility
The library supports the following device types:
- ELK-BLE (Original ELK-BLEDOM devices)
- LEDBLE
- MELK
- ELK-BULB
- ELK-LAMPL
Device detection is automatic - the library will scan for and connect to the first compatible device it finds.
API Reference
Initialize the device
let mut device = new.await?;
Power options
device.power_on.await?; // Power ON
device.power_off.await?; // Power OFF
Time and Schedule options
// Set schedule for powering the leds on at 8:30 on Monday and Thursday
device.set_schedule_on.await?;
// Set schedule for powering the leds off at 23:45 on all weekdays
device.set_schedule_off.await?;
// Set custom time (Hour, Minute, Second, Day_of_week(1-7))
device.set_custom_time.await?;
The time of the device syncs automatically with the system time when initializing a device, so generally speaking, you don't need to use set_custom_time().
Control modes
// Set static color (R,G,B)
device.set_color.await?;
// Set led brightness (0-100)
device.set_brightness.await?;
// Set color temperature (2700K-6500K)
device.set_color_temp_kelvin.await?;
// Set an effect
device.set_effect.await?;
// Set effect speed (0-100)
device.set_effect_speed.await?;
Available Effects
The library provides many pre-defined effects:
// Jump effects
EFFECTS.jump_red_green_blue
EFFECTS.jump_red_green_blue_yellow_cyan_magenta_white
// Crossfade effects
EFFECTS.crossfade_red
EFFECTS.crossfade_green
EFFECTS.crossfade_blue
EFFECTS.crossfade_yellow
EFFECTS.crossfade_cyan
EFFECTS.crossfade_magenta
EFFECTS.crossfade_white
EFFECTS.crossfade_red_green
EFFECTS.crossfade_red_blue
EFFECTS.crossfade_green_blue
EFFECTS.crossfade_red_green_blue
EFFECTS.crossfade_red_green_blue_yellow_cyan_magenta_white
// Blink effects
EFFECTS.blink_red
EFFECTS.blink_green
EFFECTS.blink_blue
EFFECTS.blink_yellow
EFFECTS.blink_cyan
EFFECTS.blink_magenta
EFFECTS.blink_white
EFFECTS.blink_red_green_blue_yellow_cyan_magenta_white
Schedule Day Options
Days of the week can be specified using the following constants:
WEEK_DAYS.monday
WEEK_DAYS.tuesday
WEEK_DAYS.wednesday
WEEK_DAYS.thursday
WEEK_DAYS.friday
WEEK_DAYS.saturday
WEEK_DAYS.sunday
WEEK_DAYS.all // All days
WEEK_DAYS.week_days // Monday-Friday
WEEK_DAYS.weekend_days // Saturday-Sunday
WEEK_DAYS.none // No days
Audio-reactive Lighting
The library includes audio-reactive lighting capabilities that can turn your LED strip into a music visualizer:
use *;
async
Available Visualization Modes
// Six different visualization modes are available:
FrequencyColor // Maps frequencies to colors (bass=red, mid=green, high=blue)
EnergyBrightness // Uses sound energy to control brightness
BeatEffects // Detects beats to trigger different effects
SpectralFlow // Creates flowing color patterns based on audio characteristics
EnhancedFrequencyColor // More color-accurate mapping (warm colors for bass, cool/white for highs)
BpmSync // Synchronizes effects with detected beats per minute (BPM)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Original code by TheSylex
- Based on reverse engineering of the ELK-BLEDOM Bluetooth protocol