opto-coupler: transistor vs logic

Grumpy_Mike:

Can you explain why this would make it worse?

Because when the switch has been triggered it is only being pulled down with 1K5 which is not as hard as a direct pull to ground therefore making it more prone to interference.

What happened when you tried the fail safe option of having the switch normally connect to ground?

The way I see it you have a grounding problem.

Good point. Do you have any suggestions for how I should filter out the noise?