Optocoupler voltage drop when connected to load
The sensor datasheet says it requires 30 mA. Your 1 k&Omega; R3 will limit the current to 5 mA into a dead short. You need to redesign that part of the circuit (and maybe some others).







simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. A possible solution.

Note that with this arrangement the output will go towards +5 V when the opto-isolator is turned off. This may not be what is required.