Source: https://mokxi.com/parts/relay
Updated: 2026-09-27

Part

# Relay module

A logic level on one side, something that has nothing to do with logic on the other.

or see every part

- 6 pins
- 3 properties

Drawn live by the editor's own code, at the size you see it.

Reference

## Every one of its 6 pins

Pin

Role

What it does

GND

Input or output

Coil return.

IN

Input

Control input; a logic level against half the supply.

VCC

Input or output

Coil supply.

NO

Input or output

Normally open: where COM moves to when energized.

COM

Input or output

The arm.

NC

Input or output

Normally closed: where COM rests when not energized.

This part

## What it does

A relay module lets a microcontroller pin switch something that has nothing to do with it. A logic level on IN energizes a coil, the coil pulls a metal arm across, and the arm moves from the normally closed contact to the normally open one; COM is the arm. The board’s 5 volts and whatever the contacts switch share nothing at all. Mokxi’s relay is slow in the way a real one is: 10 milliseconds to pull in and 5 to drop out, with neither contact made while the arm is traveling, so a sketch that toggles it very fast gets nothing, here and on the bench. Below 4 volts on the coil supply it does not pull in whatever IN says. The trigger property is high or low, because most cheap blue relay boards switch when IN is pulled to ground and a sketch written for the other kind runs backwards.

How to use it

## How to use a relay module with an Arduino

VCC to 5 V, GND to GND and IN to a digital pin. On the other side, COM is the moving arm: wire it to the supply for the thing you are switching, and wire that thing to NO so it is off until the relay pulls in. Then digitalWrite() the IN pin.

Check which way your board triggers. Most cheap blue relay boards are active low and switch when IN goes to ground; set the part’s trigger property to match the one you have. Never switch a relay faster than it can move: it takes about 10 milliseconds to pull in.

Part pin

Board pin

IN

Pin 13

VCC

5 V

GND

GND

COM and NO

The supply and the load

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

Reference

## The 3 properties you can set

Property

Default

What it means

trigger

high (or low)

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

10

10 and 5 ms, the SRD-05VDC datasheet
numbers.

release_ms

5

10 and 5 ms, the SRD-05VDC datasheet
numbers.

How it is modeled

## What is true about the Relay module, here

### What is modeled

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.

### Not modeled

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.

From Relay module (SRD-05VDC style), in full.

Projects

## See the Relay module in a project

Shown here on: Arduino Uno R3

Learn

## Where it turns up in a lesson

### In a learn article

- Arduino 4x4 Keypad Code Lock with a Relay

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio, no real internet), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

STM32F411 Black Pill

The Black Pill on our own Cortex-M4 core. Pick a program and press Run.

BBC micro:bit V2

The nRF52833 board with its 5x5 LED matrix, buttons A and B and a speaker. Wire the rings to a breadboard.

See every part

## Wire up the Relay module

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building Open the editor
