How to Control Christmas Lights - How to do almost anything with Christmas Displays.
  March 11, 2010 - Thursday |Id: Visitor|Login|Prefs|Register| 288 more shopping days until Christmas  
Home
About
Story
Forum
Forum Pro
How To
Photos
Videos
Classifieds
Community
Score Board

High Scorer
Hill Robertson
Featured Pics
Featured HowTo
Curtain Strobe Modification




HowTo: 128 chan derivative of Hill's 320 design w/ PCB and Linux driver  (Don Law)


                    Page 1   Page 2       Next Page >>

Step 1 : Overview


I started out wanting to control 89 different strings of lights from my computer. I was fortunate enough to find computerchristmas.com and Hill's design for 320 ports on a parallel port.

I didn't need 320 channels, and I wanted to make my master on a 160 mm x 100 mm PCB, which doesn't have enough room for 5 banks of 74LS374 chips. So I decided to go for 128 channels, using only 2 banks from Hill's design.

I used the GEDA system on Linux to enter the schematic for the board. A screenshot of GEDA with part of the schematic is shown on this page. You may have to click on it to enlarge it to readability.



A larger version
is on my website. (Firefox scales this down, so you may have to click on it to zoom it to full size. It doesn't show the complete schematic, just about half of it.) There is also a

Postscript image
of the complete schematic. If you install GEDA, you can use my schematic files. The datafile for the schematic is
on my website


This howto will cover these steps:

  • Overview and schematic

  • From schematic to PC layout

  • The PCB - population, installation

  • A subcontroller

  • A linux device driver




Step 2 : From schematic to PCB layout


The schem2pcb utility in GEDA will take your schematic
and convert it to a PCB layout. I used a 2 layer PCB.
After you convert to PCB, you have to layout the components and connect
all the "networks" (Networks is what GEDA calls the traces).
You can download the

board.pcb
and

board.net
for
my final PCB layout for the pcbtool
from my website if you want to play with them in GEDA.

If you just want the final product, you can get

the zip file

that contains all the RS274-X files that you would need for
a PCB vendor. (The silkscreen has a copyright on it, but you are free to use it for any non-commercial purpose.)

I used olimex (olimex.com) to do my PCB. They can do
a quantity one prototype board for under $50 including
shipping. This page shows a photo of the PCB board
as it came back from olimex.

Step 3 : The PCB - population, installation


Here you see a photo of the master controller finished. I populated it with the chips and soldered CAT5 cable to the outputs. The cable to the parallel port on the computer comes out the top left, and the power connector comes out the bottom left.

**IMPORTANT**The silkscreen has an error - it labels pin 1 of the DB-25 connector at the wrong end. Pin 1 of the DB-25 connector is toward the top of the board. Check your parallel port connection against the schematic, not against the label on the silkscreen.

My basic appoach is to have the master controller send out logic level (5V) signals to subcontrollers. I have 15 subcontrollers, each of which can handle 6 channels. I chose 6 because 1) I wanted to use CAT5 cable, which has 8 conductors, and I needed one for ground 2) the lights in my yard tend to group is sets of 6.

An estute computerchristmas.com user could probably figure out how to make 8 channel subcontrollers by using the ground on the power cord, and thereby all 8 lines in the CAT5 cable for signal.

The advantage of only sending the logic level signal out to the subcontroller is in the wiring. I only have to run CAT5, which is cheap and easy to work with, from the computer to where the lights are. The CAT5 connectors are cheap. The controller only needs one power cable for all 6 channels, and can just take it from the nearest power source. This cuts down on the extension cords and power wiring. I just place the subcontrollers around my yard in close proximity to the 6 light strings each of them control.

Step 4 : A subcontroller


Each subcontroller handles 6 channels. It takes 6 triac drivers,
6 triacs, 12 resistors, and 3 double sockets plus wire. The triac drivers
are MOC3023 chips that I got from Jameco for about 30 cents each.
The MOC3023 only takes 5 mA to trigger, so I chose to drive it
straight from the 74LS374. I don't know exactly what the max
current output of a 74LS374 is, but at least mine aren't getting
warm. :-)

The triac drivers are the white chips on the left side of the
photo. I used the

resistive load schematic

right from the Fairchild documentation for the part.
It amounts to a 470 ohm resistor between the output of the
74LS374 on the master controller and pin 1 of the MOC3023.
Pin 2 goes to ground.

On the triac side, there is a 180 ohm resistor between pin 6 and
the load side of the triac.

For the triacs, I used a nice 8 amp isolated triac from Sanrex, part
number TMG8C60F. I made my own heat sinks out of old license
plates. I just cut one square and drilled 6 holes for the mounting
screws. I got the triacs for about 76 cents from Jameco.

I got the sockets for less than $4 for a pack of 10 at home depot.
The resistors are 1 cent in 100 qty. That brings the cost of
a subcontroller to about $7.50 plus wire.

Step 5 : A linux device driver

I don't do Microsoft. My lights are controlled via the parallel
port on a Linux box. I needed a device driver to issue the I/O
commands to the port. I took Hill's basic algorithm and ported
it into a Linux device driver.

This driver is setup for a 2.4 Linux kernel, like that found in RedHat 9. You may have to modify the driver to work with a modern distribution, since they are mainly based on 2.6.

Help yourself to the source if you want.


pxlc_if.h
is the header file


pxlc.c
is the source file


Makefile
is the make file


flip.c
is a sample user space program to use the driver.

Download these these 4 files into a directory and type

make

make flip

As root:

insmod pxlc.o

mknode /dev/pxlc c 39 0

Then you can run the flip program to flip lights on and off. It needs
one pass to initialize, then it should work OK. To turn on power
on the fourth socket, enter:

flip 3 1

(Remember we start counting from 0, not 1.)


If you find this howto useful or you have any questions or comments, email me at cmpxmas at donlaw.com



                    Page 1   Page 2       Next Page >>
 

 
Designed, Hosted, and Coded by Hill Robertson
Computer Christmas - Copyright © 2001 Hill Robertson