Skip to content

Auto Z & Corner Finding Touch Plate [Archived]


Please Note

If you are using Mach4 CNC controller software, refer to the Mach4 Auto Z and Corner Finding Touch Plate Instructions in our Mach4 Users Guide.

If you purchased one of our Plug and Play CNC Control Systems, Steps 2-4 below are automatically performed for you when you use our latest Mach3 installer and XML configuration files (version 19.2 or later). Please refer to the Mach3 CNC Software Setup Guide for more information.


Using the Auto Z and Corner Finding Touch Plate with Mach3

Setup of the Auto Z and Corner Finding Touch Plate is fairly straight forward:

  1. Plug in the unit
    1. For our CRP800 Plug and Play CNC Control Systems (both NEMA 23 and NEMA 34), just plug the M12 connector from your touch plate into the appropriate input for configuration file your are using:
      1. For our revision 19.2 configuration files, use the "Aux 2" sensor input (Port #2, Pin #8)
      2. For our revision 16.1 - 18.3 configuration files, use the "Aux 1" sensor input (Port #2, Pin #9)
      3. For earlier revisions of our XML configuration files, use the "Z" sensor input (Port #2, Pin #6)
      4. In either case, you can use a different AUX port if you prefer, although you will then need to re-assign the pin used for the "Probe" function.
    2. For older PMDX-126 based NEMA 34 systems, just connect the two leads on the unit to "Signal" and "Ground" on one of the 3 pin connectors supplied with your panel, and plug into the red input signal board. NOTE, the "Ground" should be the lead connected to the magnet (or clip on older models), while the "Signal" should be the lead going to the brass puck on the touch plate.
    3. For a DIY system based on the PMDX-126 breakout board, just connect the two leads to an input pin and a common on J11.
    4. For a G540 based system, you will need to wire one of the leads to an available input (pins 1 through 4 on the G540), and the other lead to the G540 power supply common (V-, on pin 12 of the G540). NOTE, the V- connection should be the lead connected to the magnet (or clip on older models), while the input pin should be the lead going to the brass puck on the touch plate./li>
  2. Set up the input pin for the "Probe".

    You will need to configure the probe as an active low input on an available open input. The example below shows pin 15 being used, but if you are already using pin 15 for something else (such as a limit switch or estop), you will need to use another available input.

    If you have a CRP800 Plug and Play CNC Control Systems, the probe input should already be set up on Port# 2, Pin# 9 (tied to the "AUX 1" input on your controller), or Pin#6 (in older revisions of our configuration files, tied to the "Z" input on your controller).

    Any changes to pins are made from the Config -> Ports and Pins -> Input Signals tab.

    Mach3 Ports and Pins Tab

  3. Test the input to ensure proper function and pin assignment.

    If you have an Ethernet Smoothstepper (pre-installed in most plug and play packages), go to the diagnostics page under Plugin Control->ESS Data Monitoring. From this menu, you should be able to see an input signal toggle (check mark turn on and off) when you touch the magnet (or clip on older models) to the brass puck of the touch plate. If you do not see the same signal toggling that you assigned to the probe input, you should go back and re-assign the signal. If you do not see a signal toggling at all, contact us before proceeding further.

    Mach3 ESS Diagnostics

  4. Add the Visual basic code to the "Auto Tool Zero" button.
    1. Go to the Operator menu and select "Edit Button Script"; the configurable buttons on the page will start flashing.
    2. Click on the "Auto Tool Zero" button; this will bring up a window with code you can edit.

      Mach3 ESS Diagnostics

    3. Copy the code below into the editor (replacing any existing code):
      ' Auto Z and Corner Finding Touch Plate Script version 1.2 - Avid CNC 2017
      Public TouchPlateHeight, ProbeFeedRate, XProbeDistance, YProbeDistance, ZProbeDistance, TouchPlateWidth, XProbeDirection, YProbeDirection, ZTravelHeight, ZLiftHeight, ToolDiameter As Double 
      Public ProbeX, ProbeY, PauseProbe, Abort, isImperial, isImperialUOM As Boolean
      
      Sub Main
      
          NoPrompt = False            ' False = Use UI to Prompt User for corner finding options
          PauseProbe = True           ' True = Prompt user to rotate tool before X and Y axis probing
          WCSOrigin = 0               ' Default Corner 0=Left/Front 1=Left/Rear 2=Right/Front 3=Right/Rear
      
          ProbeX = False              ' By default, do not probe/zero X (change this to True to change the default)
          ProbeY = False              ' By default, do not probe/zero Y (change this to True to change the default)
      
          ProbeFeedrate = 10          'IPM, Anything from 5-12 IPM will likely work well
      
          TouchPlateHeight = 1            'CRP Touchplate is 1" nominal, can adjust this number to calibrate (usually not required)
          TouchPlateWidth = 2.205         'Width of Touchplate is 2.205" (56mm) wide
          XProbeDistance = 2          'How long to probe X Axis (inches)
          YProbeDistance = 2          'How long to probe Y Axis (inches)
          ZProbeDistance = 2          'How long to probe Z Axis (inches)
          ZTravelHeight = TouchPlateHeight +.125  'How high to lift tool while probing X and Y (inches)
          ZLiftHeight = TouchPlateHeight + .5     'How high to lift tool after script is complete (inches)    
      
      
          ToolDiameter = GetOEMDro(105)   
          isImperial = GetOEMLED(801)
          isImperialUOM = isImperial
          Abort = True
      
          If (GetOEMLED(800)) Then
              Message ("Error: Emergency Mode is Active ")
              Exit Function
          End If
      
          If isImperial = False Then   
              ProbeFeedrate = ProbeFeedrate * 25.4
              XProbeDistance = XProbeDistance * 25.4
              YProbeDistance = YProbeDistance * 25.4
              ZProbeDistance = ZProbeDistance * 25.4
              ZTravelHeight = ZTravelHeight * 25.4
              ZLiftHeight = ZLiftHeight * 25.4
              TouchPlateWidth = TouchPlateWidth * 25.4
              TouchPlateHeight = TouchPlateHeight * 25.4
          End If
      
      
          If NoPrompt = False Then
              Begin Dialog DlgCheckAxis 15,32,215,90,"Select Axes to Auto Zero",.DlgCheckAxis
              OKButton 140,8,40,14
              CancelButton 140,30,40,14
              GroupBox 10,3,45,50,"",.GroupAxesChk
              CheckBox 12,10,30,8,"Z Axis",.ChkBoxZAxis
              CheckBox 12,26,30,8,"X Axis",.ChkBoxXAxis
              CheckBox 125,50,80,8,"Pause Between Axes",.ChkBoxPauseProbe
              CheckBox 12,42,30,8,"Y Axis",.ChkBoxYAxis
              GroupBox 62,3,55,68,"",.GroupAxesChk
      
              OptionGroup .grp1
              OptionButton 65,10,50,8,"Left/Front",.ComboLeftFront
              OptionButton 65,26,50,8,"Left/Rear",.ComboLeftRear
              OptionButton 65,42,50,8,"Right/Front",.ComboRightFront
              OptionButton 65,58,50,8,"Right/Rear",.ComboRightRear
      
              Text 16,75,100,100,"Tool Diameter: ",.TextToolDiaLabel
              TextBox 69,75,30,10,.TextToolDiameter
      
              OptionGroup .grp2
              OptionButton 104,75,35,10,"inches",.UnitImperial
              OptionButton 139,75,35,10,"mm",.UnitMetric
      
              End Dialog
      
              Dim Dlg1 As DlgCheckAxis
      
              Dlg1.TextToolDiameter = ""+ToolDiameter
              Dlg1.grp1 = WCSOrigin 'default is left/front
              Dlg1.grp2 = 0 'default is inches (Imperial)
              If isImperial = False Then
                  Dlg1.grp2 = 1
              End If
              Dlg1.ChkBoxXAxis = ProbeX
              Dlg1.ChkBoxYAxis = ProbeY
              Dlg1.ChkBoxPauseProbe = PauseProbe
              Button = Dialog ( Dlg1 )
              ProbeX = Dlg1.ChkBoxXAxis
              ProbeY = Dlg1.ChkBoxYAxis
          Else
              Select Case WCSOrigin
                  Case 0
                      XProbeDirection = 1
                      YProbeDirection = 1
                  Case 1 
                      XProbeDirection = 1
                      YProbeDirection = -1
                  Case 2
                      XProbeDirection = -1
                      YProbeDirection = -1
                  Case 3
                      XProbeDirection = -1
                      YProbeDirection = 1
              End Select
              Abort = false
          End If 
      
          If ( ProbeX Or ProbeY ) Then
              If Not NoPrompt Then
                  If IsNumeric(Dlg1.TextToolDiameter) Then
                      ToolDiameter = CDbl(Dlg1.TextToolDiameter)
                      If (isImperial And Dlg1.grp2 = 1) Then
                          ToolDiameter = ToolDiameter/25.4
                      End If
                      If (Not isImperial And Dlg1.grp2 = 0) Then
                          ToolDiameter = ToolDiameter*25.4
                      End If
                  Else
                      Code "(Invalid Tool Diameter)"
                      Abort = true
                  End If
              End If
      
              ToolDiameterImperial = ToolDiameter
              If Not isImperial Then
                  ToolDiameterImperial = ToolDiameter/25.4
              End If
              If (Not Abort And ToolDiameterImperial <= 0) Then
                  Code "(Tool Diameter is too small)"
                  Abort = true
              End If
              If (Not Abort And ToolDiameterImperial > 2) Then
                  Code "(Tool Diameter is too large)"
                  Abort = true
              End If
      
              If (Not Abort And Not NoPrompt) Then
                  SetOEMDro(105,ToolDiameter)
              End If
          End If
      
          If Not Abort Then
              Message ("Auto Tool Sequence Activating...")
              AutoZeroMachine
          End If
      End Sub
      
      Sub AutoZeroMachine()
          If GetOEMLED(825) <> 0 Then 'Check to see if the touch plate is already activated
          Code "(Touch plate is already activated, check connection and try again)"
          Else
          FeedCurrent = GetOemDRO(818) 'Get the current settings
          XCurrent = GetDro(0)
          YCurrent = GetDro(1)
          ZCurrent = GetDro(2)
      
          ToolRad = ToolDiameter/2
      
          Code "G4 P1" 'Pause 1sec
          Code "F" &ProbeFeedRate 
      
          'Always probe z
          ZNew = ZCurrent - ZProbeDistance
          Code "G31 Z" &ZNew
          While IsMoving()
          Wend
          SetDro(2,TouchPlateHeight)
          Code "G0 Z" &ZTravelHeight  'rapid move back off plate enough to travel
      
          If ProbeX Then      
              If PauseProbe Then
                  MsgBox "Align Tool Flutes for X-Axis Travel and Press OK"
              End If  
              XNew = XCurrent + (XProbeDistance * XProbeDirection) 'probe vector
              Code "G31 X" &XNew
              While IsMoving() 'wait for the move to finish
              Wend
              SetDro(0,(TouchPlateWidth-ToolRad)*XProbeDirection)
      
              If XProbeDirection = 1 Then
                  Code "G0 X" &(TouchPlateWidth/2)-ToolRad 'Center the tool on touch plate
              Else
                  Code "G0 X" &((TouchPlateWidth/2)-ToolRad)*-1 'Center the tool on touch plate
              End If
          End If
      
          If ProbeY Then
              If PauseProbe Then
                  MsgBox "Align Tool Flutes for Y-Axis Travel and Press OK"
              End If  
              YNew = YCurrent + (YProbeDistance * YProbeDirection) 'probe vector
              Code "G31 Y" &YNew
              While IsMoving() 'wait for the move to finish
              Wend
              SetDro(1,(TouchPlateWidth-ToolRad)*YProbeDirection)
      
              If YProbeDirection = 1 Then
                  Code "G0 Y" &(TouchPlateWidth/2)-ToolRad 'Center the tool on touch plate
              Else
                  Code "G0 Y" &((TouchPlateWidth/2)-ToolRad)*-1 'Center the tool on touch plate
              End If  
          End If
      
          Code "G0 Z" &ZLiftHeight
          Code "F" &FeedCurrent 'restore starting feed rate
          Message ("Auto Tool Sequence Complete.")
      
          End If 
      End Sub
      
      Function DlgCheckAxis( ControlID$, Action%, SuppValue%)
          DlgValue "ChkBoxZAxis", 1
          DlgEnable "ChkBoxZAxis",0
      
          If DlgValue("ChkBoxPauseProbe") = 1  Then   
              PauseProbe = True
          Else
              PauseProbe = False
      
          End If 
      
          If DlgValue("ChkBoxYAxis") = 1 Or DlgValue("ChkBoxXAxis") = 1 Then
              DlgEnable "ComboLeftFront",1
              DlgEnable "ComboLeftRear",1
              DlgEnable "ComboRightFront",1
              DlgEnable "ComboRightRear",1
              DlgEnable "ChkBoxPauseProbe",1
              DlgEnable "TextToolDiameter",1
              DlgEnable "TextToolDiaLabel",1
              DlgEnable "UnitImperial",1
              DlgEnable "UnitMetric",1
          Else 
              DlgEnable "ComboLeftFront",0
              DlgEnable "ComboLeftRear",0
              DlgEnable "ComboRightFront",0
              DlgEnable "ComboRightRear",0
              DlgEnable "ChkBoxPauseProbe",0
              DlgEnable "TextToolDiameter",0
              DlgEnable "TextToolDiaLabel",0
              DlgEnable "UnitImperial",0
              DlgEnable "UnitMetric",0
          End If      
      
          If DlgValue("ChkBoxXAxis") = 1  Then
              ProbeX = True
          Else
              ProbeX = False
          End If
      
          If DlgValue("ChkBoxYAxis") = 1  Then
              ProbeY = True
          Else
              ProbeY = False
          End If
      
          If Action = 3 And ControlID$ = "TextToolDiameter" And Not IsNumeric(DlgText("TextToolDiameter")) Then
              DlgText "TextToolDiameter",""+ToolDiameter
          End If
      
          If Action = 2 Then
              If ControlID$ = "UnitMetric" And isImperialUOM Then
                  ToolDiameter = CDbl(DlgText("TextToolDiameter"))*25.4
                  DlgText "TextToolDiameter",""+ToolDiameter
                  isImperialUOM = false
              End If
              If ControlID$ = "UnitImperial" And Not isImperialUOM Then
                  ToolDiameter = CDbl(DlgText("TextToolDiameter"))/25.4
                  DlgText "TextToolDiameter",""+ToolDiameter
                  isImperialUOM = true
              End If
              If ControlID$ = "Ok" Then
                  Abort = False
                  If DlgValue ("ComboLeftFront") = 1 Then
                      XProbeDirection = 1
                      YProbeDirection = 1 
                  ElseIf DlgValue ("ComboLeftRear") = 1 Then
                      XProbeDirection = 1
                      YProbeDirection = -1 
                  ElseIf DlgValue ("ComboRightRear") = 1 Then
                      XProbeDirection = -1
                      YProbeDirection = -1
                  ElseIf DlgValue ("ComboRightFront") = 1 Then
                      XProbeDirection = -1
                      YProbeDirection = 1
                  End If
              End If
          End If
      End Function
      

      If your CNC control computer is not connected to the internet, you can also download this script to transfer it manually. Once the script is on your control PC, simply open with Notepad and then copy/paste into the editor.

    4. Save the file, exit the editor, and then restart Mach3.
    5. If your machine has an aluminum table top, make sure there is something non-conductive between the z touch assembly and the table top to avoid creating a false signal. Before running the routine for the first time, make sure the emergency stop is accessible in case something is set up incorrectly to avoid over-driving your z axis.