Introduction to Computer Controlled Relays and Switching


If you are new to the idea of a computer controlled relay, then this introduction to switching and relay controllers will teach you all you need to know!

A relay is best defined as a switch that is operated by an electromagnet.  A relay controller is a device that is used to control a bank of switches.  A relay controller works by turning on and off magnetic coils under logic control.  A computer controlled relay driver allows your computer to send simple commands to activate a switch or a group of switches.

Relays are ideally suited for controlling everything from lights and motors to telecommunication, audio, and video signals.  Some relays can be used for switching radio frequency signals.  Relays come in many sizes and ratings.  There are literally tens of thousands of relay varieties on the market.

A Computer Controlled Relay allow you to switch electrical equipment from a computer via RS232, USB, or Wireless communications.  There are many advantages to using a computer controlled relay controller.  When the controlling computer is connected to the internet, relays can be controlled from anywhere in the world.

Internet controlled relay switching allows a local computer or a remote computer to activate a relay.  Wireless relays have one additional advantage: wireless sensors can be used to automatically activate a relay without computer intervention.

Relays typically have two or three connections: Common, Normally Open, and Normally Closed.   The Common is the part of the relay that actually makes a mechanical movement.  By default, many relays have their common (COM) lead connected to the normally closed lead (NC).  When the electromagnet is energized, the COM disconnects from the NC and reconnects to the Normally Open lead (NO).  When the relay is deactivated, the COM reconnects to the NC (see diagrams at right).

Relays often have two ratings: AC and DC.  These rating indicate how much power can be switched through the relays.  This does not necessarily tell you what the limits of the relay are.  For instance, a 5 Amp relay rated at 125VAC can also switch 2.5 Amps at 250VAC.  Similarly, a 5 Amp relay rated at 24VDC can switch 2.5 Amps at 48VDC, or even 10 Amps at 12VDC.

An easy way to determine the limit of a relay is to multiply the rated Volts times the rated Amps.  This will give you the total watts a relay can switch.  Every relay will have two ratings: AC and DC.  You should determine the AC watts and the DC watts, and never exceed these ratings.

AC Volts x AC Amps = AC Watts DC Volts x DC Amps = DC Watts
Example: A 5 Amp Relay is Rated at 250 Volts AC.  5×250 = 1,250 AC Watts Example: A 5 Amp Relay is Rated at 24 Volts DC.  5×24 = 120 DC Watts
If you are switching AC Devices, Make Sure the AC Watts of the Device you are Switching DOES NOT Exceed 1,250 when using a 5A Relay. If you are switching DC Devices, Make Sure the DC Watts of the Device you are Switching DOES NOT Exceed 120 when using a 5A Relay.

Relays are often rated for switching resistive loads.  Inductive loads can be very hard on the contacts of a relay.  A resistive load is a device that stays electrically quiet when powered up, such as an incandescent light bulb.  An inductive load typically has a violent startup voltage or amperage requirement, such as a motor or a transformer.

Inductive loads typically require 2-3 times the run-time voltage or amperage when power is first applied to the device.  For instance, a motor rate at 5 Amps, 125 VAC will often require 10-15 amps just to get the shaft of the motor in motion.  Once in motion, the the motor may consume no more than 5 amps.  When driving these types of loads, choose a relay that exceeds the initial requirement of the motor.  In this case, a 20-30 Amp relay should be used for best relay life.

Relay Varieties

Relays Come in Many Varieties, the most Common Relay Varieties Include:

Computer Controlled Switching - SPST


SPST Single Pole Single Throw Relays simply connect two wires together.  The COMMON is the moving part of the relay that comes in contact with the Normally Open when the coil to the relay is energized.This kind of relay is often available in a normally closed configuration if needed..

Computer Controlled Switching - SPDT


SPDT Single Pole Double Throw Relays have three connections.  Common, Normally Open, and Normally Closed.  When the relay is off, the common is connected to the normally closed connection of the relay.  When the relay coil is energized, the Common swings over to the Normally Open Connection of the Relay.

