Computer Control Of External Devices Using Relay

Electronic Components Needed to Connect a Computer to a Mains Switch

© Martin Bell

Jul 9, 2009
Electronic Components Are Easily Available, wax115
Relay circuits can be used to take a small current from a computer printer port and switch on appliances that use a much larger current such as household devices.

The article Using Home Computers To Control A Household Device describes how to drive a small motor using the electronic current output from a computer parallel printer port. This article describes the components and connections needed to use an electromechanical relay to switch on larger appliances like heaters or lights.

Optoisolator Connections

Although it may be possible to connect directly from the printer port to the relay, it is not advisable for safety reasons. Figure 1 shows how to connect the optoisolator to the printer port. The OPI110 optoisolator will be used as an example here. It has four connections as follows:

1 - Connect to Pin 2 of printer port.

2 - Connect to Pin 18 of printer port

3 - Connect to Relay (Lower connection)

4 - Connect to Relay (Upper connection)

Note that printer ports 2 and 18 are only one possible pair: it is also possible to use pins 3 and 19, 4 and 20 etc. It is possible to connect several devices from the same printer port, but each device needs a separate optoisolator and relay circuit.

Pin 1 on the optoisolator is marked with a small circle on the casing.

Electromechanical Relay Connections

The relay consists of three main sections (See Figure 1):

1 - Input from the optoisolator

2 - Input from the mains electricity

3 - Output to the device to be controlled

The type of electromechanical relay chosen should reflect the type of output chosen. For example, if the device to be controlled uses Alternating Current (AC) such as a household lights, then the relay should have an AC output. If the appliance to be controlled uses Direct Current (DC) such as a small heating device, then the relay should have a DC output.

When the components have been connected as shown in Figure 1, the mains electricity supply to the electromechanical relay should be switched "ON". The output to the device to be controlled should also be switched "ON". All that remains then is to set up the computer or laptop to print the correct number to the printer port, so as to switch on the appliance.

Summary of Connections From Printer Port To Relay Using Optoisolator

It is often useful to be able to control electrical appliances and devices using a small current output from a parallel printer port on a personal computer or laptop. The electrical and electronic components needed to achieve this are readily available and cheap. Figure 1 of this article shows what components are required, as well as how to connect them all together.

NOTE: Only those qualified and competent to work with electricity or electronics should attempt to build the circuits described here. Professional advice should always be sought first.


The copyright of the article Computer Control Of External Devices Using Relay in Computer Engineering is owned by Martin Bell. Permission to republish Computer Control Of External Devices Using Relay in print or online must be granted by the author in writing.


Electronic Components Are Easily Available, wax115
Figure 1 - Electro-mechanical Relay Connections, M Bell
     


Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo