Sensors & isolation

Optocoupler

An LED and a light sensor sealed in one package, facing each other across a clear gap. The signal crosses as light, so the two circuits share no wires and can be thousands of volts apart.

Think of it as: Signalling with a torch across a river instead of building a bridge.

Pins

A / K (pins 1, 2)
: The LED input. Needs a series resistor, like any LED.
C / E (pins 4, 3)
: The phototransistor output. Use it like a switch with a pull-up resistor.

The PC817 in a 4-pin DIP is the classic; there are SMD versions and faster ones with logic outputs.

What to look for inside

  • The input switches on and off.
  • When it is on, the LED shines across the clear gap inside the package.
  • The light turns on the phototransistor, so the output circuit conducts. No electrical connection crosses the gap.

The numbers that matter

SpecTypical
CTR (current transfer ratio)
Output current ÷ LED current. It falls as the part ages.
50 % to 600 %
Isolation voltage
The safety rating between the two sides.
3.75 kV to 5 kV
LED forward current
Sets how hard the output turns on.
5 mA to 20 mA
Switching speed
Slow parts round off fast signals.
5 µs to 20 µs (PC817)

Where you’ll use it

  • Reading mains-powered signals safely with a microcontroller.
  • Feedback in isolated power supplies.
  • Breaking ground loops between two devices.

Common mistakes

  • No resistor on the LED side.
  • Expecting the output to switch fast or carry big current. It is a signal device.

Go deeper

IC=CTR×IFI_C = \text{CTR} \times I_F

Output current is the LED current times the transfer ratio.

All components · All lessons · Glossary