Computer Controlled Switching - DPST


DPST Double Pole Single Throw Relays have two separate switches, activated by a single coil.  By default, the Common connections are not connected to anything.  When the relay coil is energized, both Common Arms move to the Normally Open Connections.This kind of relay is often available in a normally closed configuration if needed.

Computer Controlled Relay - DPDT Diagram


DPDT Double Pole Double Throw Relays have a single coil with two arms that move at the same time.  There are two completely separate SPDT switch mechanisms inside a DPDT relay.  DPDT relays are most commonly used for signal switching applications, but can be found in high power switching applications.

Since a relay is just a switch, it is very easy to wire up a relay to control just about any kind of electrical device.  Relays are unmatched in their versatility; offering fast response times, long life, and very low on resistance.  In the connection diagram below, relays are used to control a motor.  These connections are similar to the connections found on NCD relay controllers, whereby each relay has three points of connection to external electrical equipment.

Simple Computer Controlled Relay Diagram
Simple Computer Controlled Relay Diagram

Simple On/Off Connection

A simple circuit that turns on a motor when a relay is turned on.

Computer Controlled Relay Diagram
Computer Controlled Relay

Motor Forward/Reverse Wiring Connection

When relay 1 is activated, the motor spins in reverse.  When relay 2 is activated, the motor spins forward.  When both relays are off, the motor is electrically braked to V+, bringing the motor to an immediate halt.  Activating both relays brings brakes the motor to ground causing an immediate halt, but causes electrical noise on the ground plane that can interfere with surrounding electronics.

Computer Controlled Relay Basics

Longevity:  How Long do Relays Last?

The life of a relay is determined by many factors.  The most important variable in the lifespan of a relay is choosing a relay that adequately matches your switching requirements.  Relays can have a mechanical life of 10,000 to 10,000,000 or more on/off cycles.  But the contacts themselves can easily be damaged by choosing a relay that is below the requirements of your switching application.  Build quality tends to be very low on the list of important factors that determine the lifespan of a relay.  Today’s relays tend to have an excellent build quality, regardless of manufacturer.  For the purposes of the NCD product line, we warrant our relays for constant use for a period of 5 years.  Meaning you can use the controllers as much as you want for 5 years, if the relay fails, we will replace it.

A computer controlled light switch is a relatively simple task for a Relay and it should last for many years of use. A higher power load on a Relay could reduce the number of total cycles it can handle. To be safe we always recommend using a higher amperage than may seem necessary to increase longevity.

Computer Controlled Switching Speed:  How Fast Can a Relay Switch?

Most of the relays we use in our product line have a close time of about 5ms, and a release time of 10ms.  A close time is the time it takes for the COM to connect the NO.  A release time is the time it takes for the COM to connect to the NC.  Large power relays, rated at 20 Amps or greater usually take a little longer, in most cases, 25-50 ms.  Many of the relays we use are rated at 1,800 closures per minute.  Larger power relays may be rated for less frequent use, but few applications will require such speed.  Our relay controllers are capable of controlling relay signals at speeds that exceed the mechanical reaction speed of the relay, ensuring you will always have the best performance.

Computers can easily outpace the physical speed limits of any relay.  For this reason, computer controlled switching software should allow for some time for a relay to respond to your relay activation request.  Our controllers, by default, impose some speed restrictions to help prevent a computer from over-running the relay.  These speed limits are easily removed using device configuration settings.  Removing these restrictions will improve computer controlled switching speed, but it will be up to the user to be responsible, and recognize the limits of a mechanical relay and pace the commands to the controller accordingly.

Sealed vs. Unsealed Relays

