This guide assumes you have your Z touch plate wired and connected to your motion.probe-input
hal pin.
Following Additions are by @kotlikm for use with LinuxCNC and a MESA 7i96. Most of the concepts and information should carry over to other control boards but your mileage may vary.
The following assumes you have a 7i96 with your input common connected to DC- and plan to use a Normally Open (N.O.) touchplate
Run a 2 conduit wire from your enclosure to your CNC machine with enough reach to get to any location on your work area that you may want to probe.
Validate Functionality
When you connect the touch plate and alligator clip, you will see the input led on your MESA light up.
If this does not happen you need to check your wiring. You may have your inputs wired differently to support PNP v NPN sensors.
The following changes wil be required in you LCNC configuration to ensure the touch plate input communicates correctly with the machine to function with the Probe commands.
Add the following to your machines .hal file;
net probe-in => motion.probe-input
net probe-in <= hm2_7i96.0.gpio.005.in
Validate Functionality
After restarting LCNC;
-Within the settings tab of the GUI, open the Hal Meter
-Navigate to the "Signals" tab
-Scroll down to "probe-in"
-Verify the value changes from "False" to "True" when you contact the touch plate with the alligator clip
If this does not occur, verify you are using the correct input callout when assigning the motion.probe-input, you can use the "Pins" tab in the hal meter to verify which input Pin is being triggered by your touch plate.
At this point, your touchplate should be properly functioning and G38 probe commands will now work for you.
Everyone will have their own preffered way of utilizing their touch plate to probe their work piece, below is an example of what works well for me.
The following changes need to be made to your .ini configuration file in order to call macros and sub-routines.
Under the [RS274NGC] section
change/add/use SUBROUTINE_PATH to point to the location where these subroutines are located. In the example below, there is a folder named "macros" in the folder housing the configuration files
[RS274NGC]
.....
SUBROUTINE_PATH = macros
You will want these to be visible when you are in the MDI screen, add the following, and identify the name of the macro as it is saved in the folder;
[MACROS]
...
MACRO = touch_plate_z
Add the following subroutine to your macro folder, when you are in your MDI screen of the GUI, you will be able to press the macro button and perform a Z touch off.
This probe macro will allow for you to use a touch plate to set your Z Zero off the surface of your choosing. It will search at a given feed rate for an initial contact with the touch plate. After initial contact, it will back off the touch plate and probe at a much slower speed identified in the macro to increase the accuracy of the probed value from the second search. The tool will then lift off the touch plate and calculate your new Zero based on the give value of the touch plate thickness and the location at which the second probe contact was made.
o<touch_plate_z> sub
#<PlateThickness> = .2505 ( Thickness of your touh plate when proving in the Z orientation, this is used to re-caluclate your new zero after touching off )
#<FastProbe> = 10 ( This is the probe speed used for your initial search, this should be a slow value to avoid damaging your tool, but doesn not need to "crawl" )
#<SlowProbe> = 5 ( This is the probe speed for the final search, this should be a very slow value to improve the accuracy of the probing )
#<ZProbeRange> = -.50 ( This is the distance the probe will travel on its initial search before erroring out, should be a negative value )
#<ProbeLift> = 0.10 ( This is the distnce the probe will lift off the touch plate prior to starting the second search )
#<ProbeRetract> = 1.00 ( This is the distance the probe will lift from the touch plate after succesful probing to allow for removal of the plate )
( Set current Z position to 0 so that we will always be moving down )
G10 L20 P0 Z0
( Probe quickly for initial contact )
G91
F[#<FastProbe>]
G38.2 Z[#<ZProbeRange>]
( Move off plate for slow search )
F[#<SlowProbe>]
G1 Z[#<Probelift>]
( Pause for 0.5 Sec )
G4 P0.5
( Slow probe search )
g38.2 Z[-2 * #<ProbeLift>]
( Move up to set new zero )
G1 Z[#<ProbeRetract>] F[#<FastProbe>]
( Set Z0 at point where probe triggers with offset of plate thickness)
G10 L20 P0 Z[#<ProbeRetract> + #<PlateThickness>]
o<touch_plate_z> endsub
M2