MOC3021 Triac drive Optoisolator pinout, working, examples

MOC3021 is a non-zero crossing based optoisolator consists of gallium arsenide infrared emitting diodes, optically coupled to a silicon-based triac. Optocoupler has multiple types and every type has almost the same operating functionality, but sometimes its internal structure makes it different from another optocoupler. There is also a TRIAC based optocoupler known as MOC3021. It is having internal TRIAC installed which gives it a capability to control any external switching devices like HIGH POWER TRIAC, MOSFETS, and Solid States Relay.

MOC3021 Introduction

The MOC3021 comes in an internal light-emitting diode and a TRIAC based light activating based transistor. This optocoupler provides protection from HIGH resistive and inductive loads. It has the ability to flow the current up to 1A. MOC3021 Optocoupler work on the IR based and it keeps any kind of current to flow towards the circuit. The optocoupler comes only in one package but the single package could be used with any circuit. In HIGH load the operating temperature always affects the circuit performance, but MOC3021 has the ability to operate in HIGH temperature and it also increases the optocoupler life.

The MOC3021 is a Non-Zero Crossing optocoupler. The other optocoupler only gives the output only gives magnitude at zero but non-zero optocoupler gives the magnitude at different levels from zero to maximum. This ability of optocoupler not only allow the device to control the output as a switch, but it also allows the device to be controlled at different levels, that is the reason in IOT the optocoupler MOC3021 used in a circuit to control the Motor speed, Heater temperature, etc.


The pinout diagram shows all the pins.

MOC3021 Pinout
ANODEPin1Pin 1 is an anode input pin. It is used to control the output of the MOC3021. In case of HIGH pulse on the MOC3021 makes it functional which then could be used further. Pin 1 is actually the internal IR transmitter pin of the optocoupler.
CATHODEPin2Pin 2 is the cathode pin of the optocoupler is the ground pin of the IR within the optocoupler. To use the IR pin 2 should be common ground with the power supply or the logical input device.
NCPin3Pin 3 is an NC pin. NC pin is used just for soldering the optocoupler to the board for proper support. Sometimes NC pins are designed for physical support and sometimes they are available in the devices just because of its complex internal design.
TRIAC T2Pin4Pin 4 is a TRIAC pin of the optocoupler. It is present within the IC.
NCPin5Pin 5 is also a second no connection pin of the IC just like Pin 3. Pin 5 also doesn’t have any use instead of balancing the IC.
TRIAC T1Pin6Pin 6 is the second TRIAC pin in the optocoupler.  The external switches are connected to Pin 4 and 6.

Other Alternative Optoisolators

4N25, 6N135, PC817, MOC3041, 6N137

How and Where to use MOC3021 Phototransistor Optocoupler

The IC could work with any TTL device or any microcontroller but to operate it properly with high load external TRIAC is suggested due to some safety measurements and due to different magnitudes of the IC. The output will be flow only when the input is HIGH. First, take a look at the given circuit. In the circuit, you can see that IC is controller the bulb through TRIAC. But when we use the IC just for on and off function then the bulb will work properly but in case of dimmer, the bulb will keep blinking due wave nature of AC current. This issue only comes at different magnitude levels at the IC, at maximum and minimum the IC will be operating just like a switch for the LOAD.

MOC3021 interfacing circuit with microcontroller

In the case of giving the different magnitude of the output, we will need to use the zero-cross with PC817. In high load when the high load will generate the reverse current then it could pass through the TRIACS but it cannot harm the controller due to IR communication. 

MOC3021 Automatic Control Light Circuit Example

In this example, we are going to use the MOC3021 in automatic light on method after daylight. We are going to use a transistor, TRIAC, lamp, 220 AC, resistors and an LDR. In this circuit, LDR will be used to detect the sunlight and moc3021 will be used to turn on and off the lamp through the TRIAC. The transistor will be used to turn on the MOIC 3021. We can use LDR directly with the MOC3021 with the help of resistors but here we are going to use a variable resistor. The variable resistor will be able to adjust the LDR sensitivity.

Circuit Diagram

In the end, the following circuit will be formed in the end.

MOC3021 Example controlling 220V lamp

In the start, the circuit will not be in working, we will need to adjust the LDR sensitivity through a resistor. After that change, the sensitivity of the sun then witnesses the output on LAMP. The lamp will start glow and then again increase the frequency then LAMP will turn off. Here’s the glowing lamp.

MOC302X Example controlling 220V lamp 2

This automatic night switch is very beneficial for saving energy and physical movement. Everything will be work in a flow but here this whole communication between low voltage and high voltage devices happened only due to MOC3021. MOC3021 can be used as a switch instead of controlling relays or TRIACS. It has the ability to perform to take the low voltage signal and control high voltages through it without any relay but due to safety issues, it is preferred to use the external TRIACS or relays.

Proteus Simulation

You can further read this guide:

MOC3021 Optocoupler Features

  • High isolation voltages, which is not for AC current. This ability only exists a TRIAC based optocoupler.
  • stability of the device is much reliable for any high load.
  • Soldering temperature for optocoupler is much high.
  • The output pins have the ability to hold the high load at off state which makes it reliable for any switching device at a normal level.
  • Due to the internal IR transmitting function, the input device remains securely used with the IC to control it.
  • Due to non-zero ability, the IC can give the output of different magnitudes. It makes the IC control the load at different from the use of external TRIACS.
  • The temperature is the important factor when we need to control the high load and IC can operate within the high temperature and it can also store the temperature.
  • The IC comes only in one 6 pin package which is PDIP but it is usable with any circuit.


  • The IC has minimum input forward voltage is 1.3V
  • To the trigger the LED forward current should be 15mA minimum otherwise led may not operate.
  • The TRIAC within the IC has a high output voltage range which is 400V maximum. More than 400 will first heat up the IC then it will burn.
  • TRIAC has peak output current range of 1.2A.
  • The Power dissipation for IC at 25 degrees is 300mW.
  • The operating temperature range for IC is -40 to 100 degree and it has the ability to store the temperature up to -55 to 150 degree.
  • The Soldering temperature range for IC is 260-degree maximum then IC will burn during soldering.

MOC3021 Optocoupler APPLICATIONS 

  • The IC can operate with all European applications up to 240V of AC.
  • MOC3021 is used to operate high load TRIAC.
  • In industrial applications, the IC has vast usage.
  • IC also used as switching in Traffic Lights.
  • Motor control and Fan speed control also uses MOC3021 with the microcontroller.
  • Vending Machines and SSR (Solid State Relays) also use IC to operate.

Download MOC3021 DataSheet

2D Dimensions

2D Diagram

Leave a Comment

five × three =