Grbl Settings#

The Grbl firmware has a list of settings that affect the workings of the CNC. It is important to understand that the settings are stored inside the motion controller itself, and not in the sender software. The software just displays them and can help edit them. But if you switch from one software to another, the settings will remain the same.

Displaying all settings ($$)#

The $$ command lists the current Grbl settings. The exact text will depend on the sender software, but it should look something like this:

$0=10 ;Step pulse time, microseconds
$1=255 ;Step idle delay, milliseconds
...
$131=400.000 ;Y-axis maximum travel, millimeters
$132=100.000 ;Z-axis maximum travel, millimeters

Default values#

When you first get a CNC, do not immediately trust the existing settings. Many CNC manufacturers offer multiple models that use the same controller hardware. It is quite common to receive a controller that is configured for another model. This can lead to unexpected results.

Before changing any setting, make a backup of the current values. Print them out with the “$$” command and save them in a text file for safekeeping. Then examine them one by one for any suspicious values.

Here’s a list of the more important ones.

Step idle delay (setting $1)#

This setting allows the motors to power down after the machine has been idle for a while. This is not usually recommended for a CNC machine because it can lead to losing the origin. It is more common for laser cutters or 3D printers where you often want to move the gantry by hand.

The setting works by turning off the ENABLE signal for the motor drivers. Set the value to 255 to disable the feature (motors are always on).

Note: This setting is only relevant for open-loop motors. Closed-loop motors don’t usually use the ENABLE signal and are always powered. They are more efficient at holding their idle position without the need to power down.

Axis movement direction (setting $3)#

Sometimes one or more of your axes may be moving in the wrong direction. For example you press the Left button in the sender software, but the spindle moves to the right.

Setting $3 determines the movement direction for every axis.

$3 ValueX directionY directionZ direction
0+++
1-++
2+-+
3--+
4++-
5-+-
6+--
7---

How to use this table:

  1. Look at your current value for setting $3 and find the row for that value
  2. Change the sign for the axis or multiple axes you want to reverse
  3. Find the row for the new directions
  4. Update setting $3 with the value for that row

Example: Your current value is 4 and you wish to reverse the X axis. Value 4 corresponds to signs "+ + -". You reverse the X sign and get "- + -". Find that combination in the table. It shows that the new value should be 5.

Note: On a dual Y axis machine you can’t use this setting to change the direction of Y1 and Y2 independently. If they are going in opposite directions from each other, you need to look into a hardware solution.
More about it here: What if Y1 and Y2 move in opposite directions

Homing corner (setting $23)#

When performing a homing operation, the machine will move towards one of the 8 corners of the work area. It will use the limit switches to find how far it can move in that direction.

Note: Before changing the homing corner, first make sure that every axis moves in the correct direction. See the previous topic about setting $3.

You can choose the homing corner with setting $23. Use this table:

Homing cornerValue for $23
Top, Rear, Right0
Top, Rear, Left1
Top, Front, Right2
Top, Front, Left3
Bottom, Rear, Right4
Bottom, Rear, Left5
Bottom, Front, Right6
Bottom, Front, Left7

Warning: I recommend you do not use any of the bottom corners, as they will cause the Z axis to go down. This is not always safe. Oftentimes you have a tool mounted in the spindle, which can collide with the work surface.

Additional homing settings (settings $24, $25, $27)#

There are a few settings that control how efficient and how accurate the homing process works.

$24 - the speed for final limit switch test. Lower number will produce more accurate results

$25 - the initial homing speed. Higher value will speed up the initial move towards the homing corner. Too high a speed could damage the limit switches as it slams into them

$27 - pull off distance. The distance to move away from the limit switch after homing. It should be far enough to completely and reliably disengage the switch

Note: Keep in mind that these 3 settings apply to all axes. This is particularly important for machines that combine belts and ballscrews, as they have different max speeds.

Soft limits (setting $20)#

Setting $20 controls the soft limits. Set to 0 to disable and 1 to enable.

When the soft limits are enabled, any move command that uses a target location beyond the work area will raise an alarm and abort the program.

Note: Soft limits require that homing is performed, and that the work area size is set correctly.

Read about homing: Homing the machine
Read about work area size: Work area settings

 Deep Dive: Pros and cons of soft limits

