SensorCatalog
IEC 60747-5IEC 61131-22.5–5 kVrms Galvanic Barrier

フォトカプラ絶縁&リレーフライバックダイオード保護回路

Optical Isolation + Inductive Clamp · Field 5–30 V → Isolated 3.3/5 V

フォトカプラは24 Vセンサと3.3–5 Vマイコンを2.5–5 kVrms絶縁し(CTR余裕2倍以上推奨)、DCリレーコイルのフライバックダイオードが遮断サージをVcc + 0.7 Vに抑えます。

GALVANIC ISOLATION OK — I_F = 8.43 mA · Margin 4.1× · V_MCU = 0.20 V

Field 24 V ground and MCU 5 V ground stay 100% isolated (≥ 2.5 kVrms). Relay coil holds energized at 25 mA.

正常電流フロー警告・クランプ故障・過電流速度 ∝ 電流 |I|
FIELD SIDE (24 V Industrial · GND A)2.5–5 kVrms IsolationISOLATED LOGIC SIDE (5 V MCU · GND B)PC817 / TLP281 Optocoupler+24.0 V2700 ΩI_F = 8.4 mAGND A+5 V (Iso)4.7 kΩMCU GPIO0.20 VRelay Coil + Anti-Parallel Flyback Diode D1Coil 25 mAD1 (1N4007)Turn-OFF Inductive Kickback Monitor+24 V⚠ NO DIODE! +180 V SPIKE BREAKS TRANSISTOR!

Opto LED Current (IF)

8.43 mA

CTR Saturation Margin

4.13×

Isolated MCU Pin (Vout)

0.20 V

Peak Turn-OFF Coil Voltage

+24.0 V

Optical Isolation BarrierPHOTONS ACTIVE (2.5 kV Iso)
MCU Isolated Logic InputLOW (Active Detected)
Flyback Diode D1 (1N4007)REVERSE-BIASED (Standby)
Series Resistor Power192 mW
V

24 V industrial sensor feeding an isolated 3.3 V / 5 V MCU or relay.

Ω

Target I_F = 5–12 mA for long LED life (e.g. 2.2–3.3 kΩ at 24 V).

%

PC817/TLP281 min CTR is 50% (derate 50% for aging & temperature!).

Ω

Connects opto collector to isolated 5 V / 3.3 V MCU rail (4.7–10 kΩ).

mA

24 V slim DIN relay typically draws 15–30 mA (inductance ~0.5–1.5 H).

プリセット:

リアルタイム計算式

1. Optocoupler LED forward current

I_F = (V_in − V_F) / R_in = (24.0 − 1.25) / 2700

⇒ 8.43 mA (P_Rin = 192 mW)

2. Guaranteed collector current vs load requirement

Margin = (I_F · CTR_min) / ((V_MCU − 0.2) / R_col) = (8.43 × 0.50) / 1.02 mA

⇒ 4.13× (Target ≥ 2.0×)

3. Inductive turn-off peak voltage

V_peak = V_in + V_D(0.7 V) = 24.0 + 0.7 V

⇒ +24.0 V

動的部品選定・BOM

記号部品推奨定格判定
U1Phototransistor OptocouplerPC817 / TLP281 (CTR ≥ 50%, 3.75–5 kVrms iso)OK
RinLED Current-Limiting Resistor2700 Ω, ≥ 0.25 WOK
D1Relay Coil Flyback Diode1N4007 / 1N4148 cathode to +Vcc, anode to switchOK

1. 回路概要と動作原理

Industrial field sensors live in electrically noisy 24 V environments prone to ground offsets, motor-drive surges, and miswiring. Optocouplers (IEC 60747-5) and interposing relays provide 2.5–5 kVrms galvanic isolation between field sensors and sensitive 3.3 V / 5 V microcontrollers or PLC logic.

Two classic mistakes destroy more opto/relay interfaces than anything else: failing to derate optocoupler CTR (Current Transfer Ratio) for 10-year aging, and omitting the anti-parallel flyback (freewheeling) diode across a DC relay coil.

Optocoupler CTR & Saturation Margin: Input current I_F = (Vin − V_F) / Rin drives an infrared LED (V_F ≈ 1.25 V). The isolated phototransistor can sink up to I_C(max) = I_F × CTR_min. Always guarantee I_C(max) ≥ 2 × I_C(required) so the transistor stays deeply saturated even after 10 years of LED wear and 85 °C ambient heat.

