Testing the unfinished light cubes at the National Arts Centre.

Symphony Hack Lab — How to Make Light Cubes

Andrew Pelling
pHacktory
Published in
8 min readFeb 1, 2018

--

We’re really excited to be involved in a fun collaboration with the National Arts Centre Orchestra, the Canada Science and Technology Museum, Artengine and Maker Faire Ottawa to present “Symphony Hack Lab”, a concert taking place on Feb 3 & 5, 2018. This will be a chance to experience the symphony “with audacious new explorations of sound and symphonic classics through science and technology”. There will be a number of pieces that will be reimagined by exploring our other senses and with new instruments and playing techniques. pHacktory will be co-hosting the concert and we will be experimenting with the piece Les offrandes oubliées by Olivier Messiaen.

This piece is of particular interest because Messiaen was known to have synaesthesia — he perceived specific colours when he heard musical chords. In fact, he used this phenomenon to aid his compositional process. During the development process, this point seemed like a nice opportunity to create a simple project to convert sound into light. We will be demonstrating a light installation during the performance of Les offrandes oubliées in which different sound frequencies will be converted into light. Below, we detail the process of making this installation and provide the code so that you can even make it yourself! A full parts list is available at the end of this post including links to any relevant parts that need to be 3d printed. Finally, the control code is available on our GitHub.

Testing the unfinished light cubes at the National Arts Centre.

Safety Note

The instructions below require a beginner to intermediate level of skill in basic electronics, microcontrollers (ie. Arduino and Teensy) and coding. To build this yourself, you should already be comfortable coding in the Arduino IDE, working with WS2812b LEDs (aka neopixels) and following best practices when it comes to working with electronics and live power. Keep in mind that the LEDs used in this project are extremely bright and proper eye-safety precautions should be taken. Instructions are provided as-is, without warranty and the user is responsible for ensuring their own safety. When in doubt, ask an expert! If you have not worked on a project like this before, we strongly recommend visiting your local makerspace to find a community of people who will be able to help.

The Guts — Electronics

The first step in converting sound into light is to break down a sound source into frequency bands. There are a lot of ways to do this! But since we had a tight timeline we decided to accomplish this by using an MSGEQ7 chip which takes any incoming audio source and breaks it down into seven frequency bands centred at 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz. This will allow us to visualize sound in the bass, mids and treble parts of the sound spectrum. We used a MSGEQ7 module from DF Robot to make it easy to send the data to a microcontroller (tutorial here). The module spits out the amplitude (or volume) of sound in each of the frequency bands. This data is then sent to a Teensy 3.6 microcontroller which is used to control the lighting. In this case we decided to assign the sound frequencies (from high to low) to seven different colours of light (red, orange, yellow, green, blue, violet and indigo). In order to visualize the sound, the brightness of each colour was mapped according to the volume of a specific frequency band.

To control the mapping, a Teensy 3.6 microcontroller was chosen instead of an Arduino because it is able to control thousands of LEDs at high speed. The Teensy was mounted on an nice accessory (the Octo2811 Adapater) which makes it easy to wire up to eight different sets of lights (Note: The Teensy 3.6 requires extra long headers to be installed in order to mount to the Octo2811 adapter). The Octo adapter also has several pins broken out which make for easy connections to the MSGEQ7 (We use Pin 0, 1 & 23 — see wiring diagram below).

Left: Teensy 3.6 with 28 extra long headers installed (14 per side). Right: Octo2811 adapter for the Teensy. One row of pins are labelled as 0, 1,23, 22, 19, 18, 17. The additional row of pins are all GND). CAT cable outputs are used to control up to 8 strips of WS2812b LEDS (labelled 1–4 and 5–8). The blue screw terminals are for power, ground and sync (the sync terminal is not used in this project)
Left: Teensy plus the Octo2811 adapter. Right: Testing a small sample of 4 LED strips through CAT6 cable

Importantly, the Octo adapter uses CAT5/6 wiring to send data and ground signals to the LEDs (instructions). We connected the wiring from the CAT cable to seven 3.5mm audio jacks in order to send lighting data and grounds to each of the seven LED panels. Finally, a few control momentary buttons were used to switch between different lighting modes (Off, Test, Ambient, Spectrum). The GND pins on each button were connected to each other and ground while the signal pins were wired to Pin 17, 18, 19 & 22 on the Octo adapter. These different modes will be discussed in more detail below. All the electronics were mounted inside of a box and wired up according to the diagram below making sure to connect all grounds together as well as grounding the box). Power to the electronics is supplied at 5VDC/2A.

Wiring diagram for the entire installation. All pins are labelled but not necessarily connected to one another in the diagram for purposes of clarity. The appropriate CAT cable connections are detailed here.
Left: Teensy/Octo and MSGEQ7 module installation. CAT cables (blue) are wired up to the seven audio jacks to send data/ground to the light cubes. Right: Momentary button wiring for choosing different lighting modes, the grounds are all connected.
Left: Close up of the audio jacks and connections to the twisted pairs of wire in the CAT cable. Solid colour wires carry the data signal are the corresponding white/striped wire is GND. The wiring is setup to use the ground and middle contacts on a 3.5mm male audio connector (the tip is not used). Right: Finished control box. On the left are the seven outputs which send lighting data to the light cubes via 3.5mm audio cables. On the right are the audio input jack, 5V/2A power input jack and power switch. Four control buttons are on top.

