Anyone have instructions on how to add a toolsetter to the Avid with Mach 4?
This is what I did for an NC touch probe recently. If your toolsetter is NC, you should be able to do the same.
The link to the video: https://www.youtube.com/watch?v=zaKTHx8KF1s&t=235s
The powerpoint document that I show in there is linked in the video description section.
I don’t know what you are trying to do with yours but I added one and have a button to zero the current tool to the spoilboard. If you like I can write up some instructions on how I did it.
Thanks guys! @greenleaf, I don’t want to put you out too much, but if it’s a simple thing for you to do that would be great! Also, what tool setter did you purchase?
Let me know if you want more detail, this is kind of the cliff notes version.
I used this toolsetter: https://www.amazon.com/gp/product/B01MYGDU3K/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1 I got the normally open one, but I think the usually recommendation is for normally closed.
From a hardware point of view I 3dprinted a mounting plate with some screws to tram the setter to be square to my spindle. For wiring I used terminals 11-16 (future input) to connect the signal pins. (see Schematics - CNC Controller Technical Manual)
In general the way I use it is I set up the main sensor to be used as a probe, and the overtravel sensor as my Z-- limit. In normal use added a button to my mach 4 screen which moves the spindle to the setter, and probes to find the height of the setter. Then subtracts the known distance between the setter and the spoilboard to have me zeroed to the spoilboard.
Then to turn it on in mach 4:
Open the plugins menu, choose ESS. Then in the pins config page I made the following labels:
p1-10 high overtravel
p1-11 low NO probe
Then in the input signals tab:
probe1(g31.1) enable, set to NO probe
motor4-- limit, set to overtravel
Then open the reg file editor to create a new variable to save the distance between the tool setter and spoilboard. I called mine “AvidCNC/ToolChange/MTC/Zoffset”
Here is the code that I wrote, but note that this isn’t ready for a straight copy/paste. You will need to adjust variable names to match the names of elements you add with the mach 4 screen editor.
In the scrips for the avidcnc screenset I added this where all the modules are loaded:
local hRegZOffset = mc.mcRegGetHandle(inst, “iRegs0/AvidCNC/ToolChange/MTC/Zoffset”);
local valZOffset = mc.mcRegGetValueString(hRegZOffset);
scr.SetProperty(“droSpoilboardOffset”, “Value”, valZOffset);
I added a DRO readout for the offset and save button with the following code:
local mInst = mc.mcGetInstance(“Save Button”);
local hreg = mc.mcRegGetHandle(mInst, “iRegs0/AvidCNC/ToolChange/MTC/Zoffset”);
local val = scr.GetProperty(“droSpoilboardOffset”,“Value”);
mc.mcRegSetValue(hreg, tonumber(val));
Then the main code was added to a new button for zeroing:
local xProbeLocationInches = 59.75;
local yProbeLocationInches = 52.8058;
local JogFeedIpm = 200;
local FastFeedIpm = 100;
local FastFeedZIpm = 30;
local SlowFeedIpm = 5;
local BackOffInches = 0.2;
local SafeZ = “0.0”;
----Read reg value and update UI----
local mInst = mc.mcGetInstance(“Spoilboard Button”);
local hreg = mc.mcRegGetHandle(mInst, “iRegs0/AvidCNC/ToolChange/MTC/Zoffset”);
local val = mc.mcRegGetValueString(hreg);
scr.SetProperty(“droSpoilboardOffset”, “Value”, tostring(val));
–Save initial state before tool change
local CurAbsMode = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3);
local CurMetricMode = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_6);
local zSoftLimitMode = mc.mcSoftLimitGetState(inst, 2);
local CurFeed = mc.mcCntlGetPoundVar(inst, mc.SV_FEEDRATE);
local CurFeedMode = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_1);
local hregProbeFailureOccurred = mc.mcRegGetHandle(inst, string.format(“ESS/Probe_Failure_Occurred”));
mc.mcSoftLimitSetState(inst, 2, 0);
–Set absolute mode and imperial units.
mc.mcCntlGcodeExecuteWait(inst, “g90 g20”);
– Move to probe location.
mc.mcCntlGcodeExecuteWait(inst, “g53 G1 F”…JogFeedIpm…" Z"…SafeZ);
mc.mcCntlGcodeExecuteWait(inst, “g53 G1 F”…JogFeedIpm…" X"…xProbeLocationInches);
mc.mcCntlGcodeExecuteWait(inst, “g53 G1 F”…JogFeedIpm…" Y"…yProbeLocationInches);
–Set incremental mode.
mc.mcCntlGcodeExecuteWait(inst, “G91”);
– Fast probe, back off, slow probe.
–Clear any previous probe errors
mc.mcRegSetValue(hregProbeFailureOccurred , 0);
mc.mcCntlGcodeExecuteWait(inst, “G31.1 Z-10 F”…FastFeedZIpm);
local iProbeFailureOccurredStateValue = mc.mcRegGetValue(hregProbeFailureOccurred);
if not (iProbeFailureOccurredStateValue == 0) then
wx.wxMessageBox(“failure during probing. error=”…iProbeFailureOccurredStateValue);
goto done;
end
– 0 means a strike happened, -1 and -2 mean no strikes occurred
mc.mcCntlGcodeExecuteWait(inst, “G1 Z”…BackOffInches…" F"…FastFeedZIpm);
mc.mcCntlGcodeExecuteWait(inst, “G31.1 Z-1 F”…SlowFeedIpm);
iProbeFailureOccurredStateValue = mc.mcRegGetValue(hregProbeFailureOccurred);
if not (iProbeFailureOccurredStateValue == 0) then
wx.wxMessageBox(“failure during probing. error=”…iProbeFailureOccurredStateValue);
goto done;
end
–The probe is currently at the top of the Z so we can just set the offset now.
rc = mc.mcAxisSetPos(mInst, 2, tonumber(val));
if (rc ~= mc.MERROR_NOERROR) then
wx.wxMessageBox(“failure setting offset. rc=”…rc);
end
::done::
–Return to safe Z positon
mc.mcCntlGcodeExecuteWait(inst, “g90 g53 G1 F”…FastFeedIpm…" Z"…SafeZ);
–Return to original state.
–mc.mcCntlGcodeExecuteWait(inst, “g”…CurAbsMode);
–mc.mcCntlGcodeExecuteWait(inst, “g”…CurMetricMode);
mc.mcCntlSetPoundVar(inst, mc.SV_FEEDRATE, CurFeed);
mc.mcCntlSetPoundVar(inst, mc.SV_MOD_GROUP_1, CurFeedMode);
mc.mcCntlSetPoundVar(inst, mc.SV_MOD_GROUP_3, CurAbsMode);
mc.mcCntlSetPoundVar(inst, mc.SV_MOD_GROUP_6, CurMetricMode);
mc.mcSoftLimitSetState(inst, 2, zSoftLimitMode);
I know this code isn’t pretty and the instructions leave some stuff to be figured out, but feel free to ask if you have any questions. If you have a 3d printer I can also share the STL file for the mounting plate I made.
This is awesome! Thanks so much for taking the time to write this out for me!
I know I’m a little late to this thread, but I have a similar tool setter and would be interested in you stl file for the mount, also great job detailing the setup.
brian
BasePlate.stl (105.6 KB)
Here is the baseplate I used, but you may want the fusion files instead. One of the parts of this file is you will see there are cavities inside of the file for both m4 nuts and m3 nuts. The idea is when you slice the model for printing you add a pause (M601) before it starts covering up the holes. Then when the printer is paused you insert the nuts so they are encased in the plastic.
I used the m4 holes to grossly secure the tool, but the m3 bolts were for leveling out the tool setter. I used one of the dial indicators in my tramming spindle to make sure that the surface of the setter were perpendicular to the spindle.
I sort of suspect this was overkill but I did enjoy it.
If you need to use a different size or kind of bolt let me know and I can send fusion files so you can make changes directly.
Thank you for the file!