A relay is an electrically operated switch that uses a low-power control signal to open or close a separate, higher-power circuit. When makers and engineers ask what are relays in electronics, they are usually trying to solve a specific problem: how to let a fragile 3.3V microcontroller safely turn on a 120V AC space heater or a 12V automotive fuel pump without frying the silicon. Relays bridge the gap between logic-level control and high-power execution, acting as the bouncer between your sensitive logic circuits and your heavy, noisy power loads.
The Core Mechanism: What a Relay Changes in Your Circuit
The most critical thing a relay changes in a real circuit is galvanic isolation. Unlike a transistor, which shares a common ground between its control and load sides, a standard electromechanical relay (EMR) uses a magnetic field to physically move a metal contact. There is zero electrical connection between the coil (control) and the contacts (load).
Let’s look at a worked numeric example using the ubiquitous Songle SRD-05VDC-SL-C, a 5V relay found on thousands of hobbyist modules (typically costing around $1.50).
- The Control Side (Coil): The internal electromagnet requires 5V DC at 71mA (roughly 355mW) to pull the contacts closed. A microcontroller GPIO pin cannot supply 71mA, so the module includes a small NPN transistor (like a 2N2222) to amplify the 15mA GPIO signal into the required coil current.
- The Load Side (Contacts): The physical silver-alloy contacts are rated for 10A at 250VAC or 10A at 30VDC.
If you use this relay to switch a 120V AC desk lamp drawing 0.5A (60W), the 5V logic circuit and the 120V AC mains circuit share no common wires. The only link is the magnetic flux across the air gap inside the relay’s plastic shell.
Where You Meet Relays in Practice
You will encounter relays across almost every electrical discipline, though their form factors change drastically based on the environment:
- Automotive Systems: The standard Bosch-style 5-pin 12V relay (e.g., Bosch 0 332 209 150, rated for 30A/40A) is used to switch headlights, fuel pumps, and starter solenoids. They handle massive inrush currents and survive harsh under-hood temperatures.
- HVAC and Home Wiring: Thermostats use 24VAC control signals to trigger heavy-duty contactors (essentially oversized relays) that switch the 240V AC compressors in your heat pump or AC unit.
- Smart Home IoT: Devices like the Shelly 1PM or Sonoff Basic use miniature 10A or 16A relays to allow a 3.3V ESP8266/ESP32 chip to switch existing wall lighting circuits over WiFi.
- Industrial PLCs: Programmable Logic Controllers use "interposing relays" to protect their expensive, low-current output cards from the inductive kickback of factory floor solenoids and motor starters.
Bench Walkthrough: The Inductive Kickback Reset
To truly understand relay behavior, we need to look at what happens when things go wrong on the workbench. Here is a classic failure scenario.
The Setup: You are building an automated irrigation system. You use an Arduino Uno to control a 12V, 5A water solenoid valve. You wire the solenoid to the Normally Open (NO) contacts of a 5V relay module. You power the relay module’s VCC pin directly from the Arduino’s onboard 5V regulator, and you connect the control pin to Arduino GPIO D8.
The Numbers: The solenoid draws 5A at 12V from an external power supply. The relay coil draws 75mA at 5V. The Arduino’s onboard linear regulator can supply up to 500mA. Mathematically, 75mA is well within the 500mA limit, so the circuit should work perfectly.
The Outcome: You upload the code. The GPIO goes HIGH, the relay clicks, and the water valve opens. But when the code sets the GPIO LOW to turn the valve off, the relay clicks off, the Arduino instantly resets, and the attached LCD display scrambles into gibberish.
What Went Wrong: The relay coil is fundamentally an inductor (a coil of wire wrapped around an iron core). When the transistor cuts power to the coil, the magnetic field collapses rapidly. According to Faraday’s law of induction, this collapsing field induces a massive reverse voltage spike—often exceeding 50V to 100V for a fraction of a millisecond. This "inductive kickback" arcs backward through the transistor and couples into the Arduino’s 5V rail, causing a brownout that triggers the microcontroller's internal reset watchdog.
The Fix: You must place a flyback diode (like a standard 1N4007) in reverse-bias across the relay coil terminals (cathode to VCC, anode to the transistor side). When the spike occurs, the diode provides a safe recirculation path for the current, clamping the voltage spike to a harmless ~0.7V. Most commercial relay modules include this diode, but if you are wiring a bare relay on a breadboard, forgetting it is a rite of passage.
Relays vs. Solid-State Switches: Clearing Up the Confusion
People commonly confuse electromechanical relays with solid-state relays (SSRs), logic-level MOSFETs, and contactors. While they all switch power, their operating physics and ideal use cases are entirely different.
| Feature | Electromechanical Relay (EMR) | Solid State Relay (SSR) | Logic-Level MOSFET | Contactor |
|---|---|---|---|---|
| Switching Mechanism | Physical moving metal contacts | Optocoupler + Triac/Thyristor | Semiconductor channel | Heavy-duty physical contacts |
| Switching Speed | Slow (5ms - 15ms) | Fast (Zero-cross or instant) | Very Fast (Microseconds) | Slow (10ms - 30ms) |
| Contact Wear | Yes (Arcing degrades contacts) | No (Solid state) | No (Solid state) | Yes (Designed for high arcs) |
| Voltage Drop / Heat | Near zero (mV range) | High (~1.5V drop, needs heatsink) | Low (Depends on Rds(on)) | Near zero |
| Typical Cost | $1 - $5 | $8 - $25 | $0.50 - $3 | $25 - $100+ |
Choose an EMR when you need to switch both AC and DC loads with minimal voltage drop and low cost, and switching speed isn't critical. Choose an SSR for high-frequency AC switching (like PID temperature control) where mechanical contacts would quickly burn out. Choose a MOSFET for low-voltage DC loads requiring PWM (like LED dimming or motor speed control), as relays cannot handle rapid PWM toggling. Choose a Contactor for 3-phase industrial motors or loads exceeding 30A.
FAQ: Sizing, Suppression, and Contact Welding
Q: Why do my relay contacts weld together when switching a DC motor?
A: DC motors have massive inrush currents (often 5x to 10x their running current) and generate severe arcing when turned off because DC voltage doesn't have a natural "zero-crossing" point to extinguish the arc. If you use a standard 10A AC-rated relay to switch a 5A DC motor, the DC arc can melt the silver-alloy contacts, welding them permanently closed. Always look for relays with specific DC ratings, or use a snubber network and a MOSFET for DC motor control.
Q: Do I need an RC snubber circuit if I already have a flyback diode?
A: A flyback diode protects the control side (the transistor and microcontroller) from the coil's inductive spike. An RC snubber (a resistor and capacitor in series) is placed across the load contacts to suppress arcing when switching highly inductive AC loads like transformers or AC solenoids. They serve two entirely different parts of the relay.
Q: How do I read the relay datasheet contact ratings?
A: Manufacturers like Omron and Littelfuse specify ratings based on load type. A relay rated for "10A Resistive" might only be rated for "3A Inductive" or "1/4 HP Motor". Always derate your relay by at least 50% if you are switching motors, transformers, or incandescent bulbs due to inrush currents.
For deeper reading on relay contact protection and coil drive circuits, the SparkFun Relays Tutorial provides excellent breadboard wiring diagrams, while the Electronics Tutorials electromagnetic relay guide offers a rigorous breakdown of the magnetic flux physics involved in contact pull-in and dropout voltages.






