so I was having some trouble with EMI. When the relays or switches were opening there would be a pulse from the coil in the motor that would interrupt the serial communications with the computer. This was the bane of my existence for a while.
I rigged up a couple of limit switches to control the linear actuator that the print head would hit using a bit of gcode. and it was working great. That was untill some one uploaded a file that was way to big for the printer and the print head broke the limit switches. I have been working to make it so that there is a check for the print size to prevent future problems.
Might also get an h bridge motor controller for the linear actuator.