Skip to content

UDP Pixel Streaming protocol

Lucas Morgan edited this page Aug 4, 2019 · 4 revisions

Overview:

The PxlNode's primary purpose is to drive ws2811/12/12b style RGB leds. This page will walk you through the TouchDesigner example included on this repo, but also how the UDP messaging protocol works so that you can send pixel data yourself from any other networked computer.

TouchDesigner Streaming Example:

Open up the file located here TouchDesigner\UDP\PXLNODE_UDP_streaming.toe You'll be greeted with something like this: alt tag

The only part you need to worry about is this area here (scroll wheel to zoom in): alt tag

Once you update these settings to match what your PxlNode device is configured with, you should be able to receive data. NOTE: the sample file has mapping coordinates for a grid, though if you are driving a strip or another physical layout, the resulting patterns may not match.

The Streaming Packet Structure:

Data going out to the PxlNode is generally broken into two parts.

  1. Header
  2. Raw 0-255 pixel data

The header is comprised of a few pieces:

1-20 21
EnviralDesignPxlNode OPCODE

For streaming, there are two different OP Codes we need to know. The Chunk ID [0-99] and the UpdateFrame [100] (A full breakdown of the messaging structure can be found here)

So, if you are addressing 100 leds, and your chunk size is set to 25, then you would need to send 4 UDP packets (chunks) filling in each of those 4 segments of leds.

So the header for each of those 4 packets would look like this:

Header OPCODE PixelValues
EnviralDesignPxlNode 0 r0,g0,b0,r1,g1,b1...
EnviralDesignPxlNode 1 r25,g25,b25,r26,g26,b26...
EnviralDesignPxlNode 2 r50,g50,b50,r51,g51,b51...
EnviralDesignPxlNode 3 r75,g75,b75,r76,g76,b76...

Then once the values are set, we need to tell the leds to update. They won't change until we call this last one.

Header OPCODE
EnviralDesignPxlNode 100

Here is the full header sans the OPCODE, converted to a byte list: 69,110,118,105,114,97,108,68,101,115,105,103,110,80,120,108,78,111,100,101