This part has a page of its own, with a note on using it and a circuit to try: the part page.
Relay module (SRD-05VDC style)
The single-channel relay module every kit ships: a coil, a spring, and a metal arm with a contact on the end.
Energize the coil and the arm is pulled across with a click; let go and the spring takes it back. The point of the part in a classroom is that the two sides share nothing at all: a 5 V board pin switches something that has nothing to do with 5 V.
Pins
| Pin | What it does |
|---|---|
VCC |
Coil supply. |
GND |
Coil return. |
IN |
Control input; a logic level against half the supply. |
COM |
The arm. |
NO |
Normally open: where COM moves to when energized. |
NC |
Normally closed: where COM rests when not energized. |
Properties
trigger: high (the default here, matching a bare coil and transistor) or low
(the cheap blue boards are nearly all active-low, because their opto-coupler is
wired to the rail). pull_ms / release_ms: 10 and 5 ms, the SRD-05VDC datasheet
numbers.
What the model gets right
A relay is slow, and the timing is the part people get wrong: 10 ms to pull in and
5 ms to drop out, matching the datasheet. During that travel neither contact is
made (the arm is genuinely in the air, which is "break before make"), so a sketch
toggling a relay at a kilohertz does nothing at all here either, exactly as it does
nothing on the bench. Below 4 V across VCC/GND the coil cannot pull the arm over
at all, whatever IN says, which is the failure everyone meets running a relay off
a board's regulator with a motor on the same rail.
What it does not model
Coil current (about 70 mA, which matters for the transistor driving it), contact bounce on the way in, the arc across an inductive load, and the flyback diode, which is already on the module, and is why nothing here needs one added.
The coil is not a coil: VCC/GND are read only to decide whether the supply is above
4 V, so the control side draws nothing at all and there is no inductance, no pull-in
current, no hold current and no way to find out that a board's regulator cannot run one.
IN is a logic level against half the supply rather than the opto-coupler's LED.
pull_ms and release_ms are exact and identical on every operation, where a real
relay's travel time varies with coil voltage and temperature and gets longer as it
ages. The contacts are ideal metal with no rating, no resistance drift and no welding.
Common mistakes
Assuming trigger is active-high because the pin is called IN. The cheap blue
boards are nearly all active-low, and a tutorial written for the other kind will
leave the relay backwards until trigger is set to match.
See it in action
Keypad lock switches a relay from a correct code. Open it at /templates.
For a module that switches backwards, clicks when the board starts or does nothing on a 3.3 V board, see Arduino relay module: active LOW and startup clicks.