Relays
1. Introduction to Relays
A relay is an electrically operated switch that uses an electrical signal to open or close contacts in another circuit.
Relays allow a low-power control circuit to switch a separate circuit that may operate at a higher voltage or current, provided the relay is correctly rated for the application.
Relays are commonly used in home automation, industrial control systems, motor control, automotive electronics, and electrical protection systems.
10pcs SRD-05VDC-SL-C 1 Channel Relay Module Board 5V High Level for Arduino | eBay
Relé, 5 pines 12V 30A/40A Relé de automóvil Relé de pin Grado profesional | Walmart en línea
5
Example: An ESP32 can control a suitable relay module to switch a lamp on or off. The ESP32 provides the control signal, while the relay contacts switch the lamp's power circuit.
2. Basic Parts of a Relay
An electromagnetic relay contains several important parts.
Budowa przekaźnika - Zrozum jego działanie krok po kroku
A. Coil
The coil is a wire wound around a core. When electric current flows through the coil, it creates a magnetic field.
The coil requires a specified operating voltage, such as 5 V, 12 V, or 24 V DC, depending on the relay.
B. Iron Core
The iron core strengthens the magnetic field produced by the coil. This helps the relay generate enough magnetic force to move its mechanism.
C. Armature
The armature is a movable metal part attracted by the magnetic field when the coil is energized. Its movement changes the positions of the contacts.
D. Contacts
Contacts are conductive parts that connect or disconnect the external circuit.
The three common contact terminals are:
- COM (Common): The movable contact's common connection.
- NO (Normally Open): Disconnected from COM when the relay coil is not energized.
- NC (Normally Closed): Connected to COM when the relay coil is not energized.
E. Spring
The spring returns the armature to its normal position when the coil is de-energized.
3. Working Principle of a Relay
Most conventional relays used in basic electronics are electromagnetic relays. They work using the magnetic effect of electric current.
The operation can be understood in two states.
State 1
Relay OFF — Coil De-energized
When no current flows through the coil, the magnetic field is absent. The spring keeps the armature in its normal position.
- COM is connected to NC.
- COM is disconnected from NO.
State 2
Relay ON — Coil Energized
When the correct voltage is applied to the coil, current flows and creates a magnetic field. The armature moves and changes the contact positions.
- COM connects to NO.
- COM disconnects from NC.
When the coil's power is removed, the spring normally returns the contacts to their original positions.
Important: ON and OFF here describe the relay coil, not necessarily the device connected to its contacts. A load connected through NC may operate when the coil is OFF.
4. Types of Relays
A. Electromagnetic Relay
30-JQC-3F/6V – JCM Electronics
An electromagnetic relay uses a coil, magnetic field, armature, and mechanical contacts.
Applications:
- Switching lamps and fans
- Controlling pumps
- Automotive electrical systems
- Industrial control panels
It provides electrical separation between the coil circuit and the switched contact circuit, subject to the relay's specified insulation ratings.
B. Solid-State Relay (SSR)
Snapklik.com : SSR-25DA Solid State Relay DC To AC Input 3-32V DC Output 24-380V AC
A solid-state relay switches a circuit using semiconductor devices instead of moving mechanical contacts.
Advantages:
- No mechanical contact movement
- Silent switching
- Fast operation
- No mechanical contact wear
Limitations:
- Can generate heat
- May have leakage current when OFF
- Must be selected for the correct AC or DC load type
C. Reed Relay
Littelfuse - MDSR-7-10-20 - Reed Switch, MDSR-7 Series, SPST-NO, Glass Body, 350mA, 140V - RS
A reed relay uses small magnetic contacts enclosed in a sealed glass tube. A magnetic field causes the contacts to open or close.
Applications: Signal switching, measurement equipment, and communication circuits.
D. Latching Relay
A latching relay retains its last switched state after its operating pulse or coil power is removed. A suitable pulse or reset mechanism changes it to the other state.
Applications: Energy meters, remote switching, and systems where reduced coil power consumption is useful.
E. Time-Delay Relay
A time-delay relay switches its contacts according to a specified timing function.
For example, it can turn on a motor after a delay or keep a fan running for a set period after a machine stops.
F. Automotive Relay
Waterproof Automotive Relay 12V 24V – Reliable Performance and Robust – InterCyprus Trading Ltd
Automotive relays are designed for vehicle electrical systems and are commonly used to control headlights, horns, fans, and other electrical loads.
Their contact ratings, coil voltage, pin arrangement, and protection features must match the application.
5. Relay Terminals and Pin Configuration
A common five-terminal electromagnetic relay has two coil terminals and three contact terminals.
| Terminal | Function |
|---|---|
| Coil 1 and Coil 2 | Supply the relay coil's specified voltage |
| COM | Common contact terminal |
| NO | Connects to COM when the coil is energized |
| NC | Connects to COM when the coil is de-energized |
A typical five-pin relay may have a pinout such as 85 and 86 for the coil, 30 for COM, 87 for NO, and 87a for NC. However, pin assignments vary, so check the relay's diagram or datasheet before wiring it.
Some four-pin relays have only COM, NO, and the two coil terminals, without an NC contact.
6. Difference Between NO and NC Contacts
| Feature | NO (Normally Open) | NC (Normally Closed) |
|---|---|---|
| Coil OFF | Open | Closed |
| Coil ON | Closed | Open |
| Load behavior | Can turn on when the coil energizes | Can turn off when the coil energizes |
| Common use | Turn a load on when commanded | Keep a load connected in the normal state |
Example: If a lamp is connected between COM and NO, the lamp is normally OFF and turns ON when the relay coil is energized.
If the lamp is connected between COM and NC, it is normally ON and turns OFF when the coil is energized, assuming the load has its own power supply.
7. Relay Circuit Using a Transistor
A microcontroller GPIO pin generally should not drive a conventional relay coil directly because the coil may require more current than the pin can safely supply.
A common solution is to use a transistor or MOSFET as a driver.
avr - Transistor to run relay - Electrical Engineering Stack Exchange
A basic DC relay driver circuit contains:
- A relay with a coil voltage matched to the supply
- An NPN transistor or suitable MOSFET
- A base or gate resistor where required
- A flyback diode across a DC relay coil, when appropriate
- A power supply capable of supplying the coil current
- A control signal from the microcontroller
How it works
- The microcontroller sends a control signal to the transistor or MOSFET.
- The transistor or MOSFET switches the coil current.
- The energized coil produces a magnetic field.
- The relay contacts change position.
- The connected load switches ON or OFF.
When the coil is switched off, its magnetic field collapses and can produce a voltage spike. A flyback diode across a DC coil provides a path for this current and helps protect the driver. The diode must be connected with the correct polarity.
A relay module may already include a driver transistor, diode, and other supporting components. Check its specifications before adding extra components.
8. Relay with ESP32
An ESP32 can control a relay module for automation projects, but the module must be compatible with the ESP32's GPIO voltage and current limits.
A typical connection for a compatible module is:
| ESP32 | Relay module |
|---|---|
| GPIO pin | IN |
| GND | GND |
| Suitable supply | VCC, according to the module specifications |
The load is connected through the relay's COM and NO or NC contacts.
For example, an ESP32-based room automation system can switch a lamp through a properly rated relay module. The ESP32 sends only the control signal; the relay contacts handle the load circuit.
Important: Relay modules differ. Some use active-LOW inputs, some use active-HIGH inputs, and their coil supplies and input circuits vary. Do not assume that every module can be powered directly from an ESP32's 3.3 V pin.
9. Relay Ratings and Specifications
Before selecting a relay, understand its main specifications.
| Specification | Meaning |
|---|---|
| Coil voltage | Voltage required to operate the coil |
| Coil current | Current consumed by the coil |
| Contact voltage rating | Maximum specified switching voltage for a particular type of load |
| Contact current rating | Permitted contact current under specified conditions |
| Contact arrangement | Whether the relay has NO, NC, or changeover contacts |
| Switching time | Time required for contacts to change state |
| Electrical life | Expected number of switching operations under specified conditions |
| Insulation rating | Electrical separation capability between relevant parts of the relay |
Example
A relay may have a 5 V DC coil and contacts rated for a specified AC or DC load. The 5 V rating describes the coil, not the voltage that the relay contacts must switch.
The actual load must remain within the relay's ratings. Motors, pumps, and other inductive loads can have high starting currents, so their switching requirements may differ significantly from those of a resistive load.
10. Advantages of Relays
- Electrical isolation: The coil and contacts can provide isolation between the control and load circuits.
- High-load switching: Properly rated relays can switch loads that a microcontroller cannot drive directly.
- Simple operation: Electromagnetic relays have a straightforward operating principle.
- Multiple contacts: Some relays can switch more than one circuit at a time.
- Flexible applications: Relays are available for many coil voltages, contact arrangements, and switching requirements.
11. Disadvantages of Relays
- Mechanical wear: Mechanical contacts and moving parts wear out over time.
- Switching noise: Electromagnetic relays often produce a clicking sound.
- Slower switching: Mechanical relays are generally slower than semiconductor switches.
- Coil power consumption: The coil consumes power while energized, except for certain latching designs.
- Contact arcing: Switching certain loads can create arcs that damage contacts.
- Size: Some relays occupy more space than equivalent semiconductor switching devices.
12. Relay vs. Transistor vs. MOSFET
| Feature | Relay | Transistor | MOSFET |
|---|---|---|---|
| Operating method | Mechanical contacts or solid-state switching, depending on type | Semiconductor | Semiconductor |
| Moving parts | In mechanical relays | No | No |
| Switching speed | Usually slower | Usually fast | Usually fast |
| Electrical isolation | Available between coil and contacts in suitably rated relays | Not inherently provided | Not inherently provided |
| AC load switching | Possible with a suitably rated relay | Depends on circuit design | Depends on device and circuit design |
| Typical application | Switching separate load circuits | Signal amplification and switching | Efficient electronic switching and power control |
A mechanical relay is useful when its contact arrangement and isolation characteristics are needed. A transistor or MOSFET is often preferable for fast, frequent, or efficient electronic switching.
13. Applications of Relays
Relays are widely used in:
- Home automation systems
- Room lighting control
- Water pumps and motor control
- Automotive headlights and horns
- Industrial machines
- HVAC equipment
- Alarm and control systems
- Electrical switching and protection circuits
- Microcontroller-based automation projects
14. Safety Precautions
- Always select a relay with appropriate voltage and current ratings for the load.
- Never assume that a relay's low-voltage coil makes its contact circuit safe to touch.
- Mains AC wiring can cause fatal electric shock. Use suitable enclosures, insulation, fusing, grounding, and correctly rated components.
- Keep low-voltage control wiring appropriately separated from hazardous-voltage circuits.
- Use a flyback diode or other suitable suppression method for DC coils where required.
- Do not connect an inductive load such as a motor without considering its starting current and switching characteristics.
In summary: A relay is an electrically controlled switch. An electromagnetic relay uses a coil and magnetic force to change contact positions, allowing a control circuit to switch another electrical circuit. Relays are important components in automation, motor control, and many other electronic systems.