Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use relay: Examples, Pinouts, and Specs

Image of relayDesign with relay in Cirkit Designer

Introduction

A relay is an electromechanical switch that uses an electromagnetic coil to open or close a circuit. It allows a low-power signal to control a high-power circuit, making it an essential component in many electronic and electrical systems. Relays are widely used in applications such as home automation, industrial control systems, automotive electronics, and power distribution systems. They provide electrical isolation between the control circuit and the load, ensuring safety and reliability.

Explore Projects Built with relay

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of RF-Controlled Relay Switch with Indicator LEDs and Buzzer: A project utilizing relay in a practical application
RF-Controlled Relay Switch with Indicator LEDs and Buzzer

This circuit features an RF receiver that controls a 12V relay, which in turn switches between two circuits: one with a green LED and another with a red LED and a buzzer, both protected by resistors. A rocker switch is used to supply power from a 9V battery to the RF receiver and the relay's coil. The relay's normally closed (NC) contact is connected to the green LED, while the normally open (NO) contact is connected to the red LED and the buzzer, indicating that the relay's state determines which of the two circuits is active.

Open Project in Cirkit Designer

Technical Specifications

Below are the general technical specifications for a standard single-pole single-throw (SPST) relay. Specifications may vary depending on the specific relay model.

General Specifications

Pin Configuration and Descriptions

The pin configuration of a relay depends on its type. Below is the pinout for a common 5V SPDT relay:

Pin Name Description
Coil (+) Positive terminal of the electromagnetic coil.
Coil (-) Negative terminal of the electromagnetic coil.
Common (COM) The common terminal connected to the moving part of the switch.
Normally Open (NO) The terminal that is disconnected from COM when the relay is inactive. It connects to COM when the relay is activated.
Normally Closed (NC) The terminal that is connected to COM when the relay is inactive. It disconnects from COM when the relay is activated.

Usage Instructions

How to Use a Relay in a Circuit

  1. Power the Coil: Connect the relay's coil terminals to a power source that matches the relay's rated coil voltage (e.g., 5V DC). Use a transistor or MOSFET to control the coil if the control signal is from a microcontroller.
  2. Control the Load: Connect the load circuit to the relay's COM and NO or NC terminals, depending on whether you want the load to be normally off or normally on.
  3. Add a Flyback Diode: Place a flyback diode (e.g., 1N4007) across the coil terminals to protect the control circuit from voltage spikes caused by the collapsing magnetic field when the relay is turned off.
  4. Use a Base Resistor: If using a transistor to drive the relay, include a base resistor to limit the current into the transistor's base.

Example Circuit with Arduino UNO

Below is an example of how to control a 5V relay using an Arduino UNO:

// Relay control example with Arduino UNO
// Connect the relay module's IN pin to Arduino pin 7
// Connect the relay module's VCC and GND to Arduino 5V and GND

#define RELAY_PIN 7  // Define the pin connected to the relay module

void setup() {
  pinMode(RELAY_PIN, OUTPUT);  // Set the relay pin as an output
  digitalWrite(RELAY_PIN, LOW);  // Ensure the relay is off at startup
}

void loop() {
  digitalWrite(RELAY_PIN, HIGH);  // Turn the relay on
  delay(1000);  // Keep the relay on for 1 second
  digitalWrite(RELAY_PIN, LOW);  // Turn the relay off
  delay(1000);  // Keep the relay off for 1 second
}

Important Considerations

Troubleshooting and FAQs

Common Issues

  1. Relay Not Activating:

    • Check if the coil voltage matches the relay's rated voltage.
    • Verify the control signal is reaching the relay's input.
    • Ensure the transistor or MOSFET driving the relay is functioning correctly.
  2. Relay Stuck in One State:

    • Inspect the relay for mechanical damage or wear.
    • Ensure the load current does not exceed the relay's contact rating.
  3. Voltage Spikes Damaging the Circuit:

    • Confirm a flyback diode is installed across the coil terminals.
    • For inductive loads, use additional protection like snubber circuits.
  4. Relay Clicking but Load Not Switching:

    • Verify the load is properly connected to the COM and NO/NC terminals.
    • Check for loose or broken connections in the load circuit.

FAQs

Q: Can I use a relay to control an AC load with a DC control signal?
A: Yes, relays are designed to provide electrical isolation, allowing a DC control signal to switch an AC load safely.

Q: Why is a flyback diode necessary?
A: A flyback diode protects the control circuit from high-voltage spikes generated when the relay coil is de-energized.

Q: Can I use a relay without a transistor or MOSFET?
A: If the control signal provides sufficient current and voltage to drive the relay coil directly, you can omit the transistor. However, most microcontrollers cannot supply enough current, so a transistor or MOSFET is typically required.

Q: How do I choose the right relay for my application?
A: Consider the coil voltage, contact rating, switching speed, and whether you need SPST, SPDT, or another configuration. Ensure the relay meets the electrical and mechanical requirements of your project.