What is optocoupler and how it is used?
an optocoupler is a device used when you want to electrically isolate a circuit from another circuit that you want to send an electric signal

when you turn on the led it sends photons to the phototransistor, these phototransistor which is like a normal transistor but its "base current" is the light emitted by the led, in this way you can use it as an isolated switch between two circuits


using an optocoupler to control a 12v load with a 3v3 signal