Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Relay: Examples, Pinouts, and Specs

Image of Relay
Cirkit Designer LogoDesign 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!
WeMos D1 R2 Controlled Relay Switching Circuit for AC Bulb and USB Charger
Image of Hand Gesture Light: A project utilizing Relay in a practical application
This circuit uses a WeMos D1 R2 microcontroller to control a 5V 2-relay module, which in turn controls the power to an AC bulb and a cellphone charger. The microcontroller also interfaces with a line tracking sensor, which likely provides input to control the relay states. The AC bulb and cellphone charger are powered by an AC wire connection, with the relay acting as a switch for the bulb.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Powered 8-Channel Relay Controller with Wi-Fi Connectivity
Image of Olimex ESP32-POE2 4Ch X 2 Switches: A project utilizing Relay in a practical application
This circuit features an ESP32 microcontroller connected to an 8-channel relay module. The ESP32 controls the relay channels via its GPIO pins, allowing for the switching of external devices or loads through the relays.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered IR Sensor Controlled Relay Module
Image of New: A project utilizing Relay in a practical application
This circuit uses an IR sensor to control a 1 Channel 5V Relay Module, which is powered by a 9V battery. The IR sensor detects an object and sends a signal to the relay module to switch its state, enabling or disabling the connected load.
Cirkit Designer LogoOpen Project in Cirkit Designer
Wi-Fi Controlled Smart Lighting System with NodeMCU and Relay Module
Image of HOME AUTOMATION USING GOOGLE ASSISTANT: A project utilizing Relay in a practical application
This circuit uses a NodeMCU V3 ESP8266 microcontroller to control a 4-channel relay module, which in turn controls four bulbs. The relays are powered by a 220V power source, and the microcontroller can switch each relay on or off to control the corresponding bulb.
Cirkit Designer LogoOpen Project in Cirkit Designer

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 Hand Gesture Light: A project utilizing Relay in a practical application
WeMos D1 R2 Controlled Relay Switching Circuit for AC Bulb and USB Charger
This circuit uses a WeMos D1 R2 microcontroller to control a 5V 2-relay module, which in turn controls the power to an AC bulb and a cellphone charger. The microcontroller also interfaces with a line tracking sensor, which likely provides input to control the relay states. The AC bulb and cellphone charger are powered by an AC wire connection, with the relay acting as a switch for the bulb.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Olimex ESP32-POE2 4Ch X 2 Switches: A project utilizing Relay in a practical application
ESP32-Powered 8-Channel Relay Controller with Wi-Fi Connectivity
This circuit features an ESP32 microcontroller connected to an 8-channel relay module. The ESP32 controls the relay channels via its GPIO pins, allowing for the switching of external devices or loads through the relays.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of New: A project utilizing Relay in a practical application
Battery-Powered IR Sensor Controlled Relay Module
This circuit uses an IR sensor to control a 1 Channel 5V Relay Module, which is powered by a 9V battery. The IR sensor detects an object and sends a signal to the relay module to switch its state, enabling or disabling the connected load.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of HOME AUTOMATION USING GOOGLE ASSISTANT: A project utilizing Relay in a practical application
Wi-Fi Controlled Smart Lighting System with NodeMCU and Relay Module
This circuit uses a NodeMCU V3 ESP8266 microcontroller to control a 4-channel relay module, which in turn controls four bulbs. The relays are powered by a 220V power source, and the microcontroller can switch each relay on or off to control the corresponding bulb.
Cirkit Designer LogoOpen 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

  • Coil Voltage: 5V, 12V, or 24V DC (common values)
  • Coil Current: Typically 30–100 mA
  • Contact Rating: 10A at 250V AC or 10A at 30V DC
  • Contact Type: SPST (Single Pole Single Throw) or SPDT (Single Pole Double Throw)
  • Switching Time: 5–15 ms
  • Dielectric Strength: 1000V AC (coil to contact)
  • Insulation Resistance: >100 MΩ at 500V DC
  • Mechanical Life: >10 million operations
  • Electrical Life: >100,000 operations (at rated load)

Pin Configuration and Descriptions

The pin configuration of a typical 5V SPDT relay is as follows:

Pin Name Description
Coil (+) Positive terminal of the electromagnetic coil. Connect to the control voltage.
Coil (-) Negative terminal of the electromagnetic coil. Connect to ground.
Common (COM) Common terminal for the relay switch.
Normally Open (NO) Terminal that remains disconnected from COM when the relay is inactive. It connects to COM when the relay is activated.
Normally Closed (NC) Terminal that remains connected to COM when the relay is inactive. It disconnects from COM when the relay is activated.

Usage Instructions

How to Use the Relay in a Circuit

  1. Power the Coil: Connect the relay's coil terminals to a low-power control circuit. For example, use a 5V DC power source for a 5V relay.
  2. Control the Load: Connect the high-power load to the relay's COM and NO or NC terminals, depending on the desired behavior:
    • Use the NO terminal if the load should be powered only when the relay is activated.
    • Use the NC terminal if the load should be powered when the relay is inactive.
  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 relay's inductive load.
  4. Drive the Relay: Use a transistor or MOSFET to drive the relay if the control circuit cannot supply enough current to the coil. Connect the transistor's base/gate to the control signal, and connect the relay coil to the transistor's collector/drain.

Example Circuit with Arduino UNO

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

// Define the relay pin
const int relayPin = 7; // Connect the relay module's IN pin to Arduino pin 7

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

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

Important Considerations and Best Practices

  • Always check the relay's voltage and current ratings to ensure compatibility with your circuit.
  • Use a flyback diode to protect the control circuit from voltage spikes.
  • Avoid exceeding the relay's contact rating to prevent damage or failure.
  • Ensure proper insulation and spacing between high-voltage and low-voltage sections of the circuit.
  • For high-power applications, consider using relays with higher contact ratings or solid-state relays.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Relay Not Activating:

    • Cause: Insufficient voltage or current to the coil.
    • Solution: Verify the control voltage and current. Use a transistor or MOSFET driver if needed.
  2. Relay Stuck in One State:

    • Cause: Damaged or worn-out contacts.
    • Solution: Replace the relay if the contacts are damaged.
  3. Voltage Spikes Damaging the Circuit:

    • Cause: Lack of a flyback diode across the coil.
    • Solution: Add a flyback diode (e.g., 1N4007) across the coil terminals.
  4. Relay Clicking Noise but No Load Switching:

    • Cause: Incorrect wiring of the load or damaged contacts.
    • Solution: Check the wiring and ensure the load is connected to the correct terminals (COM and NO/NC).

FAQs

  • Q: Can I use a relay to switch AC loads?

    • A: Yes, relays can switch both AC and DC loads, provided the load does not exceed the relay's contact rating.
  • Q: What is the purpose of the flyback diode?

    • A: The flyback diode protects the control circuit from voltage spikes generated when the relay coil is de-energized.
  • Q: Can I directly connect a relay to an Arduino pin?

    • A: It depends on the relay's coil current. If the current exceeds the Arduino pin's limit (40 mA), use a transistor or MOSFET to drive the relay.
  • Q: How do I know if my relay is SPST or SPDT?

    • A: Check the relay's datasheet or look for the number of terminals. SPST relays have 4 pins, while SPDT relays typically have 5 pins.