Optocoupler / Opto-isolator
Optoelectronic
An LED and a phototransistor sealed in one package, coupling signals by light. Provides galvanic isolation between two circuits so high-voltage and low-voltage sides never share a current path.
Types & variants
Key specs
Isolation voltage
VrmsTypical 5000Vrms between input and output. The safety rating that matters for mains work.
Current transfer ratio (CTR)
%Output collector current ÷ input LED current. Ranges 20%–600%. Decreases with age and temperature.
LED forward voltage
V~1.2V typical (IR LED). Drive with 5–20mA.
Bandwidth
kHzStandard transistor optos: ~100kHz. High-speed 6N137: ~10MHz.
Output voltage
VMax collector-emitter voltage. 30V common (PC817), up to 80V (4N35).
Markings
Part number printed on top (e.g. PC817, 4N35, MOC3021). Date code + lot below. 4-pin and 6-pin DIP most common; SMD versions exist.
Standard values
Drive LED with 5–10mA (220–470Ω from 5V). Pull-up resistor on output: 1k–10k depending on speed vs power.
How to choose
1) Match output type to load: transistor for logic, phototriac for AC mains, high-speed for digital comms. 2) Check isolation voltage ≥ 2× worst-case voltage. 3) Verify CTR is high enough for your output current. 4) For mains AC, use zero-crossing versions (MOC3041) to reduce EMI. 5) Check package fits your board (DIP-4, DIP-6, SMD).
Pinout & package
DIP-4 (e.g. PC817) — LED in, transistor out
Check first: Input LED on pins 1–2, output transistor on pins 3–4, isolated across the barrier.
DIP-4 (PC817): pins 1=LED anode, 2=LED cathode, 3=emitter, 4=collector. DIP-6 (4N35): pin 3 = base (often unused). Phototriac types (MOC3021): pin 4 and 6 = output triac.
Example circuits
- Isolated Arduino control of a mains AC load via MOC3021 + triac
- SPI/I²C isolation between MCU and high-voltage sensor
- Switch-mode power supply feedback loop (error signal across isolation barrier)
- Digital input isolation for industrial PLC inputs (24V → 3.3V)
- Ground-loop breaker in audio equipment
Common failures
LED degrades over time — CTR drops below usable threshold (especially with sustained high LED current). Internal dielectric breakdown after voltage spikes. Symptoms: output stops switching even though input LED still lights.
How to test
With power off, check LED side with multimeter diode test — should read ~1.2V forward drop. Powered: drive LED via 220Ω from 5V (10mA). Pull collector up to VCC via 1k, emitter to GND. Collector should swing from HIGH (LED off) to LOW (LED on).
Substitutes
Same pinout/family often interchangeable (PC817 ↔ 4N35 for logic use). For higher speed, swap to 6N137. For AC, use any MOC30xx with matching zero-cross needs.