oscillator. Since each output requires 12 bits of
information to control its PWM hardware, a total of 288
bits or 36 bytes of data must be streamed into the chip via
SPI to control its 24 PWM outputs. (More on how to
control the TLC5947 chip in the software section).
For many of my projects, a single Adafruit driver
board still doesn't have enough outputs to drive large
numbers of RGB LEDs. I recently purchased some 8x8
RGB LED matrices for use in a project. Think about it. This
is a matrix of 64 RGB LEDs which equates to 64 x 3, or
192 individual LEDs needing PWM control.
There were two ways to go about this project.
Purchase and connect eight of these boards together
somehow so each board controls one row of the display
for a total driver cost of $119.60. Or, use one of these
boards, eight cheap P channel power MOSFETs and some
clever software to control the entire display.
Being frugal, I chose the latter. In the discussion to
follow, I will show you how to use multiplexing of the LED
driver to accomplish this feat.
Multiplexing is a term from the telecom industry
which meant to combine multiple channels of data onto a
single medium for transmission. Multiplexing reduces the
cost of hardware, and because of a reduced parts count
Multiplexing many channels of data onto a single
medium required that each channel of data be given its
own time slot. This is referred to as TDM, or Time Domain
Multiplexing. We can use this same technique for
controlling our LED matrix by assigning each row of the
display a different time slot for update. If we update each
row of RGB LEDs fast enough, persistence of vision will
make it appear that each LED is individually controlled.
I designed some hardware to demonstrate control of
an 8x8 RGB LED matrix using multiplexing. The hardware
is shown in Figure 2 and the hardware's schematic is
shown in Figure 3.
The 8x8 RGB LED matrix I will control is of the
common anode variety. What this means is that each row
of the display has the anodes of each red, green, and blue
LED connected together (see Figure 4). The cathodes of
each column of the same color LEDs are also connected
together and brought out to pins on the matrix. By
applying a current source to a specific row pin and a
current sink to a specific cathode pin, a single color LED
can be illuminated.
I tested the LED matrix I built into the demonstration
hardware using a nine volt battery and a 1K ohm resistor
by connecting the + side of the battery through the
resistor to a row pin, and connecting the - side of the
battery to the various column pins. As you move the
battery connection from one column pin to another, you
will see the LEDs change color.
As mentioned, in the demonstration hardware, P
channel MOSFETs are used as the current source for each
row of the matrix. The current flowing from the drain of
the device into the row of LEDs is controlled by the
April 2015 55
FIGURE 3. Demonstration hardware schematic.