What is an optocoupler? Isolating signals with light and no electrical connection
Atlasbot · 20/8/2026 · 9 min read
Relay (previous article) isolates 2 circuits with a mechanical contact — sturdy but slow and has a limited life span based on the number of on/off times. The Optocoupler achieves similar electrical isolation in a completely different way: using light to transmit signals over a distance without electrical contact — no mechanical part, much faster switching.
What is an optocoupler and how it works?
Inside an optocoupler (also called opto-isolator) there are two parts placed close together but completely disconnected:
- Input side — an infrared LED, receiving control signals from circuit 1.
- Output side — a phototransistor (light-sensitive transistor), located in completely separate circuit 2.
When current flows through the LED (circuit 1 sends a signal), the LED glows, this light shines on the phototransistor on the other side, causing the phototransistor to conduct current in circuit 2 — the signal is "transmitted" by light, without any electrical connection between the 2 circuits.
In short: Optocoupler = LED + phototransistor in the same shell, isolating the 2 circuits by light — the signal "jumps" through thanks to light, the voltages on both sides are completely independent.
Why is it necessary to isolate signals (not just power isolation like relays)
Unlike relays commonly used to turn on/off power loads, optocouplers are mainly used to isolate control signals between 2 circuits with different voltage levels or ground (GND) — some common situations:
- Protect MCU from power circuit — MCU controls a high-power motor driver circuit; If the power circuit has a problem (short circuit, overvoltage), the optocoupler prevents the problem from spreading back to destroy the MCU.
- Connecting 2 circuits with different ground (GND) — when 2 systems use separate power sources, directly connecting the GND of both can create a ground loop causing interference or damage — optocoupler allows signal transmission without needing to connect GND together.
- Read signals from high voltage circuits safely — For example, read the on/off status of a 220V AC circuit without exposing the MCU directly to that voltage.
Optocoupler vs. Relay
| Criterion | Relay | Optocoupler |
|---|---|---|
| Isolation mechanism | Mechanical (contact) | Optics (light) |
| Switching speed | Slow (milliseconds) | Fast (micro-seconds) |
| Longevity | Limited to the number of closing/closing times | No mechanical part, much more durable |
| The load current flows directly through the contact | Can be large (several A, also AC) | Only small signal current, no direct power load switching |
Important point: optocoupler cannot replace relay when it is necessary to directly turn on/off high-power loads — it only isolates the signal, usually still requiring additional transistors/MOSFETs or relays at the back stage to actually control the load.
Technical details
Formulas
The signal transfer efficiency of an optocoupler is measured by CTR (Current Transfer Ratio) — the ratio between the output current at the phototransistor and the input current at the LED, which determines the actual output current obtained from a given LED current:
CTR (%) = (Output Ic / Input If) × 100%
For example: PC817 has CTR = 200% (common bin), current through LED (If) = 10mA
Output IC ≈ 200% × 10mA = 20mA
The higher the CTR, the larger the output current compared to the LED output — important when designing the downstream circuit (e.g. calculating the pull-up resistor at the Collector) to ensure the output signal is strong enough.
Parameters
| Specifications (PC817, popular model) | Typical value |
|---|---|
| CTR | 50 – 600% (depending on classification during production) |
| isolation voltage | ~5.000V |
| Response speed | A few – a few tens of µs |
Practical applications
In industrial robots or large AMRs, optocouplers are often used to isolate the control signal from the MCU to a high-power motor driver running at a completely different voltage level (eg: 24V/48V driver) — if the driver experiences a short circuit or noise pulse from the motor, the optocoupler prevents the problem from spreading back and destroying the main control board, which is often much more expensive and difficult to replace than a motor driver.
Practical example: isolating control signals using PC817
Control circuit (MCU, 5V):
GPIO ──[ LED current limiting resistor, eg 220Ω ]── Anode pin (LED in PC817)
Cathode pin (LED) ── GND (circuit 1)
Power circuit (completely separate):
VCC2 ──[ Pull-up resistor ]── Collector (phototransistor)
Emitter (phototransistor) ── GND (circuit 2, independent of GND circuit 1)
→ output signal is taken at Collector pin
digitalWrite(OPTO_INPUT_PIN, HIGH); // LED lights up → phototransistor conducts → signal passes through, completely isolated
PC817 is a popular, low-cost optocoupler model, often found in signal isolation circuits that control motor drivers or high voltage sensors.
Common mistakes
- The optocoupler can completely replace the relay for large power loads — the optocoupler only transmits a small current signal, does not directly turn on/off the power load — still needs a relay/MOSFET in the back stage for the real load.
- Forget the current-limiting resistor for the internal LED — The LED inside the optocoupler is also a regular light-emitting diode, requiring a current-limiting resistor like every other LED (see Diode article), lacking a resistor can easily burn out the internal LED.
- Connecting 2 circuits to GND even when using an optocoupler — accidentally connecting GND to the same will completely eliminate the purpose of isolation, making the optocoupler meaningless in design.
- Expect too high switching speed — although much faster than relay, optocoupler is still slower than pure electronic MOSFET (due to light response delay of LED/phototransistor) — for applications that need extremely fast switching (eg: very high frequency PWM), need to check the response speed parameters in the datasheet.
Conclusion
Optocouplers solve a different problem than relays - isolating control signals between 2 circuits with different voltage/ground levels, faster and more durable than relays but cannot replace the role of turning on/off high-power loads. The next article in the column turns to power components — starting with the LDO, the simplest linear voltage regulator.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.