would go up significantly), such a strategy is certainly not
generally applicable.
Consider a simple black and white computer monitor
with a 1,024 x 768 resolution. Using a multiplexed display
strategy, such a display could be implemented using 1,024
columns and 768 rows, requiring a total of 1,792 I/O
pins from some control block. On the other hand, if a
non-multiplex, direct drive display strategy was used for
the same display, the control block would need 1,024
times 768, or 786,432 I/O pins. Not a very practical
solution. So, let’s move back to the more practical and
cost-effective multiplexed display strategy.
For this design, at any given instant only one of the
four column transistors (Q1-Q4) is turned on. The overall
refresh rate of the Tree 1.1 design is nominally 70 Hz
(or a refresh period of approximately 14. 3 ms). Given that
there are four columns in the design, a specific column
transistor stays on for approximately 1/4 of the overall
refresh period. Thus, each of the column transistors stay
on for approximately 3. 6 ms before it is turned off and the
next column transistor is turned on. Remember this 3. 6 ms
“column time.” We will come back to it.
While a given column transistor is turned on, the
software then turns on zero to eight of the row transistors
(Q5-Q12). If both a column transistor and a row transistor
are turned on, the corresponding LED in the array will
have current following through it and will light up. Which
row transistors are turned on (and for how long) is
dependant upon the particular pattern being displayed.
This aspect of “how long” the row transistors are turned
on is what controls the relative brightness of the LED.
In this design, we have LEDs that — at any instant in
time — are on or off. By varying how long each of the row
transistors are turned on for, the design supports varying
levels of brightness which our software uses to construct
all of the visible patterns. In Tree 1.1, we have
approximately 200 different brightness levels. The “level1”
LED brightness is obtained by turning on a row transistor
for 1/200th of the 3. 6 ms column time (a bit less than 2
µs). Similarly, “level100” and “level150” LED brightness is
obtained by turning on the row transistors for 100/200th
and 150/200th of the 3. 6 ms column time (about 1.8
and 2.7 ms, respectively).
Collectively, this strategy of varying how long the row
transistors are on to generate the different brightness
levels is called Pulse Width Modulation (PWM). It is a
tried and true method to allow a digital system to emulate
the continuous behavior of an analog system. In any PWM
system, there is a digital signal source that varies it duty
cycle or pulse width. (In our case, this is the row transistor
control signals; I/O pins RC7-0.) Then there needs to be
some sort of smoothing or averaging function. Often it is
a capacitor but, in this case, the averaging function is the
human eye itself via its persistence of vision.
The only idiosyncrasy remaining is how the
microprocessor actually turns on the column and row
transistors. The column transistors are NPN devices with
their emitters tied to ground. To turn these transistors on,
the software must drive a logic 1 to the associated I/O
pins (RB7-4). The row transistors (Q5-Q12) are PNP
devices with their emitters tied to Vdd. To turn these
transistors on, the software must drive a logic 0 to the
associated I/O pin (RC7-0)
The resistors (R9-R12, R13-R20) connected to the
base of the column and row transistors have had their
values selected such that the transistors will go into
saturation, resulting in the smallest achievable voltage
drop between the collector and emitter (Vce). This, in
turn, results in the largest voltage possible across the LEDs.
This results in the maximum LED brightness at low Vdd
values; such as when the design is running on batteries
that are almost empty.
As it happens, this LED brightness — or at least the
relative brightness — was a bit tedious to get right across
four different color LEDs. The first thing you find out when
researching LEDs is that, it you really care about relative
brightness, LEDs are not really interchangeable between
vendors. We found it impractical to get the same color
LEDs from two different vendors and mix them on the
same board. The difference in brightness was quite
noticeable and really threw off the visual effects. We also
found it was impractical to even get two LED colors from
vendor A and two others from vendor B and use them on
the same board. The resulting mixed vendor LED displays
also had noticeable brightness differences between the
colors. In the end, we settled upon — for any given tree —
that we had to use LEDs from the same vendor and from
the same LED family within that vendor. Only then were
the differences in the LED brightness minimized.
Power Supply
The power supply operation is extremely simple. The
two possible power sources (USB connector power and
D cell battery power) are simply diode OR-ed together.
The power source with the higher voltage will be used to
power the tree design. The USB connector power supplies
a regulated 5 VDC. The two D cell batteries supply a
nominal 3 VDC.
In this design, the specific diodes chosen were
1N5817, general-purpose Schottky diodes. Schottky
diodes have the property of a very low forward voltage
drop. Minimizing the forward drop across the diode is a
key consideration when the tree is battery powered. In
this design, the overall current consumption is quite low
with a peak current of 50 mA and an average current of
less than 5 mA. With that level of current consumption,
the forward voltage drop on the 1N5817 falls into the
0.2 VDC or under range, making a Schottky diode
OR-ing strategy a very simple and cost-effective power
selecting function.
In practice, any time the tree is plugged into a
powered USB cable, the tree will run off of the USB
power and the design will receive 4. 8 VDC on the Vdd
power rail. Otherwise, the batteries are used and the
November 2008 45