which tells us that we will end the sequence with all the
LEDs on. We divide our 200 possible levels by the 100
steps and find that we need to increment the time on for
the LED by two each step of the way. Assuming we are on
battery, the LED is on for six instructions the first time,
increasing to 600 instructions by the time we are at the
end. The effect that you see is an LED glowing on.
While the pattern tables allow us to do some
interesting things, they are limited based on the table size.
The extra memory in the PIC16F685 allowed us to write
more complex patterns with random numbers to allow us
to turn on and off individual LEDs in completely different
patterns. For these advanced patterns, we use a trick of
pretending that there is only a couple entries in the
pattern table and instead of returning a value, we actually
use it to jump to the code to generate the advanced
pattern. The flowcharts and comments in the code on the
website ( www.MyOtherMind.com/go/PicMas Tree)
describe it in more detail.
Building the Tree
While we did put a lot of effort into the actual circuit
board design, you can certainly use a perforated wiring
board (perf board) and point to point wiring to build your
tree. The original prototype was constructed this way, but
a printed circuit board (PCB) makes the assembly faster
and much easier. The only critical aspect of the circuit is
the color and layout of the LEDs. All of the light patterns
would lose their effect if the layout and color of the LEDs
is not similar. If you choose the perf board route, spray
painting the perf board green to resemble a tree
beforehand is a nice touch. There is also a different
battery holder which is better suited for perf board
construction. Visit our website listed in the Parts List for
additional pictures, videos, and construction tips.
What sets Tree 1.1 apart from most other projects is
that the finished PCB is part of the appeal and uniqueness
of the project. Everything from the selection of the
components, to their layout on the PCB was done so that
the finished project resembles a tree decorated for the
holidays. This makes Tree 1.1 a great project for first-time
kit builders, as well as seasoned veterans to show off
soldering and assembly skills.
Neatness and appearance really count with this
project, so we’ve come up with some construction tips.
When populating the components on the PCB, start
with the components with the lowest profile first, then
the next lowest, and so on. Here, that equates to installing
the resistors first, the Schottky diodes next, the IC socket
and switch, then the transistors, LEDs, and finally the
Open the resistor pack, sort the resistors into their
respective values, and pre-bend the leads. Hole spacing
for the resistors and diodes is 0.6”. If you don’t have a
component lead bender, the technique we use is center a
resistor on the silkscreen layout and use the hole pattern
on the PCB as a spacing guide. Grasp the resistor lead
with the tip of needle-nose pliers between the body of the
resistor and just next to the hole, but not over the hole to
allow for the bend radius of the lead. Bend the lead 90
degrees with your fingers and repeat for the other lead.
Test-fit the resistor into the PCB. Once inserted, the
resistor should lay flat against the PCB. You can now
bend the remaining resistors to match.
Insert the resistors into the PCB. Lay a stiff piece of
cardboard over the top, flip the PCB over, and put the
whole thing back on the table. Apply a slight pressure on
the PCB to gently make sure all the resistors are flush
against it and their leads are sticking straight up. Tack
solder one end of each resistor, then turn the PCB over
and inspect your work. Make sure each resistor is laying
flat against the PCB and is centered over the silkscreen
layout for the resistor. If one of the resistors is not flush,
heat the solder connection and apply slight pressure to
firmly seat it (WITHOUT burning your finger tip). Flip the
board over and solder the other end of the resistors;
re-solder the tacked lead if necessary, then trim the leads.
When trimming the component leads, grasp the lead
between the thumb and forefinger of one hand and use
the other hand to trim the lead. This prevents the clipped
lead from becoming a dangerous projectile and also
prevents you from finding a clipped lead on the floor via
your bare feet. A good sequence to follow is do the two
10K resistors (R22, R23), the four 560 ohm resistors
(R9-R12), the eight 18 ohm resistors (R1–R7), and finally
the eight 3.9K resistors (R13–R20).
Continue using this technique for each group of like-height components. Insert the components into the PCB.
Use the cardboard to hold the component in place and
then turn the PCB over. Tack solder one lead per
component, then turn over the PCB to visually inspect
the component esthetics before soldering all the leads of
all the components.
Repeat this technique for the two Schottky diodes
(D98 and D99). Diodes are polarity sensitive so make
sure that the banded (cathode) end of the diode matches
the banded end of the silkscreen layout.
Insert the IC socket into the PCB. Note the IC socket
has a notch on one end similar to the silkscreen pattern
on the PCB. On components with more than a couple of
pins like the IC socket, modify the assembly technique by
tack soldering two pins; one each on opposite corners of
the socket. Turn the PCB over and make sure the socket is
correctly aligned and is flush.
Insert the switch onto the PCB by applying pressure
to the body of the switch. The switch is fairly rugged, but
it is possible to damage it if too much force is applied
directly to the button when inserting it. Again, solder one
pin on opposite corners, double check that the switch is
November 2008 49