A probing yet touching question
I see a lot of questions about probing. There seems to be a belief that it requires special software support in the G code sender. The reality is that for a touch probe, all you need is to be able to send GCode to the controller. And, if your favorite GCoide sender has macro capabilities, then you can put it all in a macro called "probe".
What the heck is probing, anyway?
In the simplest terms, it is a way to find top of a workpiece on your CNC machine. Most Grbl controller breakout boards have an input pin called Probe. This is basically a normally open switch. The simplest probe is called a Touch Probe. It is a metal plate and one half of the switch. The other half is something metal and conductive in the spindle/router chuck - like a router bit. The plate is connected to the probe input pin and the router bit is connect to ground. Touching the bit to the plate closes the circuit and Grbl sees the connection. So, another way to answer the question, probing is just flipping a switch.
How does Grbl use the probe input?
Grbl implements the GCode Straight Probe function, G38. This function uses the Probe input pin and looks for a connection (or disconnection). There are several sub functions of G38 - G38.2 through G38.5. They differ in the direction they move and whether they signal an error. For our purposes, we will only look at G38.2.
G38.2 Z-20 F50
This causes the Z axis to move down at the rate of 50mm per minute until one of two things happens.
The probe input signal occurs (ie, the Probe input pin is connected to ground).
Z has moved 20mm and no probe signal happened. An error is raised.
In either case, the Z axis movement stops. In first case, the value of Z represents the top of the probe plate. If we know the thickness of the plate, we can set Z to that value. This means that Z=0 is at what ever the probe plate was sitting on. Lets say the plate thickness was 6mm. Then we would want to set Z to 6mm. This can be done via the G92 function, Coordinate System Offset.
Note that the distance Z is allowed to travel and the Feed Rate are your choice. You should experiment with different values to see what works for you. You will want to keep the Feed Rate fairly low to avoid stress on the bit and bearings of the router/spindle.
If you remove the probe plate and jog Z lower by 6mm, the bit will be touching what ever the plate was sitting on.
Now, if you don't want to remember all that, you can make a simple macro. Name it ProbeZ and add the two above lines. Be sure to measure the thickness of your probe plate and use that in place of 6.0.
G38.2 Z-20 F50 G92 Z6.0 G0 Z20
The third line raises the Z axis so you can easily remove the probe plate.
One word of caution, always test your probe to make sure it is working before running your macro. You can lift the plate and touch the router bit. Some GCode Senders show the state of the probe pin and some fancier probes have built in LEDs that help you see if it is working.
So, How do I use this?
Probing is a simple process.
Put a metal bit in the spindle and connect it to ground.
Mount your workpiece and position the probe plate on it and make sure it is connected to the probe input pin.
Position the bit less than 20mm above the probe plate.
Run the macro (or type in the two commands).
Remove the probe plate.
Your Z is properly zeroed.
What about other axes?
G38.2 works with any axes. For example, you can probe X and Y to find a corner. You will need to take into account the radius of your bit. This can get fairly complex so you might want to use a GCode Sender that has probing support. Interestingly, every GCode Sender that supports probing, use G38.
Other kinds of probes
There are a lot of different probe devices out there. One is called a Tool Setter (or Tool Height Setter or Tool Length Setter). This allows the machine to determine the offset distance for each tool that a job uses and adapt Z to always have to bit's tip at the correct height. This is another case where you will want a GCode Sender with probe support.
Another type is the 3D probe. This it constructed differently from a touch probe in that it contains the switch and works in 3 dimensions. A common use of a 3D probe is to create height map of a workpiece for adapting GCode to an uneven surface. It is also useful for corner and center finding.
Make your own Touch Probe
A touch probe is very easy to make. It consists of a metal plate with a known/measured thickness and a way to attach a wire. The wire is connected to the probe input pin on the controller. In addition, a second wire that connects to the router bit in the spindle and the ground on the controller. If you have grounded your router's frame, your bit may already be connected to ground. You can test this with a multimeter. If you don't have ground, you can use an alligator clip on the bit and connect it to a ground pin on the controller. I have used double sided PCB material (AKA Copper Clad FR4) for the plate but any flat uniform piece of metal will work.
If you don't have a caliper gauge (AKA Digital Micrometer), you can still measure the thickness of the plate with your machine using the paper method.
Chuck a bit in your spindle.
Place the paper under the bit and lower Z using the smallest step size until the you can't move the paper.
Set Z to 0.
Raise Z enough to slide the probe plate under it.
Place the paper on top of the probe plate.
Lower Z using the smallest increment until you can't move the paper.
The Z value is the height of you probe plate.
I'm Phil Barrett, a long time CNC enthusiast. I run a small company, Brookwood Design, that makes several breakout boards for grblHAL and love to help people get the most out of their CNC machines.