Let There Be Light! How an Optocoupler Works.
Need to protect sensitive, low-voltage components and isolate circuits on your PCB? An Optocoupler can do the job. Let there be light! This device allows you to transmit an electrical signal between two isolated circuits with two parts: an LED that emits infrared light and a photosensitive device which detects light from the LED. Both of these parts are contained within a traditional black box with a pair of pins for connectivity. At a glance, it’s easy to mix up an Optocoupler with an integrated circuit (IC).
How It Works
A current is first applied to the Optocoupler, which makes the infrared LED emit a light that’s proportional to the current. When the light hits the photosensitive device, it switches on and starts to conduct a current as any ordinary transistor might.
The photosensitive device is typically left unconnected by default to provide the highest sensitivity to infrared light. It can also be connected to ground with an external resistor for a higher degree of control over switching sensitivity.
This device basically works like a switch, connecting two isolated circuits on your PCB. When current stops flowing through the LED, the photosensitive device also stops conducting and turns off. All of this switching happens through a void of glass, plastic, or air with no electrical parts between the LED or photosensitive device. It’s all about the light.
Benefits and Types
If you’re designing an electronic device that will be susceptible to voltage surges, lightning strikes, power supply spikes, etc. then you’ll need a way to protect low-voltage devices. When used correctly, an Optocoupler can effectively:
- Remove electrical noise from signals
- Isolate low-voltage devices from high-voltage circuits
- Allow you to use small digital signals to control larger AC voltages
Optocouplers come in four configurations. Each configuration shares the same infrared LED with a different photosensitive device. These include:
Photo-Transistor and Photo-Darlington, which are typically used in DC circuits, and Photo-SCR and Photo-TRIAC which are used to control AC circuits.
If you’re feeling adventurous, you can even make a homemade Optocoupler with some spare parts. Just combine an LED and phototransistor together inside a reflective plastic tube.
Optocouplers can either be used on their own as a switching device, or used with other electronic devices to provide isolation between low and high voltage circuits. You’ll typically find these devices being used for:
- Microprocessor input/output switching
- DC and AC power control
- Communications equipment protection
- Power supply regulation
Within these applications, you’ll encounter various configurations. Some examples include:
Opto Transistor DC Switch
This configuration will detect DC signals and also allows you to control AC powered equipment. The MOC3020 is perfect for controlling a mains connection or providing a gate pulse to another Photo-Triac with a current limiting resistor.
This configuration will allow you to control AC powered loads such as motors and lamps. It’s also capable of conducting in both halves of an AC cycle with zero-crossing detection. This allows a load to receive full power without any major spikes in current when switching inductive loads.
PCB Layout Guidelines
Before adding an Optocoupler to your PCB layout consider these three guidelines:
- Keep optocoupler ground connections separate
A standard Optocoupler includes two ground pins, one for the LED and another for the photosensitive device. Connecting both of these grounds together will open your sensitive circuitry to any noise from the external ground. To avoid this, always create two connection points, one for external ground pins, and the other for input ground wires.
- Choose the right current limiting resistor value
Selecting a current limiting resistor that operates at an Optocoupler’s minimum value will produce erratic behavior. It’s also possible to choose a resistor that provides too much current, which will pop the LED. When selecting a value for your resistor, be sure to find the value of the minimum forward current from the Current Transfer Ratio chart in your Optocoupler’s datasheet. Vishay has an excellent guide on how to read an Optocoupler datasheet here.
- Know what kind of Optocoupler you need
Not every Optocoupler is created equal, and you’ll need to select the right type for your application. For example, an Opto-Triac is used if you need to control an AC load. Opto-Darlington’s are only for small input currents. If all you need is a standard input isolation, then a general PC817 Optocoupler will get the job done. This article from Nuts and Volts is definitely worth a read to understand Optocoupler types and differences.
Optocoupler Libraries in EAGLE
The Autodesk EAGLE Managed Online Libraries include a whole category of Optocouplers to use in your next project. That beats having to create your own packages and symbols from scratch! To use this library, make sure that optocoupler.lbr is activated within your Autodesk EAGLE Control Panel as shown below. If it is, then you’ll have access to all of these devices the next time you need to add a component.
Ready to start isolating circuits and protecting low-voltage devices? Download Autodesk EAGLE for free today to start using the included Optocoupler libraries!