A lot of G Code… Are you kidding me. I use USG and have a single line of code that I paste in one of the available macro lines, click the button and bingo… perfect zero. Today I experimented with using the same touch plate to set the x and y axis. Guess what, It works that way too. Just need to adjust the values a little and there you have it. An X, Y, Z zeroing set up and the cost was zilch. I hade a small piece of 1/2" thick aluminum and wired it up with some stuff laying around the shop.
Here is the Gcode that will work in Universal Gcode Sender.
M30;G38.2 Z-.5 F1;G92 Z.5;G0 z.25
This line of code will set you units to inches(M30), move the spindle down a maximum of 1/2 inch looking for contact with the touch plate (G38.2 Z-.5 F1), Set the Z axis height to the thickness of the touch plate (G92 Z.5) when it touches the touch plate, then move the spindle up 1/4 inch(G0 z.25).
To use this you will need to edit the G92 Z.5 so that the Z.5 is the thickness of your particular touch plate. If you have a 1/4 inch thick touch plate then you would use Z.25.
To modify the code for use with the x or y axis simply replace all instances of the letter Z with the letter X or Y. I would also suggest that you change the touch plate thickness to 1/2 the diameter of you bit and delete the move command. Here is an example that works for me:
M30;G38.2 X.5 F1;G92 X.0625
This command line moves the spindle a max of 1/2 inch in the X direction (left) looking for the touch plate. When it finds it the spindle stops and it sets the X axis to .0625 which is 1/2 the diameter of a 1/8 inch bit. For a different size bit, simply replace the .0625 to 1/2 the diameter of the bit you are using… To use it with the Y directions just replace all instances of the letter x with the letter y. When using it for Y zero it moves the spindle towards the front of the machine.
Hope this all made sense.
Charley