|
I started on this project late one evening in the Christmas holidays (2007), and finished it the next day. My first job was to create some "Christmas Lights", this basically consisted of four old
LEDs connected to a length of signal cable. I could of had up to 12 including the control lines, but I could only manage to find four working LEDs in my room. All four LEDs were connected on their
own independent terminals and terminated on a common ground like so (please note, the 25 way connector is meant for the Parallel Port, not the Serial Port):
Yes, it doesn't look much like a Christmas Lights set, but it was only there just to show it could be done. If I had used relays and other components, I could of ran a real set from the computer.
Above: The Xmas Lights connected to a 25 way male plug.
The next step was to create a program to control the lights through the parallel port, but as I have done something like this before, it would be a bit boring just to make a program that could
only make a few lights flash, therefore I decided to create a "Christmas Lights Server". My chosen programming language was Microsoft QuickBasic, as I am familiar with it and it is easy to create
an effective program without too much programming (in comparison with a language such as C++). Also, seeing as this could only work under DOS (because Windows does not allow direct hardware access),
it didn't really matter that I was using such an old programming language. Using the great QB TCP/IP routines by Mike Chambers (which make use of the Trumpet TCP stack), I made my program on the
following system (which also became the server when I had finished writing the program):
Toshiba Satellite 110CS:
- MS-DOS 6.22
- Chips and Tech VGA Adaptor
- Xircom CreditCard Ethernet 10/100 PCMCIA card
- Floppy Drive
- Parallel Port, serial etc
- 100MHz Intel Processor
- 800MB HDD
The program is basically a telnet server, so I only needed a telnet client on the remote computer to access my "Christmas Lights Server". I compiled my program to a binary called XMAS.EXE.
To run the program, I would need to load my packet driver for my Ethernet card - CE3PD.COM. I would then need to set the variables for IP etc before running NTCPDRV.EXE
(Trumpet TCP Stack). I would then run XMAS.EXE. After a while, it got annoying having to type this every time, so I created a batch file to automate it:
@echo off
CE3PD.COM
SET IP=192.168.1.25
SET NETMASK=255.255.255.0
SET GATEWAY=192.168.1.1
NTCPDRV.EXE
XMAS.EXE
I would say it better to assign a static IP address for NTCPDRV, due to the fact that NTCPDRV only supports BOOTP, not DHCP. I was surprised that my 3Com OfficeConnect's built in DHCP server
also supports BOOTP, but when taking this project to a family member's house, their BT Voyager router did not support it. In addition to this, static IP addressing is highly recommended over
BOOTP/DHCP if you are intending to get your router to perform port forwarding to your "Christmas Lights Server" (if you want to access your Xmas Lights from outside your network, e.g. the Internet).
Above: The Toshiba Satellite 110CS running the Xmas Lights Server and connected to the network and the Xmas Lights.
When everything was up and running, I could control the lights by using a telnet client on another networked computer (e.g. My wireless Toshiba Libretto 110CT)
The key controls were as follows (when connected):
1 - Turn Light 1 on (Sends 1 bit to the parallel port)
2 - Turn Light 2 on (Sends 2 bits to the parallel port)
3 - Turn Light 3 on (Sends 4 bits to the parallel port)
4 - Turn Light 4 on (Sends 8 bits to the parallel port)
5 - Turn all lights on (Sends 15 bits to the parallel port)
6 - Start pattern (A & Z increase and decrease speed, 0 exits the pattern)
9 - Disconnect
0 - Turn off all lights (Sends 0 bits to the parallel port)
It looked pretty impressive when I put the "Christmas Lights" out my window at night, and went down outside, where I could control them wirelessly using my laptop.
Known Bugs/Flaws
For a start, there was no password protection, anyone could access it from over the internet (I had the port open on my router so I could get a mate to control it from his house - and yes it did work).
The server was single threaded - E.g it could only manage one client at a time, but this wasn't much of a problem as why would you want multiple people controlling one Christmas lights set at once.
If you disconnected from the server when the pattern (option 6) was in progress, the server would stay stuck in that loop and wouldn't be able to listen for more commands or incoming connections.
Another problem with the program is the fact that it currently only supports 1 parallel port on decimal 888-890. If your parallel port resides on another base address, the program will not be able to access it. However this is easy to fix.
Finally, the light pattern is hard-coded as an LED chase, the LEDs look as though they are chasing each other. There is no way to change the pattern without modifying the source code and re-compiling.
Downloads
Download the Binary (with NTCPDRV) in ZIP format: Click Here
If...
If you want to connect some higher current lamps, you could try using this circuit (replace the motors for lamps):
|