The create the coloured lights, we used the popular WS2812b LEDs. These are nice LEDs as each one is individually addressable, any colour is assignable and the light quality is intense and rich. Adafruit has published a very nice tutorial for working with these LEDs if you are new to them. WS2812b LED strips (144 LEDs/m) were used to construct the panels. Seven light panels with 204 LEDs were created. Each panel consists of the LEDs mounted on a steel backing (12 rows with 17 LEDs each) and a 3D printed frame. We had lots of extra heat sinks lying around so several were attached to the back of the panels with Gorilla glue to help keep them cool during operation. Each panel also had 75cm of wire connected to a power jack (5VDC/5A) and an audio jack (data and ground). Again we were careful to connect all the grounds together. The power line contains a 1000uF/25V capacitor to suppress voltage spikes and a 300ohm resistor was soldered in-line on the data pin of the audio jack. We used 3m long audio cables with 3.5mm male jacks to send data and grounds between the control box and each cube (see wiring diagram above).

Left: The panel with 204 LEDs. The panel is 15x15cm and the LEDs are arranged in 12 rows of 17. Ground, power and data are all wired as needed. Middle: Rear of LED panel with heat sinks mounted to enable cooling. The white frame is 3D printed and the panel is screwed into it. Right: Power and audio jacks to supply 5V/5A to the LED panel as well as data from the control unit. The inputs are mounted in a 3d printed part which clips to the internal steel rods. The power and data lines are connected to the LED panel via a 75cm length of 20 awg wire, making sure to connect both grounds together.

The Cubes — Structure and Design

Each LED panel now needs to be installed in some sort of structure which will “glow” with the assigned colour. For this element we worked with our friends at Ecotonos Design and Manufacturing to create the light cubes. Anthony Dewar (co-founder) came up with a very lightweight and simple design in which eight steel rods were welded to create and internal frame over which a dacron fabric could be stretched. The back is left open to allow for wiring, air flow and natural cooling. The ends of the steel rods were capped with a 3d printed piece which ensured all the edges of the cube would be rounded when the fabric was pulled tight. The final cube size is about 75cm on all sides.

CAD rendering of the light cube structure with fabric “skin” over a frame of four steel rods. Image courtesy of Ecotonos.
Transparent CAD rendering of the light cube structure with fabric “skin”. Image courtesy of Ecotonos.
3d printed corners for the ends of the steel rods to ensure a rounded edge on the fabric “skin”. Image courtesy of Ecotonos.

The final product is extremely light and easy to move around. As well, without the cloth covering, the frames all sit inside one another which enables easy storage and shipping. Finally, the 3d printed LED panel frames were designed with four small notches so that they could be easily clipped into the steel rods in order to enable easy mounting.

Internal view of the steel frame, 3d printed corner pieces and 3d printed frame for the LED panel. Image courtesy of Ecotonos.
Testing the light cube installation at the National Arts Centre.

The Code — How it all works

The control code for this installation was written in the Arduino IDE and can be found on our GitHub. You can feel free to download, modify and use it however you wish but please provide credit! We made use of several open source libraries and codes developed by others (full credits in the sketch) for working with the MSGEQ7, the LEDs and creating light patterns.

The Code has several important blocks which are worth discussing here.

  1. Libraries Used: Some libraries will need to be installed as they do not come with the IDE by default. These include the Bounce2 library and the Adafruit Neopixel library. We also created a library called “neopatterns.h” which is based on the tutorial for utilizing interrupts with neopixels. This library can be found on our Github along with our code for this project. You will need all three libraries for the code to work.
  2. User Input: There are several variables that the user can vary. These include: The number of frequency bands (NUM_BANDS) which also correspond to the number of light cubes; The number of LEDs on each light panel (NUM_LEDS); The default brightness of the panels (defaultBrightness); Any averaging of data (numReads); Baseline noise level (baseline); and any delay in the lighting updates (ie. slow down the update time by increasing the variable loop_dlay.
  3. Spectrum Mode: There are four modes available to operate the light cubes. Spectrum mode converts any incoming audio into a light display in real time by lighting up the cubes. This is the main mode of operation and is the default when the installation is turned on.
  4. Test Mode: This mode is for testing the light cubes and connections. It sequentially lights each cube for 750ms and then turns it off. The sequence starts with the lowest frequency cube and ends with the highest frequency cube. After this sequence, all cubes are lit up and fade through the colours of the rainbow. This is a tool for ensuring all cubes are connected and powered properly.
  5. Ambient Mode: In this mode, all LEDs are turned to blue and slowly fade in brightness values. Each cube fades at a different speed.
  6. Off: Turns everything off.

Parts List

  1. 1x Teensy 3.6
  2. 1x OctoWS2811 Adapter
  3. 28x extra long headers
  4. 1x MSGEQ7 Module
  5. 10x WS2812b LED strip(144 LEDs/m)
  6. 1x Power rocker switch
  7. 8x 2.1mm DC plug
  8. 15x 3.5mm audio jacks
  9. 1x CAT cable (cut in half and stripped)
  10. 7x 3m audio cable with 3.5mm male ends
  11. 20m of 20 awg wire for power
  12. 7x 1000uF electrolytic capacitors
  13. 7x 300 ohm resistors
  14. 4x momentary panel mount buttons
  15. 1x enclosure (at least 7.5" L x 4.5" W x 2.5" H)
  16. 1x 5V/2A DC power supply (for control box)
  17. 7x 5V/5A DC power supply (for each cube)
  18. 3D printed parts (link to files coming soon)
  19. Basic electronic supplies and tools: wire strippers, snips, pliers, soldering iron, multimeter, heat gun, drill, screwdrivers, helping hands, 24 awg solid core wire, dupont jumper cables, solder, flux, heat shrink, etc.

Final Product

This section will be updated soon with pictures from the final installation at the concert. Take a look at some video of the cubes being tested before the concert:

--

--