Do It Yourself Computerizing
How do I computerize... like what hardware do I need to
build something from scratch?
There are several different techniques to connect the
Christmas lights to your computer.
Perhaps the easiest and cheapest to
implement is X-10
technology. You can buy the control modules at many stores and it's
easy to set-up. The only drawback is it takes about two seconds to
send a command, so if you want the lights to flash fast, this isn't the way
to go.
Digital control is the most versatile method of
controlling your lights. You can toggle lights on and off as fast as
the computer can send an instruction... which is very fast. Your
infrastructure setup will look like a star. The computer and high
voltage electricity is at the center and everything radiates out from it.
You can go through a lot of wire, but maintenance is easy.
How is the computer connected to the Christmas lights?
For starters, checkout
D-Light
or Light-O-Rama
for easy to build kits and software packages.
Nuts and Volts magazine also has a couple of good
articles.
You might even consider some gear
from the robotics world.
Click here to see a great article about using USB
relay ports to create a full holiday light system (include Microsoft source
code examples.)
Here's how PlanetChristmas did it over 20 years ago with
descriptions from the original website. The information is a bit dated
but you can get a feel for the basics.
PlanetChristmas
uses boards from a company called CyberResearch (www.cyberresearch.com).
They have a series of "Digital I/O Boards" which plug into a PC ISA slot so
you can control the outside world. In 2002, a 24 I/O port board (part number
CYDIO24) costs $47... a 192 port board (part number CYDIO192) costs $199.
They also have 48 port and 96 port versions. Check them out on their
internet page or order a catalog by calling 1-800-341-2525.
Each of these I/O lines is connected to a solid state
relay (3-5VDC input, 120VAC output... they typically cost $5-$18 each
depending on the current load (I use a 7 amp rated version from Magnecraft.))
Relay details can be found at
Magnecraft. I buy the relays from
Newark Electronics (1-800-463-9275) Delivery is usually 3-5 days from
one of their warehouses. They take credit cards. I use Magnecraft part
number W226R-7-5A1 which translates to Newark Catalog part number 23F5606...
which is at the bottom left on page 808 of Newark's recent catalog. Pricing
is based on volume, time of day, day of the month and fullness of the
moon... in other words, whatever the salesman feels like when you call...
I've never gotten any consistency.
Each of the computer I/O lines (called a circuit) is
connected to the appropriate strings in the yard. Most circuits are in
groups of four or eight so chasing effects can be used. Here are some
closeup pictures of a solid state relay box. To see a simple
electrical schematic, click here.
Keep in mind, this isn't the only way to interface the
computer digital output to the Christmas lights. Hill Robertson and
his Computer
Christmas website can also show you some great ways of doing this trick,
also!
If building all this hardware makes you nervous, consider
Light-O-Rama or
D-Light.
The computer program was originally written in
Microsoft's QBASIC and ran on DOS 6.22. A simple OUT(0) command is written
to a port to toggle it on or off. See some Source Code below! I also
use a short test program to easily command each circuit during initial
setup... it's useful if you are trying to understand how to program the
digital in/out board. Today, it is still a DOS based program, but I
use POWERBASIC to
compile it (mainly because it allows the program to be bigger than 64K in
size) and run it in Windows 98 DOS mode.
The computer spends most of the time in a wait state, but
the full light show takes about 15 minutes. In reality, the computer could
be an old IBM PC (the original one) and the show would run fine.
How do I build a control box?
The key to connecting the computer to the light strings
is the blue eight port switching boxes. This is where the 5VDC output
of the computer is magically connected to the 120VAC required for the
Christmas lights. The trick is to use solid state relays.
Click here for a datasheet for these relays. The relays I use can
be ordered from Newark
Electronics.

And here is a basic electrical schematic of the blue box above:

