The Idea
Probably everyone with an email account gets "Contagious Viral Video" emails from time to time. You know the subject line:
You just gotta see this! This last December 2005, one such video made the rounds. It just so happened to be one of
the many houses who bought computer controllers for their Christmas lights outside the house. The music was sent by a small
FM transmitter to the passing cars so they could watch the Christmas lights flashing in sync with "Wizards of Winter". Well
it obviously attracted the attention of one of the beer manufacturers as well, and became their TV commercial for the holiday
season. [I just hope that guy got paid something for their multi-million dollar promotion].

Wizards of Winter - set to lights
I decided that my small Z-80 computer had enough I/O mapping to do a pretty healthy job sequencing lights. I had already been doing some of this with a panel I had hooked up to the unit. Using ULN2803 drivers to run the lamps, I had written a few short programs that simply ran a time delay between incrementing its way through a bit table for turning on and off various lamps in various patterns. I got a little ribbing for it, and a lot of interested looks, but the idea had never progressed to sequencing whole strings of Christmas lights outside my house.
After researching this phenomena, I found out there are a great number of people who design, build and sell computer controllers for Christmas lights. Some are very hi-tech, some are so-so. A few of the home-brew sites I saw were so embarrassing I am surprised they bothered to take pictures of their various rat's nests and post the to the Internet. I keep waiting to hear on national news where one of these kluge jobs burned their house to the ground. AC power is not something to be kluged together, you must have a healthy respect for it and neat wiring jobs, or you will have a big, big problem down the road.
One effect I noted that I particularly liked was the idea of having Christmas tree(s) that were made up of individually controlled strands of light going from the bottom to the top. These trees could be "rotated" in software by sequencing the strings in order, and gives a very appealing look. An associated effect that I liked was to have a series of lighted stars
leading up to the main star at the top of a tree, so it appears a shooting star is hitting the tree top and causing the whole tree to burst into light. Very very nice, indeed.
I decided early on that I was going to carefully control my budget for this project (we are enrolled in the Dave Ramsey Financial Peace University),
and this was going to initially be a very limited light show.
I also took careful note of one website in which a man had a Christmas light show which grew so ridiculously huge and gawdy that
(I'm not making this up) HIS WIFE LEFT HIM OVER IT!!!
So I stand cautioned that, as the scriptures say, moderation in everything is strongly recommended. ;-D
Construction of the Displays
Here is the diagram for the two large "Great" Christmas trees.
These are going to consist of:
- 20 feet of segmented chain-link fence pipe
- 24 linear feet of 2x4"
- 8 AC outlet quad boxes
- 16 each 27 foot lighting strands (8 Red, 8 Green, second tree 8 Blue, 8 White)
- Roll of lamp cord
- Wire-welded star
- 5 gallon bucket or plastic box (for holding the electronics and opto-triac modules)
I'm going to mount a piece of oil-rigging pipe in the ground about 2' in order to sink the main mast into. This will make
it removable from the yard during the year and provide stability. Also, I am going to guy wire the top of the mast from the
ground to the tree-top and then to the peak of my roof to tie in the shooting stars.
The 2x4 base will be cut on 11 degree angles, and attached together to form a chord-angle circle. This will also give me the
22.5 degree points where the light strands will be hooked so that they will be equadistantly placed around the circle. I will
pair two light strands together Red/Green - Blue/White. Each strand will start at the base, loop over the top of the pole and end on the
base opposite where it starts. Eight quad outlet boxes will allow me to hook them up so that each box will carry 4 "Hots" and 2
"Neutrals". This will give me individual control over each segment and each color.
Not on the drawing, but at the bottom center inside the base will be an up-ended 5 gallon bucket painted brown. This will
house the 16 opto-triac modules to control that Great Tree (8 segments x 2 colors = 16 channels). AC power will go in and
out to the quad boxes from this large tree base. A 25 conductor ribbon cable will take the discrete out "low" signals from the
Z-80 computer to the 'bucket module'.
The second part of this year's coming display is going to be a series of up to 24 small 2' white lighted 'trees'. I purchased
a large stack of old floral tripods from the local flower shop. I'm going to weld the back leg into
place with the other two so that it forms a triangle pyramid. These I will wrap in white lights using wire-ties to keep
the main parts in place. My plan to add some color and texture to these is to get colored celophone off the web to
wrap the outsides of these small tripod trees.
Although I have 32 total opto-triacs on modules of 16 each to control the Great Trees, I don't have any opto's for the
small trees yet. Although opto-triacs are the easiest way to go, my plan is to build controller interfaces that will
take 8 bits of TTL AS-series logic outputs (74 AS 374) to trigger MOC3063 opto-triac couplers driving standard TO-220 style triacs.
This appears to be by far the most economical solution. 24 channels of control can be easily assembled from these parts for
what it would cost to buy only 2 or 3 opto-22 modules. I have seen a couple of home-brew Christmas light web sites where the
designers parted with a truckload of money to solely use opto-22 modules. This to me is totally unacceptable price-wise
for the price/per channel costs. MOC3063 6-pin DIP opto-couplers are $0.20 each from
BGMicro and a bag of 100 each TO-220 triacs sells on Ebay for $10.00. With a Radio Shack prototype printed circuit board
and a little soldering you can see the savings instantly.
The Electronics
It is a very simple matter to turn light strings off and on in various sequences. All it takes is a little tiny bit
of assembly language software, and some I/O port latch IC's. But this gets boring after a while. Most of the displays
I have seen have some good effects with them. Fading the lights on and off gives a nice subtle effect over the standard
On/Off. Also, with this type of control you can use the music audio level to modulate the lamp intensity. These effects
add a warm fuzzy to the overall light sequences that make the display seem more friendly to those watching.

May 8, 2006 - This is a new schematic page for the Christmas Light Controller, ZIPped in DXF format.
It contains two separate registers for controlling the intensity of the lamps with an 8-bit value $00-$FF.
The outputs of the 74LS374's are for driving the LED's of Opto-Triac SSR's or MOC3063, etc.
Breakdown of how this board works follows:
Lighting Control Board Design

I/O Address Decoding
Notice the signal A7- is derived off the main board to set the decoding
for all addresses $80-$FF, but the software will access them only as $80-$8F.
This is very simplistic decoding using only the Z-80's IORQ- and A7- as enables for the outputs.
Note the two Light Intensity decodes are at $80 and $88 hex.

Light Intensity byte latch, counter and Channel On/Off latch
Theory of Operation
The board uses 74LS374 8-bit data latches as output ports throughout.
Two of the latches will capture the "Light Intensity" byte for that particular zone.
When the AC power wave crosses zero volts, a signal will cause the 74LS193 4-bit counters to reload
the intensity values. Two counters are wired CY to UP so that they act as one 8-bit up counter.
The counters themselves will be clocked by a 555 timer set up to free-run at or around 61.440 kHz.
This allows for a full 256 counts to occur in the time it takes 1/2 of the AC waveform to rise and
fall back to zero. The counter may have to be run somewhat faster in order for lower counts to
complete to $FF and roll over before the next zero-crossing is reached. Otherwise the lights would
simply not turn on at all for values less than, say $0E (just guessing here).
When the zero-cross detection circuit releases the counters, they begin from the intensity value and
count upward until they roll over from $FF to $00, at which point the most significant nybble 74LS193
outputs its CY- signal. This signal clears the 74LS74 latch. This stays cleared until the next zero-crossing
signal is received at which time the latch clocks in the "Hi" and sets.
The other 74LS374 data latches are used to retain "Light Off/On" information which is fed out to the MOC3063 Opto-Triacs.
However, the OE- (Output Enables) are not allowed to output until the Intensity counter rolls over. This can occur at
any pre-programmed point from shortly after the zero-cross circuit releases until it crosses zero again.
If the count is a high value (e.g. $E8) the count will go very quickly from $E8 to $FF and over to $00. This will allow
the On/Off latches to output their "Highs" to the MOC Opto-Triacs shortly after the AC waveform has started to rise, thus
sending the majority of the AC wave out to the lighting circuits, thus they are on bright.
If the count is a low value (e.g. $04) the count will take most of the AC waveforms "on" time to progress from $04 to $FF
and to roll over. This will occur on the lagging side of the AC waveform when it is nearing the point where it will once again
cross zero volts. This only a small "sliver" of the AC waveform is delivered to the triacs, and thus the lights are dim.
Each output channel will consist of an MOC3063 Opto-Triac [6-pin DIP IC]. Its output will in turn drive the Gate lead of a TO-220 style triac.
Its output will be AC voltage to power the Christmas light strands.

Here is the circuit that detects when the AC power waveform crosses the zero-volt zone, hence the name
"Zero-Cross Detection". Zero crossing detection allows the counters to synchronize with the incoming
AC power waveform. By controlling when during the AC wave the opto-triacs are allowed to gate on,
one can control the brightness, or intensity, of the light strings.
I have seen some designs that incorporated so many counters that they were actually used to deliver the on/off to each channel,
but these controllers take a lot of time to wire, and right now the clock towards late November is already ticking against me.
My design is going to be simplistic, but functional and versatile. I am also designing in a way that will keep my software very
simplistic, so that it can fit quite nicely on my small memory spaced Z-80 computer.
Check my BLOG for ongoing progress with this project!!!

Here's an IC layout on a standard Radio Shack 276-147 perf board.