Skip to content

MrSpectra/lumen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Lumen

Ambient lighting controller for a USB-connected RGB LED strip mounted behind a monitor.

The problem

The strip shipped with a bundled vendor application that was slow, unreliable, and offered almost no control over how the lights behaved. There were no public source files, no SDK, and no protocol documentation - just a closed binary talking to the device over USB HID.

The approach

I reverse-engineered the device's HID protocol by capturing and analyzing the USB traffic between the original app and the strip. From that I recovered the command set:

  • per-section RGB writes (0x86) with a packed full-frame variant for low-latency updates,
  • global brightness (0x87),
  • animation speed (0x8a),
  • report-id 0 framing with a sum % 256 checksum.

With the protocol understood, I wrote a replacement from scratch.

The result

A native controller in two parts:

  • daemon/ - a Rust background service that captures the screen, samples the audio output, and drives the LED strip over HID.
  • app/ - an Electron tray UI for choosing modes and tuning parameters. The UI writes a config.json; the daemon watches it and applies changes live.

Modes

  • Ambient - averages edge regions of the captured screen onto the strip (bias lighting).
  • Music - reacts to system audio: WASAPI loopback capture feeds an FFT, and the spectrum drives color and intensity across selectable palettes.
  • Fusion - combines screen ambient with audio reactivity.
  • Solid - a single static color.

Capture & audio

  • Screen capture uses Windows.Graphics.Capture (WGC), which keeps working through full-screen games where Desktop Duplication / DXGI tends to drop out.
  • Audio is captured via WASAPI loopback and transformed with rustfft to get the live frequency spectrum.
  • Configurable capture FPS, brightness floor, and a power limit to cap total current draw.

Stack

  • Daemon: Rust - windows-capture (WGC), wasapi, rustfft, hidapi, tray-icon, winreg, serde.
  • UI: Electron (main.js + preload.js + a vanilla HTML/CSS/JS renderer).
  • Platform: Windows.

Build

Daemon:

cd daemon
cargo build --release

UI (development):

cd app
npm install
npm start

Package the installer (bundles the release daemon as an extra resource):

cd app
npm run dist

The runtime config lives at %APPDATA%\lumen\config.json; daemon logs to %TEMP%\lumen.log.

About

Lumen - ambient LED lighting controller. Reverse-engineered a closed USB device protocol, built own app: Rust daemon + Electron UI, DXGI screen capture, WASAPI audio FFT, HID.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors