opto-coupler: transistor vs logic

Here are some pictures of my setup. Inside the yellow electrical enclosure I have an Uno. Plugged into the Uno is a gshield motor controller. In the upper left is a proto board with some screw terminal blocks. Into the top set of screw terminal blocks plug two push-button switches which then go to A0 and A1 on the Uno. The 3 limit switch cables go into the screw terminal blocks on the right side of the proto board. For the limit switches, I have the ground wire and shield connected together in the same opening in the terminal block. On the X-axis limit switch you can see I have a 0.1uF cap, nothing on the other two. On the bottom of the Uno (which you can't see) I have three 330 ohm pull-up resistors for the limit switch lines, which are inputs D9,10,11 and the 5V pin. The limit switches wires actually connect to the gshield, but it's a direct connection down to the Uno via the stacking header. The ground on the proto board (and thus all the limit switches and push-buttons) comes from the ground pin next to D13.
The gsheild is powered by a 24 VDC power supply. The Uno does not get power from the ghsield, instead it's powered by the USB cable from my laptop.
The three stepper motors are connected on the right side of the gshield. The shields are not connected to ground, but they are connected to each other. I initially had the stepper motor shields connected to ground, but this caused the Uno to think the limit switch was activated.

I'm working on a schematic I'll upload shortly.

Edit: The limit switch wires have ferrite chokes right outside the yellow enclosure.