Welcome to Our Community

Some features disabled for guests. Register Today.

      1. Build Progress:
        • Build Complete!
      Rate This Build
      5/5,
      3 votes
      Tool Position Setting Part II.


      Z axis height setting.

      For me, it is usual to set the Z axis Zero position to the top surface of the work and an automated setting procedure (Auto Tool Zero) saves a considerable amount of time when working with materials of differing thicknesses. Please note that the following is Mach3 related and all dimensions are in millimeters.

      To achieve this, I have used a ‘Touch Plate’ which is electrically connected to an LPT input pin – this plate is then placed below the cutting tool, the Z axis jogged until the tool is within 15mm of the plate and then by clicking on the Mach3 ‘Auto Tool Zero’ screen button the Z axis is automatically, slowly, lowered until the tool makes electrical contact with the plate. The Z axis is then automatically raised a set distance and the Z axis DRO set to this distance plus the thickness of the touch plate. The plate is then removed and the Z axis DRO now reads the correct tool height above the surface of the work (in my case 5mm).


      t1.jpg



      To protect the delicate cutting edge of my engraving points the ‘touch plate’ I am using is a small piece of copper clad PCB material which has been bonded to, but electrically insulated from, a similar sized brass plate (just to give it a bit of extra weight). One end of the electrical connection is soldered to the PCB whilst the other end is connected to pin 15 of the LPT port then within Mach3, I have configured the ‘Probe’ input to pin 15 (Config / Ports & Pins / Input Pins / Probe) and set it to Active Low. PCB material is ideal for this purpose as the conductive surface, being soft, is extremely kind to the cutting edge of the tool and when the surface does eventually becomes peppered with tiny indentations it is cheap and easy to replace it with another piece. The down side is that copper tarnishes with the passage of time and copper oxide is a pretty good electrical insulator so the plate needs to be kept clean.

      My engraving spindle is of all metal construction and electrically connected to my machine frame (GND) so the cutting tool is always at GND potential. However, when using my Bosch routing spindle (which is fully insulated from the machine frame) it is necessary to temporarily add another lead, which connects the cutting tool to the machine frame (GND), to complete the electrical circuit and enable correct operation. This extra lead is just a short piece of wire with ‘crocodile clips’ each end and can easily be fitted and removed when required.


      t2.jpg



      The standard Mach3 screen already has a VB button intended for the Auto Tool Zero function but I have used one of the free screen designer programs (available from the Artsoft website) to add an additional LED (OemLED (825)). This LED illuminates when the cutting tool makes contact with the plate or, for testing purposes, will illuminate if the plate is touched to the machine frame (GND).


      t3.jpg




      The existing ‘Auto Tool Zero’ button already contains a very simple VB script which will, in many circumstances, work quite well (it may be in Imperial units) but the following script is one, which I have developed over the last couple of years (as Mach3 has evolved through various revisions) and which has some improved functions.

      To use this script - within Mach3, select; Operator / Edit Button Script then click on the flashing Auto Tool Zero button. Delete whatever is already in the VB box then copy and paste the following script into the box and finally save it.



      CurrentAbsInc = GetOemLED (48) 'Copy current G90/G91 state
      CurrentGMode = GetOemDRO (819) 'Copy current G0/G1 state
      CurrentFeed = GetOemDRO (818) 'Copy current feedrate
      Contact = 0 'Clear the contact flag
      PlateThickness = 2.8 'Touch Plate thickness is set here
      ProbeFeed = 40 'Probing feedrate is set here
      SetVar (1, -15) 'Maximum probing distance is set here
      SetVar (2, 5) 'Retract height is set here
      Code "M5" 'Ensures spindle is not running
      Code "G21” ‘Ensure metric units are used
      Zs = GetOemDRO (61) 'Copy current Z-Scale DRO
      Call SetOemDRO (61,1) 'Set Z-Scale DRO to 1
      Label1: 'Entry point for Retry
      DoOemButton (1010) 'Zero Z-Axis DRO
      Code "(Setting Tool Zero)" 'Message for status bar
      While IsMoving () 'Wait until task has been completed
      Wend
      If GetOemLED (825) = 0 Then 'Check to see if touch plate is already grounded
      Code "G90 G31 Z #1 F" & ProbeFeed 'Probing move
      While IsMoving () 'Wait until task has been completed
      Wend
      If GetOemLED (825) = True Then 'Check to see if probe has touched plate
      Contact = 1 'Set the contact flag
      End If
      ProbePos = GetVar (2002) 'Exact point probe touched
      Code "G0 Z" & ProbePos 'Go back to exact point of touch if there was any overrun
      While IsMoving () 'Wait until task has been completed
      Wend
      Call SetDRO (2,PlateThickness) 'Set Z-Axis DRO to Touch Plate thickness
      Code "G0 Z #2" 'Retract off Touch Plate the set distance
      While IsMoving () 'Wait until task has been completed
      Wend
      Code "(Z-Axis is now Zeroed.)" 'Message for status bar
      Code "F" & CurrentFeed 'Restore feedrate to original setting
      If Contact = 0 Then 'Probe reached max travel without touching
      Code "(ERROR - Probe did not touch.)" 'Message for status bar
      Response = MsgBox ("ERROR - Probe did not touch.",37,"Auto Tool Zero")
      If (Response = 4) Then 'User chose Retry
      GoTo Label1 'Retry Probing routine
      End If
      End If
      Else
      Code "(ERROR - Touch Plate is grounded.)" 'Message for status bar
      Response = MsgBox ("ERROR - Touch Plate is grounded.",16,"Auto Tool Zero")
      End If
      Call SetOemDRO (61,Zs) 'Restore Z-Scale DRO to original setting
      If CurrentAbsInc = 0 Then 'If G91 was in effect before then return to it
      Code "G91"
      End If
      If CurrentGMode = 0 Then 'If G0 was in effect before then return to it
      Code "G0"
      End If


      This implementation of Auto Tool Zero relies on having an electrically conductive tip to the cutting tool and as such would not be suitable for use with ceramic or diamond tipped tools. There are other solutions and once I have finalised the design and as time permits I will upload full constructional details of an alternative tool setter which does not have this limitation.

      Some notes regarding this script;

      (1)Although I have, for convenience, referred to the Mach3 scripts as VB (Visual Basic) they are, in fact, a subset of VB known as ‘Cypress Enable’ so those familiar with the VB language may find some of the command functions / statements unusual. To give a better understanding I have added comments to each line.

      (2)Before this script is used the ‘Plate Thickness’ (in line 5) must be changed to the exact thickness of the touch plate you will be using (my touch plate is 2.8mm thick overall).

      (3)All the dimensions and units used are Metric and you may wish to change some of the settings to be more suitable for your own machine.

      For example; I have set the probing feed rate to 40mm/minute, the maximum probe depth to -15mm and the retract height to 5mm (these settings can be altered in lines 6 to 8 of the script).

      (4)When setting up and testing this method for the first time observe caution and do not use one of your best cutting tools – incorrect electrical connection, incorrect Mach3 settings and incorrect copy and pasting or alteration of the script could all cause problems so take care.


      In Part 3. I will discuss Machine Vision and G68 Local System Rotate and how it can be used.


      Just one final note – your personal safety is of paramount importance at all times – always use protective eyewear and never allow hands, fingers or anything else near to a running machine – please do not take any chances.

      Tweakie.
      You, RedNapalm, Rimo and 12 others like this.
  • Loading...
  • Build Details

    Build License:
    • CC - Attribution Share Alike - CC BY SA
  • About Us

    The OpenBuilds Team is dedicated helping you to Dream it - Build it - Share it! Collaborate on our forums and be sure to visit the Part Store for all your Building needs!
  • Like us on Facebook

  • Support Open Source FairShare Program!

    OpenBuilds FairShare Give Back Program provides resources to Open Source projects, developers and schools around the world. Invest in your future by helping others develop theirs!

    Donate to FairShare!