
Understanding and Using Relays in Electronics: The Complete Guide
Relays are one of the most fundamental components in electronics and electrical engineering. Acting as electrically controlled switches, they allow low-power circuits like microcontrollers to control high-power devices such as motors, lights, or home appliances.
In this blog, we’ll explore everything you need to know about relays: how they work, where to use them, how to wire them, and how to safely integrate them into your electronic projects.
What is a Relay?
A relay is an electromechanical switch operated by an electric current. When current flows through its coil, it generates a magnetic field that moves an internal switch to open or close a circuit.
Basic Relay Structure Includes:
-
Coil: Energized to create a magnetic field.
-
Armature: A movable lever that responds to the magnetic field.
-
Contacts: The switching terminals commonly NO (Normally Open), NC (Normally Closed), and COM (Common).
Spring: Returns the armature to its resting position when coil is de-energized.
Types of Relays
-
Electromechanical Relays (EMRs)
Most common for general electronics mechanical movement opens/closes the circuit. -
Solid-State Relays (SSRs)
Use semiconductors no moving parts, faster and more durable but costlier. -
Reed Relays
Compact and fast-switching, using magnetic reeds enclosed in glass.
Latching Relays
Maintain state without constant power great for memory or low-energy applications.
Relay Pinout and Configuration
A typical 5V or 12V SPDT (Single Pole Double Throw) relay module will have:
-
VCC: Power to coil (usually 5V or 12V)
-
GND: Ground
-
IN: Control signal (from microcontroller)
-
COM (Common): Shared terminal for switching
-
NO (Normally Open): Disconnected by default; closes when relay is active
NC (Normally Closed): Connected by default; opens when relay is active
How Does a Relay Work?
Let’s take a simple example: controlling a 230V AC bulb using an Arduino and a 5V relay module.
-
When the Arduino sends a HIGH signal to the relay’s IN pin, the coil energizes.
-
The magnetic field closes the switch between COM and NO.
-
The bulb circuit is completed and the AC bulb turns ON.
When the signal goes LOW, the connection opens and the bulb turns OFF.
Why Use a Relay in Electronics Projects?
✅ Electrical Isolation: Protects your microcontroller from high-voltage spikes.
✅ High-Voltage Control: Enables control of AC devices using low-voltage logic.
✅ Automation: Perfect for home automation, smart irrigation, alarm systems.
✅ Power Management: Safely turn on/off heavy loads like motors or heaters.
Relay Wiring Diagram
Here’s how to wire a relay module with an Arduino and a 230V load:
Components Needed:
-
230V AC Load (e.g., lamp)
-
230V power source
Wiring:
-
Arduino D7 → Relay IN
-
Arduino GND → Relay GND
-
Arduino 5V → Relay VCC
-
Relay COM → Live AC Line
-
Relay NO → Load (Lamp)
-
Load Neutral → AC Neutral Line
⚠️ Caution: When dealing with AC mains, always follow proper safety practices or consult a qualified technician.
Relay Control Code (Arduino Example)
int relayPin = 7;
void setup() {
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH); // Turn ON relay
delay(2000);
digitalWrite(relayPin, LOW); // Turn OFF relay
delay(2000);
}
This simple sketch toggles the relay every 2 seconds.
Using a Relay with Sensors or IoT
You can combine relays with:
-
PIR Sensors to turn on lights automatically
-
Temperature Sensors to switch on fans or heaters
Wi-Fi Modules (like ESP8266) for wireless relay control (e.g., phone apps or voice assistants)
Key Ratings to Understand
Before choosing a relay, check:
Parameter |
Meaning |
Coil Voltage |
Voltage needed to trigger relay (e.g., 5V, 12V) |
Contact Voltage/Current Rating |
Max voltage/current the switch can handle (e.g., 250V AC @ 10A) |
Contact Configuration |
SPST, SPDT, DPDT, etc. |
Trigger Level |
Logic HIGH/LOW needed to activate relay (depends on module design) |
Common Problems & Solutions
Problem |
Solution |
Relay clicks but doesn't switch load |
Check AC wiring and contact rating |
Relay heats up |
Load might exceed current rating |
Load turns ON without signal |
Your relay may be active-low |
Relay flickers |
Use flyback diode or capacitor (for coil protection) |
Applications of Relays
-
Home automation systems
-
Smart agriculture irrigation
-
Industrial machinery control
-
Automotive systems (horns, lighting)
-
IoT-based appliance control
Security and alarm systems
Recommended Products from Tomson Electronics
🔌 5V Relay Module – Single Channel
Perfect for Arduino & Raspberry Pi automation.
👉 Buy Now
🔌 4-Channel Relay Module
Control up to 4 AC devices at once great for home automation!
👉 Buy Now
Conclusion
Relays are indispensable in bridging the gap between low-power electronics and high-voltage devices. Whether you're turning on a light, controlling a fan, or building a smart home, relays offer a simple, effective solution.
As always, safety is key when working with high voltage. Take all necessary precautions and don’t hesitate to contact us for help selecting the right relay for your project.