Soft limit Pros

There is only one really, but it is important.

Hitting a soft limit is more gentle than hitting a hard limit. The machine just refuses to move and stops in a controlled way. If a hard limit is hit instead, the machine stops abruptly, which will require homing again.

Soft limit Cons

  1. Unfortunately, the soft limits will not always prevent you from hitting a limit switch. Let’s say your homing location is the usual front left. The lower bound for the X axis is the position where the limit switch was activated. The soft limit will allow you to get up to that point again, which will trigger the limit switch. On the upper end (right side) you can adjust your setting $130 to stay clear of the right limit switch. But this does not protect the lower end.

    Note: I believe newer 32-bit firmware like GrblHAL has a way to keep the lower soft limit away from the limit switches. I have not tested that.

  2. Soft limits may interfere with Z probing close to the surface. A Z probe command specifies the max distance to travel before giving up. Let’s say 30 mm. If the current Z position is closer to the bottom limit than 30 mm, the command will be rejected.
    Read more about this case here: Note on setting $132

  3. Soft limits could interfere with recovery from hitting a limit switch. Let’s say you hit the left limit switch. Normally to recover you just need to clear the alarm, then jog right, then clear the alarm again and rehome. Everything will be back to normal. But if you panic and reset the controller, it will think that the current position is 0 in machine coordinates. 0 is the top soft limit on the X axis. So you won’t be able to jog right at all. Recovery becomes much more difficult. You will have to manually move the axis, or temporarily disable the soft limits.

Bottom line: yay or nay on soft limits?

I personally have soft limits enabled. They help with toolpaths that try to move beyond the valid work area. For a beginner it might make more sense to start them disabled, and then enable them after you learn how to correctly and safely operate the machine.

Hard limits (setting $21)#

Setting $21 controls the hard limits. Set to 0 to disable and 1 to enable.

When the hard limits are enabled, the machine will enter Alarm state if a limit switch is activated. The machine will stop immediately. You will have to clear the alarm and jog the axis in the opposite direction until it clears the switch.

When the hard limits are disabled, hitting a limit switch will do nothing, and the machine may continue to move past the switch. This can cause mechanical damage.

If you have limit switches, it is recommended that you enable this setting.

Note: Disabling the hard limits will not affect homing. The limit switches will still work during the homing process.

Bonus tip Sometimes it is beneficial to temporarily disable the limit switches by setting $21 to 0. This is helpful when performing diagnostics on the limit switches since triggering an alarm every time can get in the way.

Spindle speed (settings $30 and $31)#

Setting $30 is the maximum RPM for the spindle and $31 is the minimum RPM. They only matter when a VFD spindle is used.

Bonus tip You may want to set the low end value $31 to be higher than 0 in case your spindle has a recommended minimum speed. For example air-cooled spindles are cooled by a fan that rotates with the spindle speed. A speed that is too low may provide insufficient cooling and the spindle may overheat.

 Deep Dive: How setting $30 works

It is very important for $30 to match the real maximum speed of the spindle. Otherwise you will get wrong actual RPMs.

That’s because the requested speed is communicated to the VFD as a percentage value and not as an absolute number.

Let’s say the real spindle top speed is 24000, but $30 is set incorrectly to 10000. If the G-code requests a speed of 5000, then it will be converted to 50%, which in practice will mean 12000 (50% of 24000).

Laser mode (setting $32)#

Setting $32 controls how the laser power (or spindle speed) is modulated during move commands. When the machine has to decelerate or turn, the power will be decreased to avoid burning. Also during rapid moves using G0 commands the power is turned off.

This makes sense for lasers, but not for spindles. Set to 0 if using a spindle, especially a VFD spindle.

Steps per mm (settings $100, $101, $102)#

Settings $100, $101, $102 control how many steps it takes for each axis to move by 1 millimeter. It is determined by dividing the number of steps it takes for the motor to make one turn and the number of millimeters the axis moves for one rotation of the motor.

$100 is for the X axis, $101 for Y, and $102 for Z.

Many common motors use 1600 steps per rotation. This number can be changed via switches on the motor driver (for open-loop motors) or the motor itself (for closed-loop motors).

