Overview
An optocoupler transmits a digital signal across a galvanic isolation barrier using light. The input side drives an LED; the output side contains a phototransistor or photodiode that responds to the emitted light. No electrical connection exists between the two sides, so potentials can differ by tens or hundreds of volts without coupling noise, spurious ground currents, or damage across the barrier.
In a Formula Student EV, optocouplers are commonly used to transmit a digital signal across the GLV↔TS barrier. Optocouplers are also used for robust input/output interfaces since they tolerate separate ground references.
Common device families suit different speed requirements:
- PC817 / 4N25 family: General-purpose phototransistor output. Transition times of a few microseconds. Suited to low-speed status/fault signals.
- 6N137 / HCPL-2611 family: High-speed logic output with an internal detector IC. Propagation delay under 100 ns. Suited to PWM, encoder, or UART signals.
Circuit description
The input side is an LED driven through a current-limiting resistor R1. The output side is a phototransistor (for general-purpose devices) or a logic gate output (for high-speed devices) referenced to the output-side supply and ground.
For a phototransistor output (e.g. 4N25):
- The collector is pulled up to the output supply through R2.
- The emitter is connected to the output-side GND.
- When the LED conducts, the phototransistor saturates, pulling the output low (active-low output).
- When the LED is off, the phototransistor is off and R2 holds the output high.
For a logic-output device (e.g. 6N137):
- The output pin is an open-collector or push-pull logic gate.
- A pull-up resistor R2 to the output supply is required for open-collector variants.
- Propagation delay and output logic polarity vary by device; check the datasheet.
Design notes
- LED drive current: Most optocouplers specify a minimum LED forward current for guaranteed output switching, typically 1 to 10 mA. Select R1 to set this current with margin:
Where is the LED forward voltage (typically 1.0 to 1.4 V). Do not overdrive the LED; the maximum rated is an absolute maximum.
-
Current transfer ratio (CTR): The ratio of output collector current to input LED current, expressed as a percentage. CTR varies widely between devices and grades (minimum 20% for the 4N25; minimum 80% for the PC817 grade A, up to 300% for grade C) and degrades with temperature and age. Design for the minimum CTR; do not rely on a typical value.
-
Pull-up resistor R2: Sets the output high level and limits collector current. With a CTR of 100% and , the collector can sink up to 5 mA. Size R2 so the voltage drop across it during output-low is within the downstream logic’s limit. Read Blocks
for more design considerations. -
Isolation voltage: The datasheet specifies a rated isolation voltage (e.g. 5000 V for the PC817). This applies between input and output pins across the package. Maintain adequate PCB clearance and creepage between input and output traces to avoid compromising the isolation in practice.
-
Speed: Phototransistor-output devices are slow. The PC817 has a typical rise time of 4 µs and fall time of 3 µs at . For any signal above a few kilohertz, switch to a high-speed logic-output device.
Gotchas
- The input and output grounds must never be connected if the purpose of the optocoupler is isolation. Bridging the grounds with a trace, resistor or a bypass capacitor defeats the barrier entirely. It can be challenging or even impossible to meet GLV↔TS separation requirements EV.6.5.7 with optocouplers alone, when operating >300VDC, since the physical optocoupler package may have a separation distance smaller than required by the rules. This particularly applies to the Over Surface or Thru Air (cut in board) spacings at higher voltages. For example a 4N25 has a lead separation of 7.62mm - smaller than the required 12.7 or 9.5mm Over Surface or Thru Air requirements. Under Conformal Coating remains the only strictly-compliant option (4mm acceptable). One might argue that the component is rated to the separation requirements and so laying it out according to manufacturer’s recommendations ought to be sufficient… Your mileage may vary.
- CTR degrades over the lifetime of the device and at high temperatures. A design that just barely switches at room temperature with a new device may fail in service. Design with at least 2x margin on CTR.
- Logic-output optocouplers such as the 6N137 require a supply on the output side to power the internal IC. Forgetting to connect this supply (often ) is a common commissioning error; the output will appear stuck or missing.
- The output polarity of phototransistor devices is inverted relative to the input: LED on produces a low output. Account for this in firmware or add an inverter stage if active-high output is needed.