Optocouplers not only protect sensitive circuits but enable an engineer to design a variety of hardware applications. Optocouplers can avoid a great deal of cost in replacing components by protecting them. However, optocouplers are more sophisticated than fuses. Optocouplers also make it convenient to control the connection between two circuits by connecting and disconnecting them via an optocoupler. Optocouplers are extensively used in electronics, electrical, and communications systems.
How to protect sensitive circuits from high voltages
Optocouplers are often used to reject back EMF, noise, and electrical surges from entering an MCU circuit. Optocouplers create a safe connection between high voltage equipment and microcontrollers with a means of complete electrical insulation. In case the high voltage circuit induces an electrical surge, the surge remains only on the output side of the optocoupler, and the circuit at input side remains safe and unaffected, as both sides are electrically isolated. Optocouplers are also called photodiodes, optoisolators, photocouplers, and optical isolators.
A standard optocoupler such as PC817 supports up to 5 kV of input-output isolation voltage. [i] Most electronic components operate below 10 V, and if a lighting surge enters the system, it can induce voltages up to 10 KV – which is enough to fry electronic components at once. Some commercial-scale optocouplers can withstand up to 10 KV of Input-output isolation voltage which are used for protection against lightning strikes. [ii]
Replacing burned components on a Printed Circuit Board (PCB) can be highly inconvenient. However, optocouplers can be used for securing expensive components. In case of a malfunction, the optocoupler burns and rest of the circuit is not affected. Optocouplers are not directly soldered on the circuit; instead they are placed in an Integrated Chip (IC) socket so they can always be replaced easily if burned.
For a detailed explanation of the internal workings of an optocoupler and how to build your own using an LED and photodiode, see an earlier post called Protecting an MCU: Build your Own Optocoupler.
Why aren’t ground levels on an optocoupler’s input and output side connected?
The circuits at the side where the optocoupler’s Input/Output (I/O) are located are meant to be protected from possible risks on either side. Although the term “ground level” voltage sounds like it is always 0 V, this is not necessarily the case. The ground level of a 5 V source and a 220 VAC source can be quite different; the ground voltages observed by the 5 V source do not need to be same as that of the 220 VAC. In such cases, connecting the ground planes from different sources can be hazardous. Even if the 220 VAC is stepped down and rectified to 5 VDC, it is still not recommended to connect ground level from both sides to each other. Doing so can produce electrical glitches, which is why the ground levels of both I/O sides of an optocoupler are always kept electrically disconnected. For detailed information on how common points and their paths are usually connected, read Bill Schweber’s article “How should grounds and commons be connected to each other?”
Impedance matching: problem-solving with optocouplers
In many communication circuits it is essential to establish matching impedances between several components. A mismatch can result in inappropriate output. However, optocouplers can be used for signal transmission without requiring impedance matching on both sides, which is why optocouplers are widely used in high speed telecommunications equipment. According to Janet Heath, “In an ideal world, the signal energy coming out of a pin would travel through PCB traces and be wholly absorbed by the load. However, if energy is not completely soaked up by the load (receiver), residual energy can get reflected back through the PCB trace, reaching the original source of the energy at the output pin (driver).“[iii] Photodiode-based optocouplers like the Toshiba TLP2719 photocoupler can support signal speeds up to 1Mbps. High-speed optocouplers have a data transmission rate of up to 50 Mbps.[iv]
Using optocouplers for sensing zero crossing of AC sources
Sensing zero-crossing of AC mains is essential in many applications. For example, a typical Power Factor Correction System measures the difference in angles between the Real Power and Reactive Power (both components of total power). The difference between real and reactive power is measured by monitoring something called the “zero crossing” of voltage and current waves. “Zero-crossing” is a term commonly used in electronics, acoustics, math, and image processing. Zero crossing denotes the location where a wave form cuts across it’s coordinate axis (i.e., if you graphed the wave form). Zero crossings also indicate when a waveform, expressed as a mathematical function, will switch from positive to negative and back again. Note that some frequency testing circuits work on the principle of monitoring zero-crossings in AC source waveforms. [v]
Optocouplers can be used for sensing zero-crossing of AC Power mains. The response time of an optocoupler is mere nanoseconds; it turns on and off speedily at zero-crossings. By using a rectifier and filter on AC mains, digital signals can be obtained from the optocoupler.[vi] Using RC filters, the output waveform can be varied as needed.
Switching devices with optocouplers
Optocouplers are used as a safe barrier between microcontroller’s digital output and external components that need to be controlled.
The digital output of the microcontroller in Figure 3 initiates a 5 VDC (digital) signal which is used for switching the IRED in an optocoupler (U1). The output pins of the microcontroller and the IRED in the optocoupler can support a limited flow of current; therefore, it is recommended to use a current limiting resistor between the microcontroller’s output and the optocoupler’s input. As the IRED turns on, the infrared light falls on the phototransistor, which actuates (energizes) the phototransistor, after which the current starts flowing between the collector and emitter pins. The phototransistor’s collector and emitter support limited current flow. If a device with higher current specifications needs to be controlled, then a transistor can be used to amplify an optocoupler’s output.
The switching device’s ground is not connected with the common ground on the microcontroller’s circuit, since it could result in noise leakage headed towards the microcontroller.
Reading input signals with optocouplers
Optocouplers can be used for safely reading levels as logic 0 and logic 1 from any source. For instance, the voltages from a transformerless power supply may contain noise. In such situations, if the input signal is directly connected with the microcontroller, the noise from the input signal can affect the way the microcontroller functions. Similarly, in case a microcontroller’s input is accidently exposed to an electrical surge, the microcontroller is immediately destroyed (i.e., it burns or “lets out the magic smoke.”) However, using an optocoupler between a microcontroller and an input signal is like an insurance policy and can prevent such accidents.[vii]
Optocouplers not only protect sensitive circuits but enable an engineer to design a variety of hardware applications. Using an optocoupler saves a great deal of cost on replacing components and makes it convenient to control the connection between two circuits by connecting/disconnecting an optocoupler. Optocouplers are extensively used in electronic, electrical, and communications systems.