the perfboard. This makes all of the necessary connections
between the microcontroller and the audio adapter. The
microSD card should be inserted into the connector on
the audio adapter once the adapter and the Teensy 3.1
are soldered together and wired onto the circuit board.
The code which implements the color organ is
unfortunately rather complex and is made up of many
files. Fortunately, you don’t really have to understand it in
detail to use it. A much deeper understanding is necessary,
however, if you plan to modify the code. The color organ
26 March 2017
File Name Function
This is the base class of all of the individual screens used in the LCD user interface. It defines
functions that each screen must implement and provides some low level processing of
Colors.h Code in this file is used to generate 16-bit color values for use on the LCD display and 24-bit color values for sending to the RGB LED string.
Code in this file defines all onscreen widgets that users interact with. This includes text fields,
VU fields, buttons, and value pickers. In addition, it has the drawBorder function which
provides the overall look of each of the user interface screens.
This code provides the software interface to the string of RGB LEDs. Functions in this file
assign LEDs to each of the eight bands according to the currently configured LED density, and
control the colors used for each band. Band colors are assigned across the visible spectrum
in ROY G BIV order (red, orange, yellow ...) with red at the bass end and violet at the high
end. Every time the assignLEDsBasedOnDensity function is called, the LEDs assigned to each
band are randomly reassigned, changing their physical location along the LED string.
PrintExtensions.h Code for formatting text strings within bounded rectangular areas of the LCD display.
Code in this file implements the Configuration Screen shown in Figure 5. Touching buttons on
this screen causes various other screens to be displayed. Touching the Back button causes
control to return to the main screen.
It is on the Density Screen (Figure 7) where the density of LEDs used for each band is
configured. Each of the eight bands has a maximum of 15 LEDs. If a density of 50% is
selected, half of the LEDs in each band will be used for display. If 25% is selected, a quarter of
the LEDs in each band will be active.
Code in this file allows the current configuration of the color organ to be stored and loaded
from the microSD card plugged onto the audio adapter (see Figure 8). To save a
configuration, first select the file to use and then touch the Store button. To load a
configuration, first select the file and then touch the Load button. Configuration files stored
on the SD card are never deleted, but are meant to be overwritten as necessary.
The main screen (Figure 4) is what is displayed when the color organ is first powered up. This
screen has two VU like meters that display the audio levels being seen by the color organ. If
this screen is touched, the configuration screen is brought up.
The miscellaneous screen (Figure 6) allows selection of the audio input; either Mic or Line
controls whether the automatic volume control is engaged or not, and allows setting the time
interval in minutes between dynamic changes in LED band assignments. If the interval is set
to zero, the LED assignments are static and never change.
This is the main Arduino program that coordinates all actions of the color organ. It defines all
objects used in code and a Finite State Machine (FSM) which controls the overall operation.
This code is structured so that the color organ remains operational while the user is
interacting with the LCD touchscreen display, so that changes made by the user are reflected
in the color organ’s operation immediately.
This file has instructions for compiling the code in the Arduino environment and for
programming the Teensy microcontroller. Article length restrictions prevent me from
including these instructions in the text.
■ FIGURE 2. Teensy color organ circuit board — front
side. The Teensy 3.1 uC is soldered beneath the audio