141

With elaborate light show and daisy-chain capability.

With elaborate light show and daisy-chain capability.

By Willem Tak (Netherlands)
 
Published in Elektor Magazine nr. 432, December 2012
 
 
This is a design for an exclusive electronic Christmas tree  comprising not much more than a microcontroller and 56 light emitting diodes. The LEDs are arranged on a circuit board in the classic Christmas tree pattern. The intelligence is in the software. This ensures that the microcontroller will light up the Christmas tree in the most interesting patterns. It is even possible to join two of these trees together, after which the patterns that are produced will run back and forth between the two trees. The result is an amazingly effective eye-catcher when it is placed on the window sill. And it contains more than just a few simple effects – the cycle time after which the entire performance repeats, amounts to no less than 40 minutes!
 
Little electronics, lots of memory
Seeing that the optical effects play an important role here and it is not the intention that you will see the same pattern again after only a short time, a microcontroller with a substantial amount of memory was chosen, the  18F2685-E/SP made by Microchip. It is provided with 96 KB of flash memory (that is, 96 KB of program space). This memory is, incidentally, nearly entirely filled with the present program, hence the very long run time of over 50 minutes. The microcontroller is clocked using a standard 24 MHz crystal (the internal clock of 8 MHz turned out not to be fast enough for some patterns).
The circuit itself (see below) is very simple: the LEDs are driven in an 8x7-matrix directly by the microcontroller. The seven columns of eight LEDs each are connected, one at a time, to the positive power supply voltage by pins A0 through A5 and B0. In addition, the rows of seven LEDs each are pulled to ground via resistors by the outputs of port C. The levels at the C outputs therefore determine which LEDs from each column will light up, while the A and B0 outputs take care of the multiplexing of the columns.
Because of the matrix configuration (each LED is on for only 1/7th of the time) and the limited current that can be supplied by the controller, the LEDs do not light up extremely bright. But then the circuit is not intended for use in environments that are too bright (like a softly lit living room). Wide viewing-angle LEDs were used and good results are obtained with bright LEDs with a high optical efficiency. The outputs of the controller can be loaded with a maximum of 25 mA. Due to the multiplexing that works out at about 3 mA per LED; in the dark even that can be too much. The eight resistors in the connections to port C determine the current through each LED. Depending in the desired brightness you can use resistors with a value of 680 Ω, 820 Ω or 1 kΩ.
Via the sync-connection (pins 22 and 23, brought out to K3) it is possible to connect two electronic Christmas trees together. Certain patterns will then jump from one tree to the other. In order to obtain this effect, pins 22 and 23 of the two Christmas trees are connected to each other with a crossover cable. The software determines whether a tree is the left or the right version. The L-version indicates the left tree and R indicates the right. The effects have been written in such a way that the left tree should be positioned on the left, when viewed from the front.
The status LED, connected to RB7 is not essential. When the power supply voltage is switched on, or after a reset, the LED will rapidly flash a few times. In this way the correct operation of the PIC and its contents can be verified.
It is best to use a 5-VDC power adapter for the power supply; any standard adapter is certainly sufficient for two trees. When two trees are connected together, the power supply wires can run together with the synchronization lines (all are present at connector K3).
 
 
COMPONENT LIST
Controller board
 
Resistors
R1,R4,R14 = 4.7kΩ
R2,R3 = wire link
R5 = 330Ω (optional)
R6–R13 = 680Ω (820Ω, 1kΩ, see text)
 
Capacitors
C1 = 47µF 16V
C2,C3 = 27pF ceramic
 
Semiconductors
D1 = LED, red, 3mm (optional)
IC1 = PIC18F2685-E/SP, programmed
 
Miscellaneous
X1 = 24MHz quartz crystal
K1 = DC adapter socket (e.g. Lumberg type CUI PJ-031DH)
K2 = 2-pin SIL pinheader (optional)
K3 = 5-pin SIL pinheader
K4 = 16 pin-SIL pinheader (or short length of 16-way flat cable)
Optional: pushbutton for mode and reset
 
LED board
D1–D56 = high-efficiency LED, 5mm
K1 = 16-pin SIL pinheader (see K4 controller board)
 
Published in Elektor Magazine nr. 432, December 2012