This part has a page of its own, with a note on using it and a circuit to try: the part page.
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
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 draws its current: while IN is telling it to pull, 70 ohms (the
SRD-05VDC's coil, 71 mA at 5 V) sits across VCC and GND, so a meter in the
supply lead reads it and a battery or regulator feeding it sags by it. It is a
resistance and not a coil: no inductance, and the pull-in threshold is a flat 4 V
with none of the real coil's hysteresis (once in, a real one holds down to about
half a volt). The module's transistor and LEDs, a few milliamps, are left out.
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.
The PIR motion light switches a 12 V lamp through one after dark, and the water level controller runs a pump through one between two float switches.
The Bidirectional visitor counter keeps a room light on while anyone is inside, and the Fire fighting robot switches its pump with one.
The ESP32 async web server switches a 12 V lamp through one of these from a button on a web page.