An optocoupler is a device containing an infra-red LED and a matching phototransistor, mounted close together (optically coupled) within a light-excluding package.

Input voltage powers the infra-red LED which triggers a proportional outage voltage in the phototransistor. However, the output voltage is not electrically connected to the input voltage. This allows the optocoupler to safely connect two circuits what must be isolated electrically.

For example, you may have a computer controlling a mains powered relay switch. There is considerable risk that a fault in the relay may send main power down your serial control port of your PC. However, by using an optocoupler, the 5V voltage from the serial output of the PC could trigger the relay switch via an optocoupler.

The optocoupler can be used to optocouple either digital or analogue signals and can provide hundreds or thousands of volts of isolation between the input and output circuits. There are two variations of the optocoupler.

The first is the slotted optocoupler which has a slot moulded into the package between the LED and the phototransistor. The slot houses transparent windows so that the LED light can normally freely reach the phototransistor, but can be interrupted or blocked via an opaque object placed within the slot. Hence the slotted optocoupler can be used as an object detector.

The second device is the reflective optocoupler. Here the photoactive faces of the LED and the phototransistor both point outwards (via transparent windows) towards an imaginary point that is roughly 5 mm beyond each window, so that the LED light can only reach the phototransistor via a reflective surface that is placed at or near this point. This device can thus also be used as an external-object detector.

Part of the Node Your Homework! project