Skip to content

Teensy Streaming Pixel Data

Lucas Morgan edited this page Aug 4, 2019 · 3 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 serial messaging protocol works so that you can send pixel data yourself from any other computer.

TouchDesigner Streaming Example:

Open up the file located here TouchDesigner\SERIAL\PXLNODE_SERIAL_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

Unlike the UDP version of PxlNode, the Teensy header is only 1 byte.

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 serial 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. To do this, we simply send a single byte, 100.