There are eight identical circuits (of the above
schematic.. see below) The brown perfboard on the right of the blue
box above is where two of the 74LS08 IC chips are mounted... the 74LS08 is
optional... it was added in the early days before the driver chips on the
digital I/O boards got a nit more powerful. The yellow neon
indicator lights seen at the top of the box are wired in parallel to the
high voltage output which monitors when an individual circuit is on.
The blue toggle switch on the left turns on the high voltage to the
entire box and is monitored by the green indicator light next to the toggle
switch. The fat, gray wire leaving the bottom of the box is the master
cable controlling 8 high voltage circuits. The thin gray wire on
the right of the box comes directly from the
CyberResearch I/O card in the PC.
Here is the full schematic of one of the blue boxes used
to switch the light circuits. The output of the digital I/O card in
your computer feeds into the left side of this schematic, where the low
voltage input of the 74LS08 input buffers are. The output of the
buffers connect directly to the low voltage input side of the solid state
relays. The high voltage output of the relays are terminated on
terminal strips for easy connections to extension cords which feed the
Christmas lights around the house.
Note that the 5 volts required for the 74LS08 IC's is
gotten from the computer by tapping into one of the power cables that feed a
floppy drive.

|
Here are the solid state relay boxes. Each
blue box holds 8 solid state relays (called SSRs). The
little perf board on the right inside each box is a simple TTL
buffer to isolate and boost the voltage coming from the
CyberResearch controlling card (again, these are optional.)
Each relay box responds to one byte of information. Each byte
contains 8 bits and each bit controls a relay. There are 2 to
the eighth combinations or 255. So sending 255 to a box will
turn on all the relays and sending a 0 will turn off all of the
relays.
This is relay box number 28 (of 72 for 2002).
Letters A-H correspond to the individual circuits. When I say
turn on 28F, I know exactly which pilot light should come on.
Here is the front of a relay box.

Below is looking into the top of a relay box
(with the cover off) from the back.

