PCB Design Tutorial: Tips for Using Optocouplers in Your PCB Layout

Are you guilty of hitting the snooze button at least twice before you reluctantly wake up from your blissful sleep? My wife claims that I probably have the world record time for hitting the snooze button since I do it without even opening my eyes. But there are times when the third snooze alarm mysteriously doesn’t go off and it is a losing battle to get my day started on time.

In electronics, embedded systems often rely on optocouplers to receive input signals from external sensors or switches. In a way, they are like the microcontrollers’ alarm clocks. Ideally, all the signals are relayed accurately to the microcontroller. However, when the optocouplers are not properly implemented, the microcontroller can sometimes miss inputs signals or falsely detect signals when no inputs are triggered. In this PCB design tutorial, we will discuss how to set your optocoupler up for success in your PCB layout. But first, let’s remind ourselves how an optocoupler works.

PCB Design Tutorial: Basic Principles Of An Optocoupler

Optocouplers are electronic components that isolate input signals through an optical interface. The most basic form of optocoupler consists of an infrared LED and a photo-transistor within a single integrated circuit. The infrared LED is turned on when electrical current passes through and the intensity depends on the amplitude of the current. The phototransistor is activated by the LED light, which causes a short connection on between its collector and emitter.

The infrared LED and the phototransistor are often separated by glass or air. This gives an electrical isolation of <10kV across the optocoupler. As a result, optocouplers are an ideal choice for isolating embedded systems from electrical interference originating from the input signal’s environment.

Besides protecting the embedded system from electrical noise, optocouplers are also used to keep low voltage and high voltage systems apart. For example, photo-triac, which is a variation of optocouplers, can be used to control high AC voltages devices. For example, an AC motor. This eliminates the risk of circuitry faults that can cause damage to the microcontroller and its accompanying components.

An optocoupler can reduce the risk of high voltage damage.

PCB Design Tutorial: Common Mistakes With Optocouplers

The optocoupler is a simple passive component that most designers encounter. Getting an optocoupler to work is not rocket science; however, there are a couple of design mistakes that defeat the purpose of using one or that causes unstable input signals.

1. Failing To Separate Optocoupler Ground Connections.

In the basic optocoupler, the integrated circuit (IC) consists of two ground pins. One is connected to the infrared LED and the other connected to the photo-transistor. A common mistake is to connect both grounds together when routing the PCB. In my engineering experience, I’ve encountered this even in electronics controller used in machines.

The main reason for using an optocoupler is to safely separate two circuits. When the external ground is connected to the PCB, any ground noises from the circuitry can directly couple to sensitive onboard circuits. Instead, create a separate signal connection for the external ground pins and allocate dedicated connectors for the input ground wires.

2. Using The Wrong Value For The Current Limiting Resistor

Besides applying the proper voltage, the optocoupler’s infrared LED require adequate current to function properly. The value of the minimum forward current can be referred from the Current Transfer Ratio chart of the respective optocoupler. If the current limiting resistor performs at the optocoupler’s minimum value, the phototransistor may behave irregularly. For example, out of 10 valid inputs from the switches, only part of it will be detected.

On the other hand, the value of the limiting resistor should not be too low. This is to prevent the infrared LED from breaking down. Like regular LEDs, the infrared LED has a maximum forward current that should not be overshot. This makes choosing the right current limiting resistor a crucial step in ensuring a reliable optocoupler operation.

As the name implies, enough current need is needed to light up the infrared LED

3. Choosing The Wrong Optocoupler

As general as it may seem, not all optocouplers are built the same. For example, the opto-triac is used for controlling an AC load and opto-Darlington is ideal for situations where only a small amount of input current is generated. Another consideration is the Collector-Emitter breakdown voltage, which can vary for different models of optocouplers.

But if you’re just using optocouplers for normal input isolation, common models like PC817 will do the trick. You’ll also spend less time in creating footprints since the generic optocoupler components in the library of your PCB design software will do the trick.