The circuit explained here is very dangerous, since it is connected to a 230/110V-power-line. This currency is absolutely deadly, so you have to put the whole thing in a shielded, grounded metalic case, or in an absolutely closed plastic box.
If not build professionaly, the use of this circuit may result in fire, shock, or might even kill someone. I really recomend that the circuit gets inspected by a professional electritian, if you aren't one yourself.
YOU HAVE BEEN WARNED. 110/230 Volts is nothing to play with.
Part 1 - Understanding
For controlling hardware from a computer, there are many different concepts, ranging from a simple 8-device relais-card up to a microprocessor controled dimmer rack, which can control 500 devices at 250 dimming steps each. I have choosen a simple one here, to hold the price flat: You may switch 8 devices connected to a relais-card on your parallel printer port.
The principle is very easy: on the parallel port, you already have 8 uncoded bits of the byte you send to the port. You only need to amplify these signals for controlling a coffee-machine, a light or perhaps computer periphery.
Part 2 - The Hardware
Because you should not use the databits of your port for any work other than ttl, we first have to amplify them, in order to be able to switch the relais. In germany the best and cheapest transisitor for this job is the BD679, I don't know whether this one is available in other countrys.
With this transistor, we switch the 12V-voltage for our relais. So the circuit contains three areas: the 5V-ttl, the 12V-relais-power, and the 110/230V-mains-power.
The resulting schematic:
Abb.2: Die Systemzimmer-CPU
The diodes' job is to shortcircuit the voltage of the relais, which is an inductive device and inducts power back when turned off.
The 12V-power can be taken from a floppy-power-connector in your PC, but you should use a 2A-fuse, so that you do not destroy your PC when somethings goes wrong.
Part 3 - The Software
The parallel port is trivial to handle: you put out a byte, and exactly that byte is reflected by DB0-DB7. I have a little example code for dos in Turbo Pascal, so that you can get the point: port.zip.
An even better piece of software is available for Linux: lpswitch.tgz
Part 5 - Example-implementation
We have build such a thing with 16 relais on two parallel ports. Photos are available here .
And again - sorry for my bad english.