Wednesday, August 10, 2016

Resolume Arena and Multiple ArtNet Universes with FastLED

This example shows how to deal with multiple ArtNet DMX 512 universes using Teensy 3.2, WizNet 820io and FastLED to light up an LED array using output data from Resolume.

Download the Teensy code here:

Resolume Arena can output one or more DMX universes via ArtNet. This data can be read by a Teensy 3.2 using a WizNet 820io Ethernet module.

The universes hold RGB LED data, where one universe with a maximum channel count of 512 can represent 170 RGB LEDs (i.e. 510 channels of data).

Naturally, it is beneficial to transmit and receive more than just 170 RGB LEDs worth of data, and thus more than one universe can be dealt with using this setup.

Libraries and Code

To use the Teensy code, the following libraries are required:
Teensy Ethernet library
FastLED library

The Teensy code is quite easy to use, with only a small number of customisable constants and variables, as shown here:

In the ArtNet DMX protocol, each universe has an address differentiated by a net (14-bit), subnet (4-bit) and universe number (4-bit). The assumption is made that all devices in this example reside on the same net, so the net byte is not checked or compared.

A given Teensy 3.2 has a user-defined subnet, between 0 - 15, and can respond to data that populates up to 16 universes. For the sake of LED framerates, it is not adviseable to go beyond 4 - 6 universes, or 680 - 1020 LEDs in total. Each universe for a given Teensy 3.2 has the same number of LEDs, from 1 - 170.

To use the code, simply customise the number of universes (1 - 16), subnet number (0 - 15), the number of LEDs per universe (1 - 170) and the data pin used for LED output data (any digital pin).

The MAC address needs to be unique for the network, and the IP address needs to be unique and appropriate for the network.

A Teensy 3.2 is used, along with a WizNet 820io Ethernet module. In terms of LEDs, many different types are available, based on WS2811 or similar drivers. See the FastLED library for more details. In this particular example, a NeoPixel 24 Ring is used.

Connecting the WizNet 820io is as follows:
• Wiznet 820io GND, GND, GND are connected to Teensy GND
• Wiznet 820io 3.3V, 3.3V are connected to Teensy 3.3V
• Wiznet 820io Reset is connected to Teensy digital pin 9
• Wiznet 820io SS is connected to Teensy digital pin10
• Wiznet 820io MOSI is connected to Teensy digital pin11
 • Wiznet 820io MISO is connected to Teensy digital pin12
• Wiznet 820io SCLK is connected to Teensy digital pin 13

Connecting the NeoPixel or similar device(s) is simply a matter of connecting the Teensy data output pin (as defined in the code) to the data input pin on the LED array via a 100 ohm or similar resistor. Ground on the Teensy should be connected to ground on the power supply used for the LED array. A 1000 - 2000uF capacitor should be placed between ground and power on the power supply output for the LED array.

For a small number of LEDs, simply use USB power. Keep in mind that each LED will draw a maximum of 60mA, with a minimum of 20mA.

Mapping in Resolume Arena
The process of mapping multiple universes to one Teensy using Resolume as a data source is straightforward. In Resolume Arena, go to Output > Advanced Output. Create a new Lumiverse (or use an existing one).

This is a universe of DMX data, but represented inside of Resolume, and relative to the composition output. Create one or more new LED fixtures (or use existing ones), and populate the lumiverse with the same number of LEDs as defined in the "number_of_leds_per_universe" constant in the Teensy Arduino code.

Create additional lumiverses as required, totaling the number of universes defined in the Teensy Arduino code.

In this example, two lumiverses, each populated with 12 LEDs are used. These two universes are mapped to a NeoPixel 24 Ring.

In Arena > Preferences, go to  the DMX preferences tab. Create one DMX ArtNet output per lumiverse. Each lumiverse must share the same subnet number (the same one defined in the Arduino code) and unique, consecutive universe numbers (starting at 0, with a maximum of 15).

Example Video