Control WLED via USB?

Hi !
I’m using WLED to add some lights in my gaming PC. So far, it looks very good and I love it.

But I was wondering, is there a way to control WLED via USB serial communication ?

The idea is to have a script running on my PC which sends commands to the ESP32. That way, I could script custom color and pattern to my CPU temperature (or other system variables) or change the lighting in rhythm with the music the PC plays (with no added mic to the ESP32) or even create some kind of ambilight effects.

I could also, in some extent, get rid of the Wi-Fi communication between my ESP32 and my router and even write some simple GUI to control the ESP32 via USB only. I won’t do that but that’s just an idea what the USB serial communication could allow.

My ESP32 have a USB/serial converter (I think all boards have them anyway) and I would connect it to one of the unused internal USB2.0 ports on my motherboard.

EDIT : I learn about the JSON API but since I have a pretty weak network, I would prefer a way to control LEDs from my PC without having to be connected to a network to get the things to work. Also, that would create some traffic to my router and I’m not sure if it will impact my network speeds.

There are really two use cases you are describing here:

  • Settings WLED effects and colors according to some system parameters
  • Continuously stream data to WLED (e.g. music reactive)

For the first use case, the JSON API over network is the way to go. One command will typically use less than a kilobyte so it shouldn’t impact your network performance in a significant way if you only update the LEDs every few seconds or so. It also is completely local and doesn’t use the Internet, so if your connection is the bottleneck, it is unaffected.
Although the possibility of receiving JSON commands via Serial is already proposed so it might be coming at some point :slight_smile:

For the second usecase of “live” streaming RGB values from e.g. a music reactivity software, USB makes much more sense as the 30+ packets a second could indeed affect your network if you have an older router. You’re in luck though since the two protocols Adalight and tpm2 are already supported by WLED over USB serial!

1 Like