Inductive Flyback Physics: A relay coil stores magnetic energy E = ½ L I². When the sensor switch opens abruptly, the coil reverses voltage polarity (V = L·di/dt) trying to force current to continue — spiking to +150…300 V! An anti-parallel flyback diode (cathode to +Vcc) gives coil current a safe closed loop, clamping the spike cleanly to Vcc + 0.7 V.

フォトカプラ絶縁&リレーフライバックダイオード保護回路 — SensorCatalog
フォトカプラ&還流保護PNG 1200×630

2. Step-by-step: Designing a bulletproof optocoupler & relay isolated input

  1. 1Size input resistor Rin for 5–12 mA LED current (and check wattage)

    Choose Rin = (Vin − 1.25 V) / I_F. For 24 V inputs, 2.2 kΩ to 3.3 kΩ gives 7–10 mA and ~200 mW dissipation (use a 0.5 W resistor and add an anti-parallel 1N4148 across the LED for reverse-polarity protection).

  2. 2Verify ≥ 2× CTR saturation margin at worst-case minimum CTR

    Never design with typical CTR! Multiply I_F by the datasheet minimum CTR (e.g. 50% for PC817), divide by 2 for 10-year aging, and pick Rcol (typically 4.7–10 kΩ on 3.3–5 V) so required collector current is less than half of that limit.

  3. 3Install flyback diode D1 directly across every DC relay coil

    Connect a 1N4007 (or fast UF4007) directly across the coil terminals with the silver cathode band toward +Vcc. Double-check polarity before power-up so D1 does not short the supply!

  4. 4Keep PCB ground planes strictly split across the isolation moat

    Do not route copper pours or traces across the gap under the optocoupler or relay. Maintain ≥ 4–6 mm creepage/clearance between Field 24 V GND and MCU GND.

3. 現場トラブルシューティングとテスタ確認

症状原因テスタ測定ポイント対策
MCU stops detecting triggers after 1–2 years in warm enclosuresOptocoupler CTR degraded below 1× saturation margin due to too-small Rcol or high RinMeasure Vce across opto output while input is ON: >0.8 V confirms under-saturationIncrease Rcol to 10 kΩ (or replace with high-CTR opto like TLP281-GB / digital isolator)
MCU resets or sensor output shorts dead after driving a relayMissing or open flyback diode across the DC relay coilCapture turn-off transient with scope; spikes >50 V prove missing snubber/diodeSolder 1N4007 anti-parallel right across the relay coil pins

4. よくある技術質問(FAQ)

Does an optocoupler invert the sensor logic signal?

In the standard common-emitter pull-up configuration (collector pulled up to Vcc, emitter to GND), YES: Field HIGH turns the phototransistor ON and pulls MCU pin LOW. Invert in firmware or use common-collector (emitter follower) if non-inverting is needed.

Why does a flyback diode slightly slow down relay release time?

Because clamping the coil to 0.7 V lets current decay gently over ~5–15 ms. If you need faster drop-out (e.g. high-speed safety relays), put a 12–24 V Zener diode in series with the flyback diode to dissipate energy faster at a safe ~36 V clamp.

What is the ideal LED current for a PC817 / TLP281 optocoupler?

5 to 10 mA is the sweet spot: high enough for good CTR and noise immunity, low enough to minimize LED aging and keep Rin power under 0.25 W on 24 V rails.

Can an optocoupler handle high-speed 100 kHz encoder pulses?

No! Phototransistor optocouplers like PC817 have 4–18 µs switching times and roll off above ~5–10 kHz. Use a high-speed logic optocoupler (6N137 / H11L1) or CMOS digital isolator (ISO7721 / ADuM1201) for fast pulses.

Should I add a reverse-protection diode across the optocoupler LED?

Yes! Most IR LEDs inside optocouplers have a reverse breakdown voltage of only 5–6 V. If someone swaps +24 V and 0 V during field wiring, an anti-parallel 1N4148 saves the optocoupler instantly.

What happens if I connect the flyback diode backwards?

It becomes a dead short directly across the power supply when the switch closes — instantly blowing the diode, fuse, or sensor output transistor. Always double-check that the cathode stripe connects to +Vcc!

5. 関連計算ツール・比較ガイド・その他の回路

↑ ↓ 選択 · Enter 開く · Esc 閉じる