LED Sousaphone Bell

AKA Pixel Mapping with MaxMSP

by John Baylies - sousastep.quest

Many thanks to the Brooklyn College Sonic Arts program and the Performance And Interactive Media Arts program.

Note

Check out Jay Converse’s LED bell too!

Materials

Note

(200 LEDs needed for this tutorial, but definitely buy extras. Even the pros sometimes have trouble sourcing good ones that won’t burn out quickly) WS2812 LEDs were released to the world 7 years ago, and they’ve been improved upon since then. Click here to read more about other types of LEDs.

Note

After four years of using this PSU I just had an issue where, a few times an hour, my LEDs would all turn off for a minute. Unplugging the PSU from the outlet and plugging it back in fixed it. It had been plugged in for months so maybe just don’t leave this PSU plugged in for weeks on end.

Note

If you haven’t soldered before, Nic Collins’ book Handmade Electronic Music is a great way to learn. Also, Adafruit has a soldering guide specifically for LEDs.

Important

DON’T BREATH THE FUMES! IT’S LEAD!

Overview

Max/MSP handles the VFX, and outputs a stream of RGB data to the Teensy, which uses the venerable OctoWS2811 to send RGB data to the ws2812b LEDs. Max must ensure that the RGB data is sent to the Teensy in the order in which the LEDs are wired to the OctoWS2811. Sometimes this stream of RGB data can become offset. To fix this we add start and end markers to each frame of RGB data .

startandendmarkers.png

Since Max can only send the numbers 0 - 255 to the Teensy, we clamp 0 - 253 so that 254 and 255 can be used as markers. There’s not much of a difference in brightness at that end of the range, anyways.

The current Teensy code can be downloaded from here. Last time I touched this code I was messing with an accelerometer and a capacitive touch sensor, and couldn’t get them to work well, but haven’t removed the code yet, so there’s some superfluous code in there.

You can download my VFX Max project here (with the start and end markers). It’s set up to work with my rig, so you may want to extract the serial stuff and build your own rig around that.

Initial Setup

Start with the simplest possible setup to ensure that Max can control the LEDs before they’re attached to the bell.

Click here for instructions on how to connect the OctoWS2811, Teensy 3.2, power supply, and LEDs.

Download this folder o’ files. (without start and end markers)

Upload success.ino to the teensy by following these instructions.

  • Open testpatch1.maxpat

  • Turn the patch’s audio on.

  • Clear the serial ports and locate the teensy.

  • Enable jit.world, and the LEDs should light up…

If only some of the LEDs light up, change this portion of the code:

const int ledsPerStrip = 26;
const int numStrips = 8;

Getting the Coordinates

We can get a list of RGB data from Max by sending pixel coordinates to a matrix. You can arrange the LEDs in any pattern you’d like as long as there’s an ordered list of coordinates, which will have to be reordered after the LED wiring order is determined.

Here’s how I got the coordinates for remappedLEDcoordinates.txt

I found this website, clicked “table”, selected the first 200 coordinates, copy-pasted them into google sheets, exported the sheet as a csv file, and used Justin G’s max patch to convert the csv file into Max’s coll object.

then,

max-scale-coords.png

This patch will get the Fib. Spiral showing up properly in jit.world

flipped-on-xaxis.png

Left, incorrect, flipped on x-axis. Right, correct. (challenge: turn the coordinates 90 degrees. It’d look more symmetrical.)

Arranging the LEDs

Project a screenshot of the spiral in jit.world onto the bell. Place the LEDs onto the projected dots while being mindful of the wiring order. You’ll want to wire the 200 LEDs in eight groups of 25. You should use your own discretion to do this as efficiently as possible.

One problem I faced is that I placed half the LEDs, then took a break for a few days, and when I tried to set up the projector again I learned that realigning the projector perfectly is impossible. This led to one speck of light hitting the flare of the bell the first time, and the throat of the bell the second time, which made me place one extra LED, which led to much confusion later on.

Once completed, the bell will look best from the projector’s point of view.

numbered-indices.jpeg

I used this diagram to reorder the coordinates from the Fibonacci spiral order to my wiring order. You can use it as a guideline, but be warned that it’s flipped on its X axis, and I had to account for one extra LED. Fibonacci index #29 corresponds to wiring index #35 and #170.

The top numbers are the Fibonacci indices, from iwant2study.org. The bottom numbers are the wiring indices, which can be determined by turning on the first LED in each of the eight strips.

Typing those indices into a coll object allows the coordinates to be reordered using the patch below.

coll-reorder.png

This essentially makes the whole thing a big, low-resolution TV screen.