The data line of the parallel port can provide between 0 and 5 volts. Therefore, we can use this line to control a relay and let that relay control an electrical device.
Use pins 2 through 9 to get +5V
Use pins 18 through 25 as the Ground
____________________________________________________________ / \ \ 13 12 11 10 9 8 7 6 5 4 3 2 1 / \ / \ 25 24 23 22 21 20 19 18 17 16 15 14 / \______________________________________________________/ | Vcc for Relay | | / -------+--------| |---------| P data 4.7K B / c | 1N4002 |_| |------- -----------/\/\/\/\---------+-----| NPN ___ | relay |home device | \ e __\_/__ |-| |------- LED X \ |--------| |---------| P Ground | | | ----------------------------+-------+--------+ Relay Ground | ---------------------------------------------+
Key to the Above Diagram
P data parallel port data line(pin 2 to pin 9, use any) P Ground parallel port ground (pin 18 to pin 25, use any) Vcc depends on the type of your relay. I'm using 12VDC Relay Ground the ground for 12VDC 4.7k 4.7K resistor NPN C2235 NPN transistor 1N4002 1N4002 diode LED light emitting diode relay a coil relay
+5 volts from parallel port will turn on the relay. Once the relay is on, the device connected to that relay will be on. When the parallel port's data line goes back to 0, it will turn off the relay, and device is off.
Some FAQ is here:
Here is a Relay, and How it works: ____________________________ | | 1 | | 3 -----|---------s o----------|------- | coil s \switch | 2 | s \ | 4 -----|---------s o- \-------|------- | | | | | | |__________________________|
Above Diagram shows a 4 pin relay. pin 3 and pin 4 are disconnect by default. when you give +12V between pin 1 & pin 2. it will turn on a switch, and pin 3 & 4 are connect now.
relay itself is just a switch. relay power off relay power on |3 |3 | | | | o o \ | o \ o | | | | | | |4 |4
following is a 5 pin relay: _______________________________ | | 1 | | 5 ---------|---+ o------------|---------------- | |-----------/---- s | | / s | 3 | / s | ---------|-----------o/ coil s | 4 | o---s-------|---------------- | | | | | | 2 | | | ----------|---------------------+ | |_____________________________|
by default, pin 3 connect to pin 5. by giving +12V between pin 1 & pin 2. it will turn on a switch, and pin 1 & pin 2 will disconnect. and pin 5 & pin 4 will connect.
relay power off relay power on |5 |5 | | | | o o \ | o \ o o | o | | | | | | | | | | 4| |3 4| |3some relay may have more pins, it just means it has more switch on it.here is how a relay board connect with your home electrical device: +-----+ power outlet 1 _______3 | __|________ || || --| |---------+ | | | || || 2 |relay|4 | (o) (o) | _||___||__ --|_____|----+ |------|---| | | | | | | | +------------+ | | plug ground | | hot | | | | | | __|_|__ | | | | | | |________| | | | | plug | | | | |_|_|_| (i know it doesn't look like a plug, but it's a plug :-) ) || || || ||Just connect your home electrical device to the power outlet. Let's it! you don't need to make any change on the electrical device. And you can connect any kind of device to that power outlet. plug this power outlet to any wall outlet.I wrote a simple program that can control 8 relays. The program is available at the following location and will need g++ in order to be able to use this program. http://edc.sourceforge.net/paralle.tar.gz
A complete circuit can control up to eight relays, that means that a complete circuit can control eight different devices. You will need a DB25 connector.Using a parallel switch cable, connect this relay board to your computer. I put the relay board in a box and use a parallel switch cable to connect it to my Linux box:
Panel: LED, Switch Back: DB25 connectorThe following sites contain some photos of the circuit:
The following URL shows a complete electronic circuit (control 8 devices): http://edc.sourceforge.net/01.png