Tool change gcode

Hi all, I’ve been attempting to write the script to leave in Estlcam for bit changes on my Primo. I don’t have working end stops, so this has been a bit of a challenge.
I ran through several iterations this afternoon, but since it’s dark and late for noise, I thought I might share here and get some feed back.

Here’s what I’ve come up with (code below).
There are two weakness, that I can see:

  1. The Zero point (set in Estlcam before generating the gcode) needs to be off of the work piece. I’ve found that with a 1/4" bit, the amount I can raise the gantry over 3/4" material doesn’t allow me to get the bit out. This means that for a one-off item, there’s some guessing about where the material goes and where clamps can fit.
  2. After the bit change, the machine returns to where it was, and zeros the Z axis (using the very cute Tiny Touch Pad). But this assumes that the material at this point in space is still the original height.

Any thoughts are appreciated…

;Change tool:
M05 ; PID, Stop spindle
G00 Z05 F500 ; Raise Z probe off of surface
G60 S0 ; save current position, with z axis lifted
G00 X0.0000 Y0.0000 F2100 ; Goto home position [note: home needs to be off of the work surface]
M00 ; Wait for LCD button press - button press means the bit has been changed
G61 S0 ; return to saved position
G28 Z ; Home, w/zprobe
G92 Z0.5 ; Account for probe thickness (set your thickness)
G00 Z5.0000 F500 ; Raise Z probe off off of surface
M00 ; pause for LCD button press - button press means that everything is good to go
M03 S17000 ; PID, set spindle speed

I have a very primitive bit change system…but it is also very flexible. First, I split my project so that every bit has its own g-code file. That means bit changes occur between g-code files. I use a naming convention to keep everything orderly. I leave the steppers engaged at the end of a g-code run. So in terms of having enough space to change the bit, I can move the router (electronically) wherever it works best to change the bit including towards me off the stock. In the situation where top surface is cut away I will use the spoil board as my reference, not the top of the stock. Steps when using the spoil board as reference:

  • Home Z against the spoil board establishing the spoil board as 0
  • Move the router up the Z thickness of my stock as defined in the CAD file.
  • Set Z= 0 at this point (G92 Z0).
  • Move to XY (0,0)
  • Start the next g-code file.