Mechanical Relay Primer

From Phidgets Support
Revision as of 21:37, 29 June 2012 by Cora (Talk | contribs) (Basic Use)

Jump to: navigation, search

1017.jpg 3051.jpg


Mechanical relays are devices that can turn on or turn off the power supplied to another device, like a switch. However, instead of having a person flip the switch, mechanical relays switch when provided with a small amount of power. This allows high-power circuits to be controlled by low-power devices.

They perform the same function as Solid State Relays, except they are less expensive and have a shorter lifespan. You can use them to control LEDs, heaters, appliances, and generally any powered device as long as the power you're switching falls within the limits of the relay you're using.

Phidgets sells boards with multiple relays on them, making it easy to control many separate circuits with your computer. Some boards plug straight into your USB port, while others are designed to connect to another device, such as an Interface Kit, or any device with enough Digital Outputs.

How it works

Mechanical Relay
The switching arm and contacts of a SPDT mechanical relay.

Mechanical relays use an electromagnetic coil to open or close the circuit. When current runs through the input and energizes the coil, it creates a small magnetic field which either pulls the arm of the switch away from the other contact of the switch, or pushes it down to close the switch depending on the how the switch is made. A relay also serves as an isolator, because the control (input) and load (output) ends of the relay are not electrically connected. This allows you to protect the device you're using to control the relay from power surges in your application.

Basic Use

Controlling a mechanical relay is as easy as turning on an LED or light bulb. By simply supplying enough power to energize the electromagnetic coil, you will be able to control a mechanical relay. A normal digital output will not be powerful enough without external components as described in the relay section of the Digital Output Primer. A Phidgets device with Digital Output Primer, on the other hand, will be able to control a relay on its own. Relays are often used in large quantities to turn multiple devices on and off in a particular order or timing. For example, a popular trend has been to hook up many strands of Christmas lights to multiple relays and a control system in order to make them flash in rhythm with specific music.

Relays are designed to be controlled by a particular voltage applied to the coil. If you buy a relay product from Phidgets with integrated electronics, this is taken care of for you- you'll be able to switch the relays via USB or with any Phidgets device with enough Digital Outputs (see table below), depending on which relay board you buy. If you are integrating your own relay, you'll want to keep an eye on the specifications. The relay coil is also specified for a particular current. For example, a 5V relay might require 70mA. If you connect this relay to a very weak source of 5V, like a digital output, the output will not be able to provide 70mA, and there will not be enough current to switch the relay.

(table: +mechanical_relay)

Mechanical Relays
Phidgets Product # Connects to etc...
1014_2 USB ...
1017_1 USB ...
3051_1 Digital Output ...

The load side of the relay also requires a minimum current. This minimum load current (also called "wetting current") is a requirement because the electricity needs to conduct through an oxide layer that has formed on the contacts of the relay. If the minimum load current requirement of your relay is too high, you won't be able to use it to switch a signal (such as the data line on an analog sensor), you'll only be able to switch power to a circuit. If you're using a relay to switch a signal, contact bounce might also be a problem.

Switching Speed and High-Frequency Switching

Even though they use moving mechanical parts, mechanical relays switch very quickly. The amount of time it takes for current to begin flowing through the circuit from when the relay's input is activated is in the order of tens of milliseconds. For extremely time-sensitive applications that need to minimize switching delay, Solid State Relays can switch as quickly as 1ms.

You should be careful when using mechanical relays in applications that require very frequent switching. Typically, mechanical relays can only manage one contact every few seconds- any quicker and they may begin to overheat.

Choosing a Relay

Since mechanical relays are nothing more than a controllable switch, they support both AC and DC loads.

The major deciding factor in choosing a mechanical relay is the amount of current it's capable of switching. For example, the most current you can switch with the largest mechanical relay we sell is 5A DC or 10A AC. If the load you're switching consumes more current than our mechanical relays can handle, take a look at our Solid State Relays.

Switch Type

One of the major characteristics of a mechanical relay is the design of the switch inside. A switch can generally be defined by the number of poles and throws it has. The number of "poles" refers to the number of individual circuits the switch controls. The number of "throws" refers to the number of positions the switch arm can occupy.

Switch types.jpg

Single Pole, Single Throw (SPST)

