could be earth leakage, that held me up for a while. It takes very little current to ground a pin. Use a seperate supply like a 'phone charger, feeding your estop and limits, and use it to hold a relay closed. Wire the relay contacts to your logic pins.