Pixel Streaming Tutorial

Michael Bruner
4 min readMar 20, 2019

--

In this tutorial I’ll go over how to wirelessly control addressable LED’s with touchdesigner. This is great if you want to have dynamic and reactive battery powered lighting that you want to be able to control from a distance. To get things up and running we need a few pieces of hardware and then we need to get our software and code configured.

Here’s the Github link with the code

To get this working I did a lot of googling and looking at what other people of done. This github was particularly helpful for both the arduino code and touchdesigner setup.

Hardware

For hardware the three necessary components are a wifi board, I used the adafruit Feather Huzzah32, a 3.7v battery (can also use USB), and addressable LED’s . For my setup this is all the hardware that was required.

I’ve read that the LED’s need a 5v data and power and the Huzzah only has 3.7v so you need to get a 3v to 5v level shifter. However, I ran my setup without this and it works fine. Something to check out if you try this and it’s not working.

Arduino Code

To get going we’ll need to get some libraries installed so we can run everything. The main things are getting the latest version of the FastLED library and getting the Huzzah32 board added to the Arduino Ide.

In the github repository you’ll see multiple Arduino sketches, that use different communication protocols. These were for my own experimentation to see what worked best. I recommend using the UDPLED sketch as it had the most reliable results.

At the top of the sketch there are some variables you want to configure, the number of Leds, the data pin, and the network name and password.

The bulk of the program takes place in the main loop. For each pixel we are sending three bytes of data (r,g,b) so our inputBuffer length is (NumLeds * 3). We read in packets via UDP and wait till the inputBuffer is filled and then use a for loop to assign the rgb values to each LED. We then call FastLED.show() to flash the changes to the Led strip.

Touchdesigner Setup

Inside of touchdesigner our main task is to take video data (TOPs) and convert it into a single channel (CHOP) that we can send out over UDP to the correct IP address and Port.

For converting the data we first crop down the image to the number of pixels we have in our strip. We then do a topTo chop conversion to get the information as channels. Three selects are used to separate the rgb values into distinct channels, after which the channels are shuffled together into a single long channel. So we finally get a channel formatted correctly(r1,g1,b1,r2, …).

To send our data to board over UDP we use an Execute Dat in conjunction with a UdpOut Dat. At the end of each frame our execute Dat references both our formatted pixel data (‘null2’) and our udpout node. We use the command sendBytes and give it an argument of all our channel data. On the udpout dat be sure and set the network address and port correctly for the wifi board you’ve setup. The board should tell you it’s IP through the serial monitor when it boots up.

Conclusion

That covers most of the technical details on how to set up communication between touchdesigner and a wifi board using UDP. Hopefully helpful!

--

--