design will receive 2.8 VDC on the Vdd power rail.
USB Power Detect
As described in the previous section, the Vdd power
rail of the design can be either 4. 8 or 2.8 VDC. While the
operation of the processor will not be affected (the
PIC16F685 has a 2.0-5.5 VDC operating range), the LED
array is a different matter. If the SW in the tree were left
unaware, the difference in the Vdd power rails would
appear as a very noticeable brightness difference in the
LEDs. To prevent that, the design includes a trivial USB
power detection circuit.
If a powered USB cable is connected, the USB.DETECT+
signal will be connected to the USB 5 VDC power pin which
will result in the PIC16F685 I/O pin RA0 being seen
as a logic 1 to software. If a powered USB cable is not
connected, the USB.DETECT+ signal will be left floating
and the 10K ohm, R23 resistor will pull the USB.DETECT+
signal to ground, which will result in the PIC16F685 I/O
pin RA0 being seen as a logic 0 to software.
Note that while Tree 1.1 uses USB power, it will not
appear as any device on your computer. It is only — what
we like to call — a power sucking alien. The peak current
of 50 mA and the average current of 5 mA make Tree
1.1’s power consumption far too low to be noticed by the
USB power management functionality in your computer.
(The power management gets involved when a USB
device wants more than 100 mA continuously.)
There is one momentary on pushbutton on the design.
This pushbutton is combined with the 10K pull-up resistor
R22. The resulting signal PATT.CHG is connected to the
MCLR- (Master CLeaR-) pin of the PIC16F685. When this
button is pressed, the PATT.CHG signal will go low and
reset the PIC16F685 through the MCLR- pin. Through a
bit of clever programming, this single button functions as
both the pattern change button when the tree is active
and as the “wake up” button to reactivate a tree that has
been turned off. See the software section for more details.
■ FIGURE 2
The layout of this design (shown in Figure 2) was
dictated almost entirely by its visual appearance.
A typical design would use the electrical
properties of the embedded components
and/or their functional requirements as the driver
for the layout.
The placing of the components was almost
entirely driven by “What will the components
look like on the board?” The LEDs, obviously,
become the lights of the Christmas tree. But what
of the other components; what is their role? Well,
besides lights, decorations are the other typical
item to put on a Christmas tree. Thus, the
transistors, resistors, and diodes are all the
decorations of the design.
If your house is anything like ours, the
excited little ones around the Christmas tree
during the decorating process don’t always get
things just perfect. In that spirit, the decorations
of our tree design are not “just perfect.” The
decorations of this tree are clumped together
here and spread out there, all to make the overall
effect more realistic.
The last visual attribute that we worked on
was the routing. In this case, the routing on the
component side of the tree is the vertical routing
layer. We deliberately chose vertical routing on
the front of the tree to mimic tinsel on a real tree.
Writing the Software
No microprocessor-based design is useful