Sealed relays are typically preferred.  In today’s relay controllers, we only use sealed relays with the exception of our 1 Amp DPDT series controllers.  Sealed relays are preferred because they have better resistance to dust and moisture.  Sealed relays also have one other property that is not often discussed.  In power relay applications, a relay will typically generate sparks between the contacts.  Relay sparking can be greatly reduced in a sealed relays.  The reason being, the sparking eventually burns up most of the oxygen inside the relay, greatly slowing corrosion on the contacts.

Solid State vs. Mechanical Relays

Both kinds of relays have their advantages and disadvantages.  Mechanical relays have the advantage of being able to switch just about any kind of signal you can throw at it.  They tend to be a little slower and a lot noisier.  Solid state relays on the other hand have the advantage of exceptional switching speed and there are no contacts to corrode, and they are much quieter, but must be purchased for either AC or DC exclusively.  Solid State relays typically require a minimum signal for power switching applications.  They do not function properly if the minimum signal is not present.  In terms of life span, it is automatically assumed that mechanical relays would have a shorter life than solid state relays, however a properly chosen mechanical relay can last just as long.  Mechanical relays are much more immune to electrical surges and can often outlast similarly rated solid state relays for this reason alone.  Mechanical relays are often available in more configurations, such as SPDT, DPDT, and DPST.  Most solid state relays are only available in SPST configuration.

Isolation and EMI

As you might expect, Mechanical Relays offer superior electrical isolation.   But when it comes to Electromagnetic Interference (EMI), mechanical relays act as an antenna and drive EMI directly back into anything that is controlling it.  Solid State relays on the other hand offer superior EMI and electrical isolation.  Any application that involves highly inductive switching should ONLY use Solid State relays.

Extending Relay Life

The life of a relay can be extended in several ways.  One of the best ways to increase relay life is to choose a relay that is 2-3 times more powerful than your rated application.  You can also use capacitors and diodes to help shunt voltage spikes away from relay contacts when controlling inductive loads.  Keeping a relay turned on all the time doesn’t necessarily hurt the relay, but does cause electrical wear.  Take advantage of the Normally Closed line if available on your relay.  When possible, wire up your relays so that it can spend most of it’s time in the OFF state.

Communicating to an NCD Relay Controller

Communicating to one of our relay controllers is very easy, even if you have never used our products before.  Most of our products connect to the serial port of your computer (please consult the product manual for complete connection details).  You can use a USB to serial adapter if you do not have a serial port available.  Once connected, all you have to do is send a few simple bytes of data out the serial port to activate/deactivate a relay.  This can be done by either using software that we have developed, or by writing your very own simple programs to communicate to the relay controller.  Different relay controllers have different command sets.  Meaning, you send different bytes of data to do different thing with the different relay controllers we offer.

Computer controlled switching has evolved well beyond the serial port since we opened for business in 1995.  Most communications technologies still utilize serial communications as a backbone for embedded computing.  For instance, it is not unusual for a modern Bluetooth communication module to communicate serial data to our complete line of computer controlled relay devices.  Similarly, TCP/IP data is translated into serial bytes, allowing computer controlled switching with a modern WiFi interface processor.  Popular wireless communication technologies, such as ZigBee and 802.15.4 also use serial communications as the primary interface.  We have adopted the use of the XBee standard (developed by as the primary physical connection for all of our computer controlled relay devices.  This allows modern wireless protocols to talk to our devices using the good old fashioned serial port.  While the serial port has all but disappeared from the back of modern computers, it has found new life in embedded applications, where it remains the most prolific communication standard for processor to processor communications.  Since our computer controlled relay devices utilize this standard, it is possible to adapt our devices into any communication standard available, including Ethernet, WiFi, Bluetooth, Industrial Wireless, USB, as well as the old RS-232 standard.

Your First Computer Controlled Relay

We have developed many resources on our web site that will get you started using our line of relays controllers, ideal for just about every computer controlled relay application you can imagine.  Our company was founded on premise that computer controlled switching can be accomplished by anyone using a PC either locally or over the internet.  We manufacture thousands of switching devices and we often customize our products for large manufacturers.