Home · ← Blog posts

Robotics

What Is a Relay and How Does It Work? NO, NC, COM and Arduino Wiring

Probot Studio

What we'll do

  1. Look inside a relay and see why it clicks.
  2. Learn the difference between the NO, NC and COM terminals.
  3. Wire a relay to an Arduino Uno the right way and switch it from code.
  4. Try a self-latching circuit with START and STOP buttons.
  5. Check whether a relay is good with a multimeter.

Why it's useful: an Arduino pin can only supply a small current. A relay uses that small signal to switch a 12 V pump, lamp or LED strip, while keeping that circuit separate from the Arduino.

Inside a relay: a coil on an iron core, a hinged armature and a spring. When 5 V reaches the coil, the armature is pulled down, COM moves from NC to NO and a 12 V lamp turns on

What is a relay used for?

A relay is a switch you control with electricity: a small coil current opens or closes a contact in a separate circuit. The two circuits are not electrically connected; a magnet and a spring do the work in between.

Safety: every example here runs at 12 V or less. Relay modules often say "250VAC" on them, but wiring mains (120 V or 230 V) is a job for a licensed electrician, with a closed enclosure, a fuse and certified parts. Students and teams should never wire mains.

How does a relay work?

When current flows through the coil, the iron core becomes a magnet and pulls the armature toward it. When the current stops, the spring pulls the armature back.

  1. Coil off: the spring holds the armature up, so COM touches NC.
  2. Coil energized: the magnetic field pulls the armature down and COM moves to NO. That is the click you hear.
  3. Coil off again: the spring pulls the armature back and COM returns to NC.

According to the datasheet, this relay pulls in within 10 ms at most, and it is guaranteed to pull in at no more than 75% of its rated voltage (3.75 V for a 5 V coil).

What do NO, NC and COM mean?

Two panels: with the coil off, COM is connected to NC and NO is open; with the coil energized, COM is connected to NO and NC is open

Terminal Stands for Coil off Coil energized
COM Common Connected to NC Connected to NO
NO Normally open Open Connected to COM
NC Normally closed Connected to COM Open

Rule of thumb: if the load should turn on when the relay clicks, wire it between COM and NO. If it should turn off when the relay clicks, use COM and NC.

Relay symbol

Relay symbol: a rectangular coil with terminals A1 and A2, linked by a dashed line to a changeover contact; 11 COM, 12 NC, 14 NO

In a schematic the coil is a rectangle (A1, A2), and the contact is drawn in its coil-off position. The dashed line shows the mechanical link. Industrial relays often number the terminals 11 (COM), 12 (NC) and 14 (NO).

Try it yourself

Set the pin HIGH first, then move the lamp to NC. Next, pick "Transistor, no diode", set the pin LOW, and finally open the Self-latching circuit tab.

This is an interactive demo where you set the pin HIGH or LOW, watch the relay pull in, see when a lamp on NO or NC turns on, and try a self-latching circuit with START and STOP buttons. It needs JavaScript; if it did not load, the drawings above show the same states.

How do you connect a relay to an Arduino?

You don't connect a relay coil straight to an Arduino pin. A 5 V coil needs 71.4 mA, while the ATmega328P on an Arduino Uno has an absolute maximum of 40 mA per pin. There are two good ways:

Option What you need When
Relay module All on one board: relay, driver circuit, LED, usually an optocoupler Quick builds, classes, prototypes
Bare relay NPN transistor, base resistor, diode across the coil When you design your own board

Bare relay: transistor and diode

Arduino D7 goes through a 470 ohm resistor to the base of a PN2222A transistor; the collector goes to the relay coil, the other end of the coil to +5 V; a 1N4007 diode sits across the coil, reversed

The transistor carries the coil current; the pin only supplies about 9 mA of base current. The diode is not optional: when the coil turns off it produces a reverse voltage spike, and without the diode that spike can destroy the transistor. The math and the pin order are in the transistor post.

Relay module pins

Single-channel relay module: Arduino 5V goes to VCC, GND to GND, D7 to IN; on the board are the relay, an optocoupler, a transistor, a diode, an LED and the NO, COM, NC screw terminals

Arduino code: toggle the relay every 2 seconds

// Relay module: IN on D7, VCC to 5V, GND to GND.
// If your module switches on with HIGH, change ON to HIGH.
const int RELAY_PIN = 7;
const int ON = LOW;                           // many modules switch on with LOW
const int OFF = (ON == LOW) ? HIGH : LOW;

void setup() {
  digitalWrite(RELAY_PIN, OFF);  // write "off" first so the relay does not click at startup
  pinMode(RELAY_PIN, OUTPUT);
}

void loop() {
  digitalWrite(RELAY_PIN, ON);   // relay pulls in: COM moves to NO
  delay(2000);
  digitalWrite(RELAY_PIN, OFF);  // relay releases: COM goes back to NC
  delay(2000);
}

A relay is not for fast switching: the datasheet allows at most 30 operations per minute under load, and you cannot use PWM through it to set speed or brightness. For motor speed, see the drivers in the DC motor post.

What is a self-latching relay circuit?

Self-latching circuit: STOP is normally closed, START normally open, the K contact in parallel with START, the K coil and a lamp in parallel. START has been released and current flows through the K contact

A self-latching (or holding) circuit keeps a relay on after one press of START, through the relay's own NO contact.

  1. Press START: current flows through START to the coil, the relay pulls in and its K contact closes.
  2. Release START: current now comes through K, so the relay stays on.
  3. Press STOP: the line is broken, the coil drops out and K opens. It stays off after you release STOP.

After a power cut the machine does not restart on its own; someone has to press START again. That is why machines use this circuit so often. In the second tab of the demo, untick "Latching contact" to see the difference.

How do you test a relay?

With a multimeter, on a relay removed from the circuit:

  1. Coil resistance: ohms mode across A1 and A2. For the SRD-05VDC-SL-C expect 70 Ω ±10% (63 to 77 Ω). OL on the display means the coil is open.
  2. Contacts at rest: in continuity (beep) mode, COM to NC beeps, COM to NO does not.
  3. Contacts pulled in: put 5 V on the coil (for example the Arduino's 5V and GND pins). You should hear a click, and now COM to NO beeps while COM to NC does not.

What are SSRs and reed relays?

Type How it switches Pros Watch out for
Mechanical relay Coil, armature, contacts Cheap, no leakage when off, AC or DC loads Clicks, contacts wear
SSR (solid-state relay) Optocoupler plus a semiconductor (triac for AC, MOSFET or transistor for DC) No moving parts, silent, long life Gets warm, small leakage current when off, AC and DC types differ
Reed relay Two thin metal reeds in a glass tube, with a coil around it Very small and fast (about 0.5 ms to a few ms) Small currents only

Common mistakes

Symptom Cause Fix
Relay won't pull in, or pulls in unreliably Coil wired straight to the pin (needs 71 mA, pin limit 40 mA) Use a module or a transistor
Relay works backwards Module switches on with LOW Change ON in the code
Relay clicks once at startup pinMode comes first Write digitalWrite(OFF) first, then pinMode
Lamp is always on Load wired to NC Move it to COM and NO
Transistor died quickly No diode across the coil Add a 1N4007 across the coil, reversed
Relay clicks but the load does nothing No power in the load circuit The contact is only a switch; the load needs its own supply

Sources

Accessed: 17 October 2026