Relay Basics and Pinout with Load Connections

Relays are electromechanical switches that can be controlled electronically. They are commonly used to switch high-current or high-voltage loads, protecting the microcontroller from direct contact with the load. This guide will explore the basics of relay operation, pinout, and load connections with Arduino.

Relay Types

There are various types of relays, including:

  • General-Purpose Relays: Suitable for a wide range of applications.
  • Power Relays: Designed to handle high currents and voltages.
  • Reed Relays: Use magnetic fields to control the switch.
  • Solid-State Relays (SSRs): Use semiconductor devices instead of mechanical contacts.

Relay Pinout

A typical relay has the following pins:

  • Coil Pin: Connected to the microcontroller to control the relay’s state.
  • Common Pin: Connected to the load when the relay is activated.
  • Normally Open (NO) Pin: Connected to the load when the relay is not activated.
  • Normally Closed (NC) Pin: Connected to the load when the relay is not activated.

Load Connections

The load (the device or circuit being controlled) is connected to the relay’s common pin and either the NO or NC pin. The choice of NO or NC depends on the desired behavior:

  • Normally Open (NO): The load is connected to the common pin when the relay is activated.
  • Normally Closed (NC): The load is connected to the common pin when the relay is not activated.

Arduino Interfacing

To control a relay with Arduino, you’ll typically need a transistor or MOSFET to amplify the microcontroller’s output signal. Here’s a basic example using a transistor:

C++

const int relayPin = 13;
const int transistorPin = 12;

void setup() {
  pinMode(transistorPin, OUTPUT);
  pinMode(relayPin, OUTPUT);
}

void loop() {
  digitalWrite(transistorPin, HIGH); // Activate the transistor
  digitalWrite(relayPin, HIGH);       // Activate the relay
  delay(1000);
  digitalWrite(relayPin, LOW);        // Deactivate the relay
  digitalWrite(transistorPin, LOW);    // Deactivate the transistor
  delay(1000);
}

In this example, the transistor is used to control the current flowing through the relay’s coil. When the transistor is activated, the relay is also activated, connecting the load to the common pin.

Additional Considerations

  • Relay Ratings: Ensure that the relay’s voltage and current ratings are suitable for the load you want to control.
  • Debouncing: If using a mechanical switch to control the relay, consider debouncing techniques to prevent multiple activations from being detected as a single activation.
  • Heat Sink: For high-power relays, a heat sink may be necessary to dissipate the heat generated by the coil.
  • Solid-State Relays: Solid-state relays offer faster switching times and longer lifespans compared to mechanical relays.

By understanding the basics of relays and following these guidelines, you can effectively control loads using Arduino and create various automation and control projects.

Interfacing DS18B20 with Arduino
Transistor and Button Interfacing with Relay

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?