What transistor to use in place of QVE11223 opto
At 12 mA wouldn't work if you directly connect X to Arduino?

Anyway this is what you get by redrawing the circuit without the LED:







simulate this circuit &ndash; Schematic created using CircuitLab

Any general purpose NPN should work (BC547, 2N3904).