I have designed this optocoupler interface to an stepper driver. However, I'm not sure if it's all right. For R1 I made (5-3.3)/10mA ≈ 180 ohms. 3.3V taking into account the two leds voltage drops.
The output part is the one confusing for me. It's an open collector configuration that will be connected to the stepper as shown. I know that the circuit could be done without the 2n3904, but I want to include it. What do you think about the values of R2=10k and R3=3.3k? I'm not experted at designing so I'm asking for your suggestions. I'm not taking the CTR concept into account. Also I need to review the currents to be sure that it's all right at the output.
The circuit part inside the box is an input of the driver, so it's unmodifiable.