Optocoupler Tutorial

We know from our tutorials about Transformers that they can not only provide a step-down voltage, but they also provide “electrical isolation” between the higher voltages on the primary side and the lower voltage on the secondary side.

In other words, transformers isolate the primary input voltage from the secondary output voltage using electromagnetic coupling by means of a magnetic flux circulating within the iron laminated core. But we can also provide electrical isolation between an input source and an output load using just light by using a very common and valuable electronic component called an Optocoupler.

typical 4n35 optocoupler

An Optocoupler, also known as an Opto-isolator or Photo-coupler, is an electronic components that interconnects two separate electrical circuits by means of a light sensitive optical interface.

The basic design of an optocoupler consists of an LED that produces infra-red light and a semiconductor photo-sensitive device that is used to detect the emitted infra-red beam. Both the LED and photo-sensitive device are enclosed in a light-tight body or package with metal legs for the electrical connections as shown.

An optocoupler or opto-isolator consists of a light emitter, the LED and a light sensitive receiver which can be a single photo-diode, photo-transistor, photo-resistor, photo-SCR, or a photo-TRIAC and the basic operation of an optocoupler is very simple to understand.

Phototransistor Optocoupler

phototransistor optocoupler

Assume a photo-transistor device as shown. Current from the source signal passes through the input LED which emits an infra-red light whose intensity is proportional to the electrical signal.

This emitted light falls upon the base of the photo-transistor, causing it to switch-ON and conduct in a similar way to a normal bipolar transistor.

The base connection of the photo-transistor can be left open for maximum sensitivity or connected to ground via a suitable external resistor to control the switching sensitivity making it more stable.

When the current flowing through the LED is interrupted, the infra-red emitted light is cut-off, causing the photo-transistor to cease conducting. The photo-transistor can be used to switch current in the output circuit. The spectral response of the LED and the photo-sensitive device are closely matched being separated by a transparent medium such as glass, plastic or air. Since there is no direct electrical connection between the input and output of an optocoupler, electrical isolation up to 10kV is achieved.

Optocouplers are available in four general types, each one having an infra-red LED source but with different photo-sensitive devices. The four optocouplers are called the: Photo-transistor, Photo-darlington, Photo-SCR and Photo-triac as shown below.

Optocoupler Types

optocoupler types


The photo-transistor and photo-darlington devices are mainly for use in DC circuits while the photo-SCR and photo-triac allow AC powered circuits to be controlled. There are many other kinds of source-sensor combinations, such as LED-photodiode, LED-LASER, lamp-photoresistor pairs, reflective and slotted optocouplers.

Simple homemade optocouplers can be constructed by using individual components. An Led and a photo-transistor are inserted into a rigid plastic tube or encased in heat-shrinkable tubing as shown. The advantage of this home-made optocoupler is that tubing can be cut to any length you want and even bent around corners. Obviously, tubing with a reflective inner would be more efficient than dark black tubing.

Home-made Optocoupler

home made optocoupler

Optocoupler Applications

Optocouplers and opto-isolators can be used on their own, or to switch a range of other larger electronic devices such as transistors and triacs providing the required electrical isolation between a lower voltage control signal and the higher voltage or current output signal. Common applications for optocouplers include microprocessor input/output switching, DC and AC power control, PC communications, signal isolation and power supply regulation which suffer from current ground loops, etc. The electrical signal being transmitted can be either analogue (linear) or digital (pulses).

In this application, the optocoupler is used to detect the operation of the switch or another type of digital input signal. This is useful if the switch or signal being detected is within an electrically noisy environment. The output can be used to operate an external circuit, light or as an input to a PC or microprocessor.

An Optotransistor DC Switch

optotransistor switch


As well as detecting DC signals and data, Opto-triac isolators are also available which allow AC powered equipment and mains lamps to be controlled. Opto-coupled triacs such as the MOC 3020, have voltage ratings of about 400 volts making them ideal for direct mains connection and a maximum current of about 100mA. For higher powered loads, the opto-triac may be used to provide the gate pulse to another larger triac via a current limiting resistor as shown.

Triac Optocoupler Application

triac optocoupler application


This type of optocoupler configuration forms the basis of a very simple solid state relay application which can be used to control any AC mains powered load such as lamps and motors. Also unlike a thyristor (SCR), a triac is capable of conducting in both halves of the mains AC cycle with zero-crossing detection allowing the load to receive full power without the heavy inrush currents when switching inductive loads.

Optocouplers and Opto-isolators are great electronic devices that allow devices such as power transistors and triacs to be controlled from a PC’s output port, digital switch or from a low voltage data signal such as that from a logic gate. The main advantage of opto-couplers is their high electrical isolation between the input and output terminals allowing relatively small digital signals to control much large AC voltages, currents and power.

An optocoupler can be used with both DC and AC signals with optocouplers utilizing a SCR (thyristor) or triac as the photo-detecting device are primarily designed for AC power-control applications. The main advantage of photo-SCRs and photo-triacs is the complete isolation from any noise or voltage spikes present on the AC power supply line as well as zero-crossing detection of the sinusoidal waveform which reduces switching and inrush currents protecting any power semiconductors used from thermal stress and shock.


Join the conversation!

Error! Please fill all fields.

What's the Answer *

  • A

    hello sir/madam
    i need a circuit diagram of touch button for using in elevator/lift instead of mechanical switch( our working voltage is 24v dc)
    thanking you

  • N

    hellow Sir/ Mam.
    I need circuit diagram tabular column for phototransistor as a switch

  • g

    its nice and interesting tutorial

  • h

    how optocoupler can control much larger AC voltages

  • A

    I am using mains ac voltage 220v as input to a opto coppler 817 and the other end connected to a micro with a 10k ohm pullup resistor.
    when input is connected to 220v ,out put must be zero but its 2.7v .can you tell me why this happens and how can I get nearly zero in the out put?

    • Wayne Storr

      Vce(sat) will never be zero, but some value less than 0.5V, check datasheet. The value of Vce(sat) depends on sufficient collector current (Ic) as a result of the pull-up resistance, (10k is too high) and sufficient forward diode current (If) to illuminate the photo-diode and drive the transistor hard into saturation, again check datasheet. Another option is to use the opto’s photo-transistor to drive an external switching transistor.

  • a
    adi bhosada

    English only

  • D

    i m trying to use optocoupler for the isolation of raspberry pi and inverter driving IC for the protection of raspberry pi,which dc optocoupler IC is better for me.
    thank you

    • Wayne Storr

      There is only one opto-coupler that will switch DC voltages on its output and that is an opto-transistor.

  • j

    good knowledge gaining

  • P

    HI, one question. I am using MOC3021. when I given supply (DC 3v )to pin 1 and 2 , pin 4 and 6 will conducted. but problem is that If I disconnect DC supply from pin 1 and 2, ping 4 and pin 6 are still in conducted mode. Theoretically current will not flow from pin 4 and 6 when pin 1 and 2 is disconnected.

    • Wayne Storr

      The MOC3021 is a phototriac, then there are two possibilities as to why there is continuous conduction between pins 4 and 6. You are using a DC supply for the triac, or the triac is faulty.

  • j

    Optocouplers can be used as either input or output devices. They can have additional functions such as intensification of a signal or Schmitt triggering (the output of a Schmitt trigger is either 0 or 1 – it changes slow rising and falling waveforms into definite low or high values). Optocouplers come as a single unit or in groups of two or more in one casing.

    Read more: http://romux.com/tutorials/pic-tutorial/optocouplers#ixzz42DjrPqb7

Loooking for the latest from TI?