I am designing a board that will be plugged into a computer and will read the status of a button ~50 m away in an office environment (it's actually a lot closer, but the cable is long).
I think it's a good idea to galvanically isolate the button wiring from the computer, since the PC will be grounded. I don't want any faults on the wiring to be able to damage the computer.
I'm assuming less than 100 ohm resistance for the cable, and while a simple series resistor would work, I think having a constant current sink for the opto LED is safer (i.e. if the cable has to be a lot longer, or shorter, etc.).
Is this a sensible approach to it? Cost/space is not much an issue, so I could add some protection/filtering circuitry, but I'm not entirely sure where/how to do it, so I'd be happy to hear some suggestions.
simulate this circuit – Schematic created using CircuitLab