5V Relay
Signal Type:
n/a
Switches and isolates electrical devices
5V Relay
What it is

A relay is an electrically controlled switch.

When to use it

When you need to switch a larger amount of power than the Arduino can handle or want to control an existing device separate from the Arduino. Note that most relays are mechanical and cannot switch more than a few times a second. A relay can be substituted for a mechanical switch in most circumstances.

How it works

A standard relay is a magnetically-controlled switch. On one side is an electromagnetic coil. When it receives power, this coil moves the contacts of a switch on the other side of the relay.

Video from author Simon A. Eugster via Wikimedia Commons

The magnet switches the middle COM (common) pin between the NC (normally closed), and NO (normally open) pins. This can be seen in the video above where the middle pin touches the NC pin on the right by default but is pushed toward the NO pin when the control pins are turned on.

Relay schematic animation
Animation from author Cloullin via Wikimedia Commons
How to use it

The two control pins simply require a power source to activate the relay. This can be controlled with a digital pin.

The pins switched by the relay are typically COM, NC, and NO. These stand for common, normally closed, and normally open. Just like in the Lever Microswitch, these pins allow for two states of function: When the control pins do not receive power, the COM and NC pins are connected. When the control pins do receive power, the COM and NO pins are connected.

Getting started
Relay Schematic
For this example, the relay uses pin 13 and controls an LED
/*
 * This turns a relay connected to RELAY_PIN on and
 * off every 2 seconds.
 *
 * Created 2021-04-22 by Perry Naseck
 */

// Relay control pin connected to digital pin 13;
// this pin is also used by the onboard LED, so
// the LED should illuminate in time with the relay
const int RELAY_PIN = 13;

void setup() {
  // Set up the relay pin to be an output
  pinMode(RELAY_PIN, OUTPUT);
}

void loop() {
  // Turn on the relay
  digitalWrite(RELAY_PIN, HIGH);

  // Wait 1 second
  delay(1000);

  // Turn off the relay
  digitalWrite(RELAY_PIN, LOW);

  // Wait 1 second
  delay(1000);
}
What we stock
Part Location On floor Backstock
0500 relay, miscellaneous 5V Electrical Components: Relays 1 0
0502 Switches and isolates electrical devices Electrical Components: Relays 0 0
0504 relay, SPDT, 5VDC, 205 coil, 0.99" x 0.30" x 0.35", 5 male pins on 0.2" centers Electrical Components: Relays 6 0
0506 relay, SPDT, can switch 6A, 70 coil, 0.87" x 0.63" x 0.66", PC leads, UL listed, Hasco KLT1C6DC5 Electrical Components: Relays 0 0
0514 relay, SPDT, 5VDC switching, board mounted, Songle SRD-05VDC-SL-C Electrical Components: Relays 17 0
0522 relay, 5V, board mounted with screw terminals, 10A @ 250VAC, SRD-5VDC-SL-C Electrical Components: Relays 4 8
1086 relay, Grove connector, 250V @ 10A 0 0
1454 Model no.: BH9936 Voltage: 120 Vac/60Hz Current: 10A 0 0
2064 relays, solid state relays (8-channel) Special Parts Cabinet 2 0
8019 Powertail switch Special Parts Cabinet 9
Related parts