Does a BJT optocoupler have an inherently short circuit proof output?
The output of the opto-coupler is NOT short-circuit proof, in that if the relay coil is shorted or draws too much current the opto transistor will blow. If you are asking if the LED is short-proof, that would be correct. The series resistor determines the LED current. These are normally IR LEDs with just a 1.1 volt drop so if it is shorted the current changes by a small amount.
By the way, usually 5 mA of current will drive the LED fully ON, so 20 mA is wasting power as heat. Opto's with high gain (400 &gt; 500) will work at 2 mA.
Normally the collector drives the relay with the emitter ground so you take advantage of the transistors current gain, hFE or \$Beta\$. You may need a booster transistor as opto-couplers are not known to have a source or sink current over 10 mA, so be sure to read the datasheets.
I added a simple schematic to show the OPTO being used with a NPN bjt to boost the drive current to over 100 mA if required. R3 makes sure relay is OFF if opto-coupler is OFF. R4 limits drive current to base of Q1.
EDIT: Opto-couplers CANNOT supply enough current for common relays, so you will need a transistor with much stronger drive current, and its emitter should be grounded. The wire you have in RED has NOTHING to do with the LED current, which can be 5 mA. The relay may need 10 to 30 mA @ 12 volts, beyond what the opto-coupler by itself can drive. If you do not understand this, please find another hobby or at least study a lot of simple circuits so you are certain of the outcome when you build something.



simulate this circuit &ndash; Schematic created using CircuitLab