So now we start a new thread when there was perfectly sound answer in this thread: 24V-36Volt on transistor Base - General Electronics - Arduino Forum
Use a resistive divider as explained in the other thread, that is the correct solution. There is zero reason to add an optocoupler to the circuit. You'll still need two resistors per channel with an opto so there is nothing to gain by doing this.