Set Chat Aglow with Mike Pfeiffer's Twitch-Controlled WLED Lighting Backdrop
A Python chatbot lets Twitch viewers take control of this low-cost easy-to-build 6×6 LED matrix.
Maker Mike Pfeiffer, of the Physical Computing Makerspace at the University of Massachusetts' Amherst Manning College of Information and Computer Sciences, has shared a guide for jazzing up your streams by putting a curtain of spherical LED lights under the control of your Twitch chat channel.
"This project allows Twitch chat users to control an array of addressable LEDs by leveraging an [Espressif] ESP32 microcontroller running WLED and a powerful Python library, TwitchIO," Pfeiffer explains of the project. "To realize this project you’ll build a frame that will support a string of LED lights, adorn each LED with a table tennis ball for light diffusion, wire up an ESP32 and install WLED, and finally integrate some Python code to run a Twitch chatbot locally."
Twitch is, of course, one of the most popular streaming platforms around, thanks in no small part to the promise of interactivity: successful streamers will keep an eye on the live chat, and frequently add programmatic functionality like having on-screen graphics pop up when selected phrases are detected. In Pfeiffer's case, though, the interaction is more physical: the chat session drives the colors of individually-addressable LEDs, arranged as a backdrop behind the streamer.
Rather than just bare LEDs, Pfeiffer's implementation uses low-cost PCV piping to build a frame that holds the LED strings in a matrix pattern — then diffuses their light using simple table-tennis balls. The strings are then connected to a low-cost Espressif ESP32-based microcontroller board running the popular WLED firmware, which in turn connects to a custom-written Python chatbot linked to Twitch.
"The software establishes a connection with Twitch chat servers, does some authentication behind the scenes, then listens to the chat," Pfeiffer explains. "If a chat message starts with '!LED', then the bot sends a command to the WLED device to change the preset. For example, if a chat user typed, '!LED 3', then the chatbot would recognize this message, and reach out to the ESP32 to tell WLED to display the third preset (or the preset with an ID of 3), which was our Rainbow preset. The chat user could also type '!LED Rainbow' to achieve the same result."
The project is documented in full on Instructables, with source code available on GitHub under an unspecified license.
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.