Selection of Optocoupler Resistor
Subtract the led voltage from the supply voltage, this gives the Voltage across the resistor, and divide it by the led current, that will give you the resistance to use. Optocupler: FAIRCHILD MOCD207M According to the data sheet with If=1mA minimum CTR is 34%. Since a nano will probably fry instantly if the 12v trigger wire is directly connected to it, i used to use a 5v1 Zener diodes coupled with a few resistors to step down voltage to 5v. An optocoupler, also known as photocoupler or opto-isolator, is a device which can transfer an electrical signal across two galvanically-isolated circuits by way of optical coupling. Unlike transformers or capacitors, which can only transfer AC signals across the isolation barrier, optocouplers can.
Read More