Source: https://mokxi.com/parts/optocoupler
Updated: 2026-11-19

Part

# Optocoupler, 4N35

An infrared LED and a phototransistor in one DIP-6, with no wire between them: switch a circuit you cannot connect to.

See every part

- 6 pins
- 1 setting
- In 1 project

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Optocoupler, 4N35 in brief

What it is, and every setting the properties panel gives it.

An optocoupler is an infrared LED and a phototransistor sealed in one black DIP-6, facing each other across a gap of clear plastic. Current through the LED makes light, the light turns the transistor on, and the two sides share no wire, so the circuit on the transistor side can have its own supply and ground. That is the whole point, and it is how the Arduino Starter Kit’s Hacking Buttons project presses another gadget’s button. The Mokxi part is the 4N35, and the four-pin PC817 on relay modules works the same way. The LED is an infrared one, 1.2 V at 10 mA and about 1.35 V at 50 mA. The transistor’s light comes from the LED current, so its collector current is the CTR percentage times the LED current, 120 percent by default, and if asked for less it saturates at about 0.1 V. The base pin is left open, and switching time, aging and the isolation voltage are not modeled.

Family

Timers and analog

Pins

6

ctr

120

Pins

## 6 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

A

1

K

2

NC

3

E

4

C

5

B

6

How to use it

## How to use a 4N35 optocoupler with an Arduino

The project keeps two circuits apart. On the Uno side, pin 2 goes through a 220 ohm resistor to A, the LED’s anode, and K goes to the Uno’s ground. That is about 17 mA. On the other side, two AA cells, a 330 ohm resistor and a red LED stand in for the gadget, and the transistor’s C and E go where its button would: collector toward the more positive side. Every two seconds the sketch takes pin 2 high, the infrared LED lights, and the far LED comes on with no wire between the two.

The LED is an LED, so it wants its resistor. Without one a pin pushes as much current as it can, far past the rating. Pin 3 is not connected on the real part either, and the base, pin 6, is left open in the model, so anything wired to B has no effect.

The CTR, current transfer ratio, is the collector current per milliamp of LED current at the datasheet’s test point. Vendors guarantee at least 100 percent, and the model defaults to 120. A transistor asked for less than that saturates, about 0.1 V collector to emitter, which is the pressed state a button needs. It is a transistor, not a contact: wired backward across a button it barely conducts, and it is good for tens of milliamps, so to switch more use it to drive a transistor or a relay.

Part pin

Board pin

A (pin 1)

Uno pin 2, through 220 ohms

K (pin 2)

Uno GND

NC (pin 3)

Not connected, on the real part too

C (pin 5)

The gadget’s more positive side, here the cells through 330 ohms and the LED

E (pin 4)

The other side, here the cells’ minus

B (pin 6)

Left open

On a 3.3 V board use a smaller resistor for the same LED current: (3.3 V minus about 1.2 V) over 10 mA is about 210 ohms, so 220 ohms gives roughly 10 mA.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

A press every two seconds

Common errors

## Common Optocoupler, 4N35 errors and fixes

What goes wrong

The fix

The pin is wired straight into the LED.

Put a resistor in series, such as 220 ohms from a 5 V pin for about 17 mA. Without it the pin pushes more current than the LED can take.

The transistor side barely conducts.

Collector and emitter are the wrong way around across the gadget’s button. The collector goes to the more positive side. It only carries current one way.

Something wired to pin 6 changes nothing.

The base is left open in the model, as in most hobby circuits. On a real 4N35 a resistor from B to E can speed up switching, but it is not modeled.

A motor or a mains load connected to the transistor does not work.

The transistor handles tens of milliamps. Use the optocoupler to drive a transistor, a MOSFET or a relay, and keep the load on that.

Questions

## Questions and answers

### What is an optocoupler used for?

To pass a signal between two circuits with no electrical connection. The LED lights, the phototransistor conducts, and the two sides can have separate supplies and grounds.

### What is CTR?

The current transfer ratio: collector current per milliamp of LED current, in percent, at 10 mA and 10 V. Every vendor guarantees at least 100 percent for a 4N35. The model defaults to 120.

### Why does the LED need a resistor?

It is an infrared LED with a forward drop of about 1.2 V. Without a resistor, a pin drives current limited only by the pin, far above the part’s rating.

### Does the model enforce the isolation rating?

No. The two sides are separate circuits with no path between them, and the isolation voltage is unlimited in the simulation. A real part has a limit.

How it is modeled

## What is true about the Optocoupler, 4N35, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

Isolation. The LED side and the transistor side are separate circuits with no
path between them, so each can have its own ground.

The LED's drop. It is an infrared GaAs LED, not a visible one: 1.2 V at 10 mA
and about 1.35 V at 50 mA, from the 4N35 sheets (1.5 V maximum). Under about 1 V
it passes almost nothing.

The current transfer ratio. The transistor's light comes from the LED current,
solved in the same step, so its collector current in the active region is ctr
times the LED current at the test point: every vendor's 4N35 guarantees at least
100 %, and the default of 120 % is an assumption just above that floor. A
transistor asked for less than that saturates, about 0.1 V from collector to
emitter, which is the "pressed" state a button circuit needs.

It is a transistor, not a contact. Wired backwards across a button (emitter to
the positive side) it barely conducts, and it only carries current one way.

### Not modeled

The base pin: the 4N35 brings the transistor's base out on pin 6 so a resistor to
the emitter can speed up switching. Here the base is open inside, as in most hobby
circuits, and anything wired to B has no effect.

The switching time (a few microseconds), the CTR's fall at very low and very high
LED currents and as the part ages, temperature, and the isolation voltage, which
here is unlimited.

From Optocoupler (4N35), in full.

Projects

## See the Optocoupler, 4N35 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

## The boards it is shown on

This board has a built-in project with the Optocoupler, 4N35 in it.

- Arduino Uno R3

Keep going

## Keep going

- Picking a Resistor for an LED
- NPN Transistor as a Switch: a 2N2222 and an Arduino
- Relay module
- Transistor (NPN or PNP)
- Solid-state relay, SSR-25DA / G3MB-202P

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Optocoupler, 4N35

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
