Relay Module (Active Low & Active High)

A Relay is an electrically operated Single Pole Double Throw (SPDT) switch.

Actuators7 blocksMicroPythonC++
Relay Module

At a glance

Pins and properties exactly as the circuit editor and simulator define this part. The text below explains how to use them.

Pinout

Pinout of the Relay Module, drawn as in the circuit editor. Select a label to see that pin in the table below.

Pins

Pins of this part
PinLabelType
ININSignal in
GNDGNDGround
VCCVCCPower in
NCNCBidirectional
COMCOMBidirectional
NONOBidirectional

Properties

What you can change in the Property Inspector.

Properties of this part
PropertyRange or choicesDefault
Trigger PolarityActive LOW (standard module), Active HIGHActive LOW (standard module)

A Relay is an electrically operated Single Pole Double Throw (SPDT) switch. It uses a low-power electromagnet coil to mechanically open or close high-power AC or DC load contacts, providing complete electrical isolation between control electronics and high-voltage loads.


1. Hardware Specifications & Pinout

  • Coil Voltage: 5V DC (rated). Applying more than 6V (120% of rated) damages the module — the simulator flags this as an OVERVOLTAGE fault.
  • Switching Capacity: 10A @ 250VAC, 10A @ 125VAC, 10A @ 30VDC, 10A @ 28VDC (per the SRD-05VDC-SL-C markings silkscreened on the module).
  • Isolation: Built-in optocoupler-style drive stage between the control side and the coil.
  • Pin Configuration:
    • Input Control Side:
      • VCC: 5V Power.
      • GND: Common Ground.
      • IN: Digital control signal pin.
    • High-Voltage Screw Terminals:
      • COM (Common): Connected to main power source.
      • NO (Normally Open): Disconnected from COM when coil is OFF; connects to COM when coil is ON.
      • NC (Normally Closed): Connected to COM when coil is OFF; disconnects from COM when coil is ON.

2. How it Works (Optocoupler & Trigger Direction)

  • Active-LOW Polarity (Standard Relay Modules) — the default:
    • Control pin LOW (0V0\text{V}) →\rightarrow coil energizes →\rightarrow NO contact CLOSES (Relay ON).
    • Control pin HIGH (5V5\text{V}) →\rightarrow coil de-energizes →\rightarrow NO contact OPENS (Relay OFF).
  • Active-HIGH Polarity: Control pin HIGH energizes the coil; LOW turns it off — the reverse of the default.
  • This matches real hardware: most off-the-shelf 1/2/4-channel 5V relay modules are Active-LOW (their onboard driver stage pulls the coil's other end toward ground when the control pin is LOW), though Active-HIGH modules exist too.

3. Component Properties (Property Inspector)

  • Trigger Polarity (polarity): Which pin level energizes the coil — switches the simulated drive circuit's trigger direction to match.
    • Default: LOW (Active LOW — matches most real modules, and the Blockly blocks' own default)
    • Options: LOW (Active LOW), HIGH (Active HIGH)

[!NOTE] Keep this Property Inspector setting consistent with whatever Polarity you pick on each Blockly block below (Section 4) — they're two independent settings (one drives the simulated circuit, the other drives the generated code), and they need to agree for the simulated behavior to match what your generated code will actually do on real hardware.


4. Supported Blockly Blocks

Drawing the blocks…

5. Simulator Behavior

  • Status Indicator LEDs: A red PWR LED lights whenever VCC is present (above 3V); a green SIG LED lights and glows whenever the control pin is driven to whichever level energizes the coil under the current Trigger Polarity setting (LOW by default) — matching the real optocoupler-driver indicator LEDs most relay modules have.
  • On-Canvas Status Text: A text label above the module reads IDLE (NC ↔ COM), ENERGIZED (NO ↔ COM), or NO POWER, reflecting the real simulated coil/contact state — there's no animated contact arm graphic and no audio click sound; the status is text-only.
  • Fault Detection: Applying more than 6V to VCC (120% of the rated 5V coil voltage) trips an OVERVOLTAGE fault.
Relay Module (Active Low & Active High) — OMS Parts