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!


You’re in luck though since the two protocols Adalight and tpm2 are already supported by WLED over USB serial!

Hi, quick question about USB serial, is there a list of the protocols that work over USB serial or some examples of them in use? I’m planning to use some NodeMCU boards connected to a raspberry Pi over USB, so hardwired control would be nice to have. Thanks

That list is in the quote :slight_smile: Adalight and TPM2 support only. Those are available in most ambilight and effect software

I do plan to add API support to manipulate WLED effects/colors via Serial at some point, but it is not supported yet.

1 Like

Thanks @Aircoookie I’ll have a play around with some ambilight software and see how it goes.

I’ll keep an eye out for a Serial API at some point in the future, I’m still quite far away from completing my project so there’s no rush :slight_smile:

Are you going to do JSON over a serial line, or use ASCII control language, or go for the speedy industrial way and map commands to hex?
I would probably lean towards the http API over serial, but enhance it so it does everything the JSON API can do. Just my opinion, which does not make it right. :smiley:

HI, I’m new here, discovering lot of WLED features, and one fundamental for mew is missing, Serial command for preset call and simple command like start stop brightness so i can piloting with existing microcontroller serial (9600k) 485/232/422 line, it would be nice that you can make presets and setings over web UI then just calling presset via serial presset call, if is already possible, please point me to some tutorial or serial usage… Thanx a lot !