Introduction: 4N35

About: PrimeRobotics is a E-Commerce site, which focus on supplying right products to Electronics Hobbyists, Enthusiast & Students.

The 4N35 is an optocoupler that consists of a gallium arsenide infrared LED and a silicon NPN phototransistor. When the input signal is applied to the LED in the input terminal, the LED lights up. After receiving the light signal, the light receiver then converts it into electrical signal and outputs the signal directly or after amplifying it into a standard digital level. Thus, the transition and transmission of electricity-light-electricity is completed. Since light is the media of the transmission, meaning the input terminal and the output one are isolated electrically, this process is also be known as electrical isolation.

Step 1: ​Components

Step 2: ​Principle:

The 4N35 is an optocoupler for general purpose application. It consists of gallium arsenide infrared LED and a silicon NPN phototransistor.

What an optocoupler does is to break the connection between signal source and signal receiver, so as to stop electrical interference. In other words, it is used to prevent interference from external electrical signals. 4N35 can be used in AV conversion audio circuits. Broadly it is widely used in electrical isolation for a general optocoupler.

See the internal structure of the 4N35 above. Pin 1 and 2 are connected
to an infrared LED. When the LED is electrified, it'll emit infrared rays. To protect the LED from burning, usually a resistor (about 1K) is connected to pin 1. Then the NPN phototransistor is power on when receiving the rays. This can be done to control the load connected to the phototransistor. Even when the load short circuit occurs, it won't affect the control board, thus realizing good electrical isolation.

Step 3: ​The Schematic Diagram:

Step 4: ​Procedures:

In this experiment, use an LED as the load connected to the NPN phototransistor. Connect pin 2 of the 4N35 to pin 7 of the control board, and pin 1 to a 1K current limiting resistor and then to 5V. Connect pin 4 to GND of the Uno, and pin 5 to the cathode of the LED. Then hook the anode of the LED to 5V after connecting with a 220 Ohm resistor. When in program, a LOW level is given to pin 7, the infrared LED will emit infrared rays. Then the phototransistor receives infrared rays and gets electrified, and the LED cathode is LOW, thus turning on the LED. Also you can control the LED by circuits only – connect pin 2 to ground and it will brighten

Step 1:

Build the circuit.

Step 2:

Download the code from https://github.com/primerobotics/Arduino

Step 3:

Upload the sketch to the Arduino Uno board

Click the Upload icon to upload the code to the control board.

If "Done uploading" appears at
the bottom of the window, it means the sketch has been successfully uploaded.

Step 5: Code

//Turn on a led by

//turn on the LED for half a second,then off for half a second,repeatedly



int OptoPin=7; //attach the input of the 4n35 to pin 7

void setup()


pinMode(OptoPin, OUTPUT); //set it as OUTPUT


void loop()


digitalWrite(OptoPin, LOW); //set the OptoPin as LOW level,then the led connected on the output of 4n35 will be light

delay(500); //delay 500ms

digitalWrite(OptoPin, HIGH); //turn off the led

delay(500); //delay 500ms


Be the First to Share


    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest



    1 year ago

    You should add "optocoupler" and/or the word "tutorial" to the title to make it easier for people to find.