This is a simple switch with only one path for the current to follow. The relay is either designed to be normally open or normally closed. If it is normally open, the arm of the switch is held away from the contact with a spring when the relay is off and the electromagnet pulls the arm to make contact and close the switch when the relay is turned on. If it is normally closed, the arm of the switch is held to the contact when the relay is off, and the electromagnet pulls the arm away when the relay is turned on.

While the decision to use a normally opened or normally closed relay may seem arbitrary at first, it is actually very important for certain applications. If you choose a normally closed relay, it means your load will remain powered as long as the relay coil is not powered. If some other part of your system fails, causing your relay to lose power, your load will remain powered even though it should not be. For loads that are potentially dangerous when left on (such as a heater, or a high-power load) it is best to use a normally open relay, so that in the event of a system failure, the load will remain off. On the other hand, circuits that are designed to be powered most of the time but temporarily interrupted will use less power if they use a normally closed relay. An example of this type of circuit is the radio in a car: When the engine is started, the radio circuit is momentarily switched off because the engine needs a large amount of battery power to start.

Single Pole, Double Throw (SPDT)

Toggle Between Two Loads
By connecting the power supply to the common terminal, and connecting a different load to the other two terminals, a relay with a SPDT switch can be used to toggle power between the two loads.
Full-size Image

This switch has two paths for the current to follow. This type of relay is useful if you want to toggle power between two different loads, as pictured. You can also use a SPDT relay as a single pole, single throw switch, and it can function as normally open or normally closed depending on which pins (common and normally open, or common and normally closed) you connect the load to.

Double Pole, Single Throw (DPST)

This switch functions like two SPST switches, but both switches are controlled by one coil. This type of switch is useful for keeping two loads on separate circuits while still being able to have them turn on and off in unison.

Double Pole, Double Throw (DPDT)

This switch functions the same as a SPDT switch, except there are two of them, but are both controlled by a single input on the relay. You can use this type of switch to simultaneously control two separate circuits.


Contact Bounce

As with any mechanical switch, relays are susceptible to contact bounce. This means that when the switch closes, the arm can bounce on the contact, causing the load's power to flicker slightly. This usually only matters when the application is triggered by pulses in the power signal, or for applications where meaningful data is being switched instead of power. For example, a circuit designed to increment a counter every time power is applied to its input could incorrectly interpret a bouncing relay contact as multiple switch events. Or, a circuit that uses a relay to switch an audio signal between two different paths will experience some static noise when switching if there is significant contact bounce. Check the switch primer for information on how to deal with switch contact bounce. It's worth mentioning that Solid State Relays don't suffer from contact bounce, because they operate without using moving mechanical parts.

Arcing, Interference, and Sticking

Contact arc.jpg

When a mechanical relay opens or closes, for the moment that the arm of the switch is very close (but not connected) to the contact, the electric current can arc through the air between the contacts. This arc can cause interference with nearby electrical instruments and sensors. For example, if an unshielded cable carrying an audio signal is travelling past some relays whose contacts are arcing when they switch, the audio would contain bursts of static noise.

This arcing can also heat up the contacts of the switch enough that they can slowly degrade away until the relay no longer functions. They could also weld together, causing the relay to stay on permanently, which means your load will be powered constantly. If this imposes safety concerns, you should install a fail-safe of some kind. For example, some sauna heaters are turned on with a mechanical relay. In the event of a relay failure, the sauna heater will remain on and continue heating the room beyond the intended temperature. However, a simple mechanical temperature sensor is installed which cuts power to the heater if the room goes beyond a certain temperature.

Some relays are encased in a clear plastic enclosure (sometimes called "ice cube" relays), so the switch contacts can be easily inspected. By inspecting the contacts periodically, you could tell when the relay is getting near the end of its life.

Prolonging Relay Lifespan

In order to prolong the lifespan of your relay, avoid switching loads of higher voltage or current than the relay is built for, and avoid highly inductive loads, which worsen the effects of contact arcing. Your Load will probably be inductive if it is built around a large coil of wire - motors and transformers are typical examples. A load considered resistive may also have loops of wire - for instance, hair dryers, toasters, incandescent bulbs use twisted wire elements to generate the heat. An inductive load will have thousands of loops of wire - it's a matter of scale.