For belt drives, the distance per rotation depends on the belt pitch and the number of teeth on the pulley gear. A common value for many machines is 40 mm of travel per rotation. In that case the step value will be 1600/40, or 40 steps per mm. This is the default value for most belt drives on FoxAlien machines.

For ballscrew drives, the distance depends on the pitch of the screw. Common values are 2, 4, 5 and 10 mm. It can easily be measured, at least approximately, with calipers.

For greater precision you can measure 10 threads instead of 1.

Here are a few example cases:

2 mm pitch => 1600/2 = 800 (e.g. Z axis on FoxAlien Vasto)
4 mm pitch => 1600/4 = 400 (most FoxAlien machines use this value for all 3 axes)
5 mm pitch => 1600/5 = 320 (e.g. X and Y axis on FoxAlien Vasto)
10 mm pitch => 1600/10 = 160 (e.g. X axis on FoxAlien XE-Pro 8040)

Note: Keep in mind that the 3 settings could be different. For example most belt machines still have a screw for their Z axis. Also some ballscrew machines use different screw types for X, Y or Z.

 Deep Dive: To calibrate or not

Many people recommend calibrating the exact steps per mm for each axis based on manual measurements. For belt-driven machines this makes sense, because belt tension or stretching could affect the exact values.

For ballscrew machines I am going to disagree with the common wisdom. The screws are manufactured in a factory under precise conditions. It is highly unlikely that they differ from the designated pitch by any amount that is measurable at home. If it does, chances are it will lead to other problems, like binding, or inconsistent speed across the entire length. Neither of these can be fixed by calibration.

My recommendation instead is to stick to the standard value according to the nominal pitch of the screw - 160, 320, 400, 800.

Now, if you are experiencing cut accuracy issues, there can be multiple causes that are more likely.

  • Loose coupler or other screws
  • Backlash
  • Lost steps
  • Wrong diameter endmill
  • Deflection
  • Runout of the spindle
  • Cut direction

I would try to eliminate any of those before attempting recalibration.

Maximum speed (settings $110, $111, $112)#

These settings determine how fast each axis is allowed to move. $110 is for the X axis, $111 is for Y, and $112 is for Z.

The values are used in 3 cases:

  • When jogging at maximum speed
  • When performing “rapid move” using the G0 command. This happens when moving from one cut area to the next
  • To limit the speed in case a cut operation requests faster speed

Usually the X and Y top speed is the same. Z however can be set lower. The Z axis has to be able to lift the weight of the spindle. Also sometimes the Z axis uses finer pitch ballscrew for better accuracy at the expense of lower speed.

Work area (settings $130, $131, $132)#

These settings represent the dimensions of the work area. $130 is for the X axis (width), $131 is for Y (depth), and $132 is for Z (height).

It is important that the settings reflect the actual range of motion of the machine.

Start with the values that match the advertised work area for the machine, let’s say 800 x 800 x 100 millimeters. You can update the X and Y dimensions later to get the most out of the machine: Determine the real work area

Note: Changing the work area size can shift the origin of the machine coordinate system. It is highly recommended to run the homing process afterwards.

 Deep Dive: Work area size

The work area size is used in 3 cases:

  • To compute the machine zero during homing
  • To determine how far homing will travel before giving up
  • To prevent moves beyond the work area when soft limits are enabled

Note on $132#

It could actually be beneficial to set $132 to a larger value than the physically possible Z travel.

The $132 value is irrelevant in most cases for CNC routers, as they have relatively limited Z travel. The actual limitation comes from how far the tool sticks out of the spindle. It is likely the tool will hit the table well before the bottom limit is triggered.

It is however relevant during Z probing. The sender software issues a Z probing command with a specified maximum distance. The command will be rejected if that distance points below the bottom soft limit, even though in practice the probe will be contacted much earlier.

For example the FoxAlien offline controller uses distance of 100 mm. That means if the soft limits are enabled, the current position needs to be at least 100 mm above the bottom limit, which is unreasonable for a machine with only 90 mm of Z travel.

Therefore my recommendation is to set $132 to a larger number. The “correct” value is not going to stop actual collisions, but it will interfere with legitimate Z probing scenarios.

Discussion#

Comment Form is loading comments...

  © 2026 Ivo Beltchev cnc@ibeltchev.com