Below is again looking at the top of a relay box
from the front. I use Magnecraft Solid State Relays (those
eight black blocks with the silver mounting tabs at the top of the
above picture.
Click here for the Magnecraft datasheet.

The yellow cord going out the right side is the primary AC power
coming into the box. Each solid state relay has a 7 amp
(at 120VAC) capacity (if they were heatsinked better.) In my
layout, I'll run anywhere from 30-300 watts through one circuit.
How do you connect the circuit card to the solid
state relay boxes?
There are up to three CyberResearch controlling
cards inside the PC. Each card can control 192 relays.
The card is connected via 50 conductor ribbon cables to a DB-15 plug
panel where the relay boxes can connect to.
Below is the view of the back of the PC where the
50 conductor ribbon cable come out. There are three
cards so there are three sets of cables (but this is an old picture
and you can only see two.)

Below is the DB-15 plug panel. Each gray
cable coming out the top goes to a relay box.

How
did Chuck Smith do the original PlanetChristmas?
Where do you want to start? Chuck had
PlanetChristmas all connected directly to one computer that controls
everything.
So what is this thing to the left? There are 72
circuit boxes, each controls 8 circuits, giving the computer the
ability to control 576 discrete circuits.
Think you can write your own code? You
probably can. Below is a ten year old program that actually
compiled and was used to test everything. No guarantees but if
it's useful, please take advantage of it!
'Program Name: TESTIT.BAS
'Used to check individual circuits of Xmas display
LU$ = "Last update 04-25-98 at 07:03."
DEFINT A-Z
DIM p(48)
LP$ = "off": 'on if line printer is available
test = 0: 'set to one if I/O board is not installed
' Initialize the time variables
CLS
PRINT LU$
LOCATE 5, 1
PRINT "Initializing global variables..."
mc% = 48: ' max number of 8 circuit boxes
df = 32000
A = 1
B = 2
C = 4
D = 8
E = 16
F = 32
G = 64
H = 128
a(1) = 1
a(2) = 2
a(3) = 4
a(4) = 8
a(5) = 16
a(6) = 32
a(7) = 64
a(8) = 128
PRINT
PRINT "Initializing I/O board variables..."
BAS = 768: ' 300 hex for I/O Board #1 192 Circuits
BIS = 800: ' 320 hex for I/O Board #2 192 Circuits
'I/O Board #1 Setup for all ports to OUT
OUT BAS + 3, 128
OUT BAS + 7, 128
OUT BAS + 11, 128
OUT BAS + 15, 128
OUT BAS + 19, 128
OUT BAS + 23, 128
OUT BAS + 27, 128
OUT BAS + 31, 128
'I/O Board #2 Setup for all ports to OUT
OUT BIS + 3, 128
OUT BIS + 7, 128
OUT BIS + 11, 128
OUT BIS + 15, 128
OUT BIS + 19, 128
OUT BIS + 23, 128
OUT BIS + 27, 128
OUT BIS + 31, 128
'Individual BYTES for Board #1
p(1) = BAS + 0
p(2) = BAS + 1
p(3) = BAS + 2
p(4) = BAS + 4
p(5) = BAS + 5
p(6) = BAS + 6
p(7) = BAS + 8
p(8) = BAS + 9
p(9) = BAS + 10
p(10) = BAS + 12
p(11) = BAS + 13
p(12) = BAS + 14
p(13) = BAS + 16
p(14) = BAS + 17
p(15) = BAS + 18
p(16) = BAS + 20
p(17) = BAS + 21
p(18) = BAS + 22
p(19) = BAS + 24
p(20) = BAS + 25
p(21) = BAS + 26
p(22) = BAS + 28
p(23) = BAS + 29
p(24) = BAS + 30
'Individual BYTES for Board #2
p(25) = BIS + 0
p(26) = BIS + 1
p(27) = BIS + 2
p(28) = BIS + 4
p(29) = BIS + 5
p(30) = BIS + 6
p(31) = BIS + 8
p(32) = BIS + 9
p(33) = BIS + 10
p(34) = BIS + 12
p(35) = BIS + 13
p(36) = BIS + 14
p(37) = BIS + 16
p(38) = BIS + 17
p(39) = BIS + 18
p(40) = BIS + 20
p(41) = BIS + 21
p(42) = BIS + 22
p(43) = BIS + 24
p(44) = BIS + 25
p(45) = BIS + 26
p(46) = BIS + 28
p(47) = BIS + 29
p(48) = BIS + 30
GOTO 1000
100
' turn everything off =============================================
FOR ZZ% = 1 TO mc%
OUT p(ZZ%), 0
NEXT ZZ%
RETURN
' Turn everything on ==============================================
FOR z% = 1 TO mc%
OUT p(z), 255
NEXT z%
RETURN
200
' Delay Routine
delay 0.05
RETURN
1000 ' **********************************************************************
' START OF USER INTERFACE
' *********************************************************************
CLS
'PRINT LU$
LOCATE 1, 1
COLOR 2, 0
PRINT "TESTIT Circuit Tester Instructions / Syntax A B C D E F G H"
PRINT "---------------------------------------------------- ======================"
PRINT "Enter box number (1-27) 1 2 3 4 5 6 7 8"
PRINT "followed by letter(s) A-H"
PRINT "followed by + for on, - for off or z for chase"
PRINT "ZALL will chase all circuits in all boxes"
PRINT "! will turn all circuits in all boxes off"
PRINT "*, exit or end will exit this program"
PRINT "----------------------------------------------------"
PRINT "example: 12A+ will turn on circuit A in box 12"
PRINT " 12+ will turn on all circuits in box 12"
PRINT " 12- will turn off all circuits in box 12"
PRINT " 12z will chase the circuits in box 12"
PRINT " ZALL will chase ALL of the boxes"
PRINT " ! will turn all boxes and circuits off"
PRINT " * will exit the program"
PRINT "----------------------------------------------------"
COLOR 7, 0
lc$ = " "
LOCATE 23, 1
COLOR 4, 0
PRINT LU$
COLOR 7, 0
1100 LOCATE 19, 1
COLOR 10, 0
PRINT "last command: "; lc$; : 'IF CN > 0 THEN PRINT CN
COLOR 7, 0
1150 LOCATE 21, 9
PRINT " "
LOCATE 21, 1
COLOR 15, 0
PRINT "command: ";
COLOR 7, 0
LINE INPUT ""; C$
IF ASC(C$) = 27 THEN CLS : END
'PRINT ASC(C$)
C$ = UCASE$(C$)
IF C$ = "*" THEN CLS : END
IF C$ = CHR$(27) THEN CLS : END
IF C$ = "END" THEN CLS : END
IF C$ = "EXIT" THEN CLS : END
lc$ = C$ + " "
GOSUB 2000
GOTO 1100
2000 'process the command
IF LEFT$(C$, 1) = "!" THEN GOSUB 100: RETURN
IF C$ = "ZALL" THEN 2500
BN = VAL(C$): 'pull box number from the command
IF BN < 0 OR BN > mc% THEN er$ = "first value must be between 1 and" + STR$(mc%): GOSUB 10000: RETURN
'find the command tail
ct$ = RIGHT$(C$, 1)
IF ct$ = "+" THEN 2100
IF ct$ = "-" THEN 2100
IF ct$ = "Z" THEN 2175
er$ = "be sure to add a + or - at the end of the command": GOSUB 10000: RETURN
2100 'now find the stuff in the middle (if any...)
FOR I = 1 TO 10
y$(I) = ""
NEXT
counter = 1
FOR I = 1 TO LEN(C$)
X$ = MID$(C$, I, 1):
IF ASC(X$) > 64 AND ASC(X$) < 73 THEN y$(counter) = X$: counter = counter + 1
NEXT
GOTO 2150
'print out the results
LOCATE 10, 50
PRINT "results... counter="; counter - 1
FOR I = 1 TO 10
LOCATE 10 + I, 50
PRINT " "
NEXT
FOR I = 1 TO 10
LOCATE 10 + I, 50
PRINT "y("; I; ") = "; y$(I)
NEXT
2150 IF ct$ = "+" THEN 2200
IF ct$ = "-" THEN 2400
2175 'chasing
LOCATE 23, 1
COLOR 28, 0
PRINT " ***** press any key to stop chasing ***** "
COLOR 7, 0
FOR j = 1 TO 8
OUT p(BN), a(j)
GOSUB 200
NEXT j
' FOR j = 7 TO 2 STEP -1
' OUT p(BN), a(j)
' GOSUB 200
'NEXT j
C$ = INKEY$
IF C$ = CHR$(27) THEN 2180
IF C$ = "" THEN 2175
2180 OUT p(BN), 0
LOCATE 23, 1
PRINT " "
RETURN
2200 'turn on a box
LOCATE 23, 1
PRINT " "
IF counter = 1 THEN CN = 255: OUT p(BN), CN: RETURN: 'turn on all of box
CN = 0
FOR I = 1 TO counter
IF y$(I) = "A" THEN CN = CN + 1
IF y$(I) = "B" THEN CN = CN + 2
IF y$(I) = "C" THEN CN = CN + 4
IF y$(I) = "D" THEN CN = CN + 8
IF y$(I) = "E" THEN CN = CN + 16
IF y$(I) = "F" THEN CN = CN + 32
IF y$(I) = "G" THEN CN = CN + 64
IF y$(I) = "H" THEN CN = CN + 128
NEXT I
IF BN > 255 THEN BN = 255
OUT p(BN), CN
RETURN
2400 'turn off a box
LOCATE 23, 1
PRINT " "
IF counter = 1 THEN CN = 0: OUT p(BN), CN: RETURN: 'turn off all of box
CN = 255
FOR I = 1 TO counter
IF y$(I) = "A" THEN CN = CN - 1
IF y$(I) = "B" THEN CN = CN - 2
IF y$(I) = "C" THEN CN = CN - 4
IF y$(I) = "D" THEN CN = CN - 8
IF y$(I) = "E" THEN CN = CN - 16
IF y$(I) = "F" THEN CN = CN - 32
IF y$(I) = "G" THEN CN = CN - 64
IF y$(I) = "H" THEN CN = CN - 128
NEXT I
IF BN < 0 THEN BN = 0
OUT p(BN), CN
RETURN
2500 'chasing all of them
LOCATE 23, 1
COLOR 28, 0
PRINT " ***** press any key to stop chasing ***** "
COLOR 7, 0
FOR j = 1 TO 8
FOR BN = 1 TO mc%
OUT p(BN), a(j)
NEXT BN
GOSUB 200
NEXT j
FOR j = 7 TO 2 STEP -1
FOR BN = 1 TO mc%
OUT p(BN), a(j)
NEXT BN
GOSUB 200
NEXT j
C$ = INKEY$
IF C$ = "" THEN 2500
FOR BN = 1 TO mc%
OUT p(BN), 0
NEXT BN
LOCATE 23, 1
PRINT " "
RETURN
10000 'error condition
LOCATE 23, 1
PRINT " "
LOCATE 23, 1
PRINT "ERROR: "; er$
BEEP
RETURN
|
|

|