The Q code is used to specify the depth of each peck when peck drilling with either the G73 or G83 code.
The “peck” is how much farther down the machine will drill on each pass.
When peck drilling, the machine drills down, backs up, drills further down, backs up, drills even further down and repeats until the cycle has been completed.
Want to learn more about CNC G Code?
Difference between peck and standard drilling
The main difference between peck and standard drilling is that the peck drilling process removes the material in multiple steps, while standard drilling is a one-step process.
Both commands are intended to make holes, but the peck drilling cycle allows more control over how the hole is drilled.
Peck drilling is the first option for CNC programmers when making blind holes. The pecking process helps break chips as well as remove them and any other debris from the hole during the drilling process.
Trouble removing chips from the hole when drilling can cause size and/or surface finish issues.
Standard drilling is far more common when dealing with simple through (thru) holes.
Types of peck drilling
There are two peck drilling cycles, G73 and G83.
They are both canned cycles with one key difference.
Using the G83 code will retract completely out of the hole after each peck to the retract plane.
Using the G73 code will only retract to the start of each peck.
The G73 canned cycle is a peck drilling cycle but with a shorter retract intended for relatively shallow holes.
Meanwhile, the G83 command is peck drilling with a full retract intended for deep holes.
Both commands are meant to help break and clear chips.
G83 does a better job of this by fully retracting out of the hole but with the added expense of a longer cycle time.
On the other hand, G73 is designed to break up stringy chips, while G83 is intended to pull chips up and out of deep holes.
Other codes used with the Q code
The Q code is used in peck drilling canned cycles G73 and G83.
You can also expect to find the following codes used in those canned cycles:
Format for using the Q code
The format for using a Q code is shown below:
G98 G83 R1.0 Z-5.0 Q1.0 F25.0
This example shows a peck depth (Q) of 1.0.
This means that the machine will drill the hole in 1.0 unit steps. This would be 1 inch or 1mm depending on which unit mode you currently have active.