OHMYARD

DISCOVER  ·  EXPERIMENT  ·  BUILD

TRACK 7 · ESP32, PI & ARDUINO APPS29/30
NOV 27, 2026
14:20:00
2.5kV ISOLATION BARRIERMCU IN0V (LOW)PC817SRD-05VDC-SL-CNCNONCCOMNOCoil: ENERGIZED (COM→NO) · Load on NO: 🟢 POWERED ON
Drag or WASD to pan · Q / E to rotate · Scroll to zoom

Optocoupler Relay Module (NO / NC / COM) & Isolation Lab — Engineering Notes & Troubleshooting

✓ Reviewed by Jason Guo (OhmYard Lab)· IEC & Datasheet Verified· Updated Nov 27, 2026
QUICK ENGINEERING ANSWER (TL;DR)

Control high-power pumps, solenoid locks, or AC lamps safely from a tiny 3.3V/5V GPIO! An optocoupler uses invisible infrared light inside a sealed chip to bridge the command across a physical air gap — keeping your microcontroller 100% galvanically isolated from the high-power load.

Coil OFF: COM ── NC | Coil ON: COM ── NO (Galvanic Isolation > 2.5 kV)

Each 5V relay coil draws ~70–80 mA when energized — for 4-channel or 8-channel relay boards, power JD-VCC from a dedicated 5V supply!

SymbolComponentReal-World Engineering Tip
K1 · OK1PC817 Optocoupler + 5V Electromechanical RelayNeed silent, rapid PWM switching (>1 Hz)? Never use a mechanical relay (contacts wear out in ~100,000 clicks) — use a MOSFET (Lab 11) or Solid-State Relay (SSR)!

Real-World Bench Scenario: Smart Irrigation Pump on ESP32: Wire +12V battery → COM, NO → 12V water pump → GND. Even if the pump draws 5 Amps, the ESP32 only sends a tiny 2 mA optocoupler signal!

Bench Challenge: Contact Switch: Toggle GPIO LOW/HIGH and switch wiring between NO (Normally Open) and NC (Normally Closed) to watch the internal iron armature click!

Frequently Asked Questions

Why does my relay click ON briefly every time my ESP32 or Arduino boots?

For active-LOW relays, setting `pinMode(PIN, OUTPUT)` defaults the pin LOW before `digitalWrite(PIN, HIGH)` runs! Always call `digitalWrite(PIN, HIGH)` FIRST, then `pinMode(PIN, OUTPUT)` — and avoid ESP32 boot-glitch pins like GPIO5!

Continue Exploring Related 2.5D Labs
28. HC-SR04 Ultrasonic →30. 3.3V ⇄ 5V Shifter →1. Closed Loop & Faults →

OHMYARD · ALL 30 INTERACTIVE LABS & SIMULATORS

1. Closed Loop & Faults
/closed-loop
2. Ohm's Law & Thermal
/ohm-law
3. Series vs Parallel
/series-parallel
4. X-Ray Breadboard
/breadboard-simulator
5. LED Resistor & E24
/led-resistor-calculator
6. Voltage Divider & Load
/voltage-divider
7. Multimeter Trainer
/multimeter-simulator
8. RC & Oscilloscope
/rc-oscilloscope
9. 555 Timer Pulse Lab
/555-timer
10. Diode & Rectifier
/diode-rectifier
11. Transistor & Flyback
/transistor-switch
12. PWM Dimmer & Fan
/pwm-dimmer
13. Op-Amp Comparator
/opamp-comparator
14. H-Bridge & Shoot-Through
/h-bridge-motor
15. Buck vs LDO Power
/buck-converter
16. Digital Logic Gates
/logic-gates
17. Resistor Color Code
/resistor-color-code
18. ESP32 Pinout Guide
/esp32-pinout
19. Arduino Uno Pinout
/arduino-uno-pinout
20. Zener Voltage Clamp
/zener-diode-regulator
21. I2C Pull-Up Bus
/i2c-pullup-bus
22. Battery Life & Sleep
/battery-life-calculator
23. PCB Trace Width
/pcb-trace-width
24. Wheatstone Bridge
/wheatstone-bridge
25. Raspberry Pi GPIO
/raspberry-pi-pinout
26. WS2812B LED Strip
/ws2812b-led-strip
27. SG90 Servo PWM
/servo-pwm-control
28. HC-SR04 Ultrasonic
/ultrasonic-hcsr04
29. Opto Relay Module
/relay-optocoupler
30. 3.3V ⇄ 5V Shifter
/logic-level-shifter