Additionally, you should avoid switching at or near the relay's maximum frequency if possible. You can think of a mechanical relay's lifespan in terms of number times switched rather than the amount of time it's used for. A relay that doesn't need to be switched very often can last a long time. If your application requires constant switching over long periods of time, it might be more cost-effective to use a Solid State Relay.

Arc Suppression

DC Load Protection
A diagram of a mechanical relay switching a DC load. An optional diode and fuse are used to protect the relay and prevent hardware damaged caused by improper wiring.
Full-sized Image
AC Load Protection
A diagram of a mechanical relay switching an AC load. An optional MOV or Transil diode is placed in parallel to protect the relay from voltage spikes.
Full-Sized Image

The main cause of failure for mechanical relays is electricity arcing across the contacts during switching. To lengthen the lifespan of your relay, you can add various circuit elements that mitigate arcing.

For DC powered applications, one simple method of mitigating the effects of contact arcing is to place a feedback diode across the load, as pictured. This will allow some of the residual electricity in the circuit to recirculate through the load instead of contributing to the arc that forms when the switch makes the transition from closed to open. You can buy a suitable diode from any electronics distributor, like this Diode from Digikey.

For AC powered applications, you can put a Metal Oxide Varistor (MOV) across the load terminals of the relay in order to protect it from voltage spikes. An MOV will not remove the entire arc, but it will be helpful in circuits up to several hundred volts. You can buy an MOV from any electronics distributor, like this MOV from Digikey.

For low-voltage AC applications, a bi-directional transient voltage suppression diode ("transil diode") that is rated for higher than the AC voltage of the circuit can be placed across the relay terminals in order to protect it from voltage spikes. You can buy one from any electronics distributor, like this Transil Diode from Digikey.


Mechanical relays are inexpensive and simple devices that allow AC or DC circuits to be switched on and off using a small amount of power. They come in a variety of switch formats, enabling the user to build some very clever control into a circuit. Phidgets Inc. sells boards with multiple relays that can be connected directly to USB, so they can be controlled by your program.

Contact arcing and switch bounce can be an obstacle for some applications, but both are common problems and can be worked around fairly easily. Mechanical relays don't last as long as solid state relays, but if you take care of them, they can be a good cost-effective alternative.

Products in this Category


Switch Type

  • SPST - either normally open or normally closed. Simple on/off switch.
  • SPDT - 3 pins, has both a NO and NC pin and can function like a SPST switch of either type, or can be used to toggle power between two different loads.
  • DPDT - Same as SPDT but there are two controlled by the same relay input. Useful for controlling 2 seperate circuits in a synchronized manner.
  • Potential selection criteria for specific switching circuits.

Contact Arcing

  • As the switch moves from the "on" position to the "off" position (and vice-versa) there is a moment when the arm of the switch in close enough to the contact that electricity will arc through the air, creating lots of heat and possibly damaging the contact. (Diagram would be useful)
  • Arcing can lead to sticking, where the switch welds itself closed. If your relay is always on, it might be stuck.
  • Arcing will be more severe with higher power loads or highly inductive loads.
  • Arcing is expected, but can be mitigated by:
    • For DC, feedback diode across load
    • For AC, Snubber circuit or
    • MOV or
    • TVS

Switching Speed

  • Lifespan of relay is measured in number of contacts, not time in use. Faster switching -> shorter life.
  • Switching is audible - you can hear the switching, which might be annoying / undesirable, or it might be good as a confirmation the system is operating.
  • Switching speed is limited by heating in the contacts - the arcing generates heat, and switching high loads faster than the rated switching speed will cause the relay to overheat.

Operating Time

  • Time it takes for the arm of the switch to connect with the contact after being activated
  • If 10ms is too slow, look at SSRs

Control Voltage

  • Can be controlled via digital output
  • Relay offers isolation between load circuit and control circuit

Maximum (AC/DC) Switching Voltage

  • Secondary selection criteria.

Maximum (AC/DC) Switching Current

  • Main selection criteria.
  • If they need to switch more than 5A DC, or 10A AC, go to SSRs
  • Inductive loads- does the same multiplier apply as for SSRs?

Minimum Switching Current

  • A certain amount of current is needed on the LOAD side of a relay.
  • Oxide films build up on the contacts, so this minimum is required to conduct through them.
  • This spec determines whether or not the relay can switch a signal instead of power.
    • If you are switching a signal rather than power, contact bounce could be a problem.