A relay is an electromagnetically controlled on-off switch, used to isolate control electrical circuit from part of circuit that contains load. Current flows through the coil of the relay and creates a magnetic field which moves a lever and changes the switch contacts.
Through the coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as 100mA for relays designed to operate from lower voltages. Most uCs cannot provide this current and a transistor is usually used to amplify the small current from pin to the larger value required for the relay coil. An example of using microcontroller for driving load trough relay is shown on picture.
The supplier's catalogue should show you the relay's connections. The coil will be obvious and it may be connected either way round. Relay coils produce brief high voltage “spikes” when they are switched off and this can destroy transistors and ICs in the circuit. To prevent damage you must connect a protection diode across the relay coil. The protection diode has to be fast recovery type.
The relay's switch connections are usually labeled COM, NC and NO:
- COM = Common, always connect to this, it is the moving part of the switch.
- NC = Normally Closed, COM is connected to this when the relay coil is off.
- NO = Normally Open, COM is connected to this when the relay coil is on.
Relay configurations are shown on picture.
This is a Single Pole Single Throw (SPST) relay. Current will only flow through the contacts when the relay coil is energized.
This is a Single Pole Double Throw (SPDT) relay. Current will flow between the movable contact and one fixed contact when the coil is deenergized and between the movable contact and the alternate fixed contact when the relay coil is energized. The most commonly used relay in car audio, the Bosch relay, is a SPDT relay.
This is a Double Pole Single Throw (DPST) relay. When the relay coil is energized, two separate and electrically isolated sets of contacts are pulled down to make contact with their stationary counterparts. There is no complete circuit path when the relay is deenergized.
This relay is a Double Pole Double Throw (DPDT) relay. It operates like the SPDT relay but has twice as many contacts. There are two completely isolated sets of contacts.
You need to consider several features when choosing a relay:
- Physical size and pin arrangement. If you are choosing a relay for an existing PCB you will need to ensure that its dimensions and pin arrangement are suitable. You should find this information in the supplier's catalogue.
- Coil voltage. The relay's coil voltage rating and resistance must suit the circuit powering the relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readily available. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value.
- Coil resistance. The circuit must be able to supply the current required by the relay coil. You can use Ohm's law to calculate the current. For example: A 12V supply relay with a coil resistance of 400R passes a current of 30mA. This is OK for a 555 timer IC (maximum output current 200mA), but it is too much for most ICs and they will require a transistor to amplify the current.
- Switch ratings (voltage and current). The relay's switch contacts must be suitable for the circuit they are to control. You will need to check the voltage and current ratings. Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V AC".
- Switch contact arrangement (SPDT, DPDT etc) . Most relays are SPDT or DPDT which are often described as "single pole changeover" (SPCO) or "double pole changeover" (DPCO).
How to deal with some types of relays?
Leg Series. Leg series relays are standard SPDT industrial relays. General description is LEG-XX, where XX can be 5, 5F, 12, 12F, 24, 24F. These numbers represent nominal coil voltage. For further information about coil current, coil resistance and maximum allowable current on contacts see industrial spetification. Also, you can see dimension and other useful information. You can find and pin description as it shown on picture.
What you can do with this relay? If you connect C (from picture) pin on ground, and NO pin on one side of load (different than coil supply), after energizing coil load will get ground. You can make other tricks as long as you respect current and voltage limitations.
If you connect C pin ground, and NO pin direct to microcontroller, then coil can be used as detection of voltage that is nominal for relay. If we use LEG-24 and we connect 24V on coil, then logical zero will be connected to uC. In this case relay is used as galvanic isolation from voltage that can destroy low voltage parts of electronic circuit.
If we connect NO and NC pins to different voltage levels, for example, -12V and +12V and load is motor that has one side connected to ground, then ON/OFF of relay changes direction of motor. Remember, in this case after turning on supplies, motor will start to rotate in one direction which is undesirable in most of the cases.
LU series. LU series relays are similar as LEG series. In datasheet you can see other parameters that can be interesting in design.
Basing on these parameters, you can calculate lifetime, maximum working frequency etc.
Every relay is through hole component, but if you bend pins of relay, SMD application is possible.
Remember, if you overload relay, it is possible to destroy relay, usually by merging contacts inside of relay.