Sunteți pe pagina 1din 26

GRBL Losing Steps ?

5 Simple Tips to Fix It Fast


Is Your CNC losing steps? lines dont connect when they should and do contact when they shouldn't ?
this instructable might help you get rid of that problem !
Step 1: Lower the voltage
Although the GRBL board is marked 12-36V, stepper driver might not like the full 36V for example the A4988 works up to
35V datasheat it all depends on which stepper driver are You using. Look for its datasheet to check the voltage suitable for
it.
If Your using similar power supply to the one i do (my power suppl) use the voltage adjustment potentiometer
I suggest setting just under 30V.
Step 2: Use microstepping

Microstepping reduces the amplitude of the torque variations between steps, which reduces the excitation of the pendulum
resonance, and thus the likelihood that the error angle will get large enough to lose steps.
Very good article on the topic can be found here
To set microstepping just put a jumper(s) in desired position(s) Half step worked for Me just fine. Remember to increase
number of steps per mm or in in grbl setup.
$100=XXX.XXX (x, step/mm)
$101=XXX.XXX (y, step/mm)
$102=XXX.XXX (z, step/mm)
If You use half step You need to double the steps per mm/in
Step 3: Reduce speed of the stepper motors
If You are using leadscrews. Try to set grbl config so that the stepper spins no more than approximately 350rpm.When the
stepper is rotating slower the time betwin steps increases and significantly lowers motor resonance
$110=XXX.000 (x max rate, mm/min) $111=XXX.000 (y max rate, mm/min)
$112=XXX.000 (z max rate, mm/min)
to calculate RPMs you need to know how many mm/in is your stepper moving per one revolution
acceleration should be about 10% lower than the max speed
$120=(XXX-10%).000 (x accel, mm/sec^2) $121=(XXX-10%).000 (y accel, mm/sec^2)
$122=(XXX-10%).000 (z accel, mm/sec^2)
My motors work best at 300 rpms although they can go much faster
Step 4: Use brakes on the motor
Set the step idle delay to 255. This will hold the motor in place when it is not turning. Otherwise the vibrations may cause
a little bit of drift
$1=255 (step idle delay, msec)
Step 5: Use cooling
Stepper drivers have over temperature shutdown protection so if they are off for just a split second You're losing a lot of
steps
Old pc cpu fan blowing directly at the steper drivers radiators will do the job just fine. Remember thy work on 12V so if
you're using more you have to step it down for example by using adjustable step down power Supply module
Step 6: THX
Thac all my tips and tricks. They have solve my problem maybe they will help You too
If im wrong in anything or i did some mistake please correct Me
Thx for reading hope the info becomes useful :)
Why open-loop steppers lose steps, and how to solve the problem
Jan 1, 2005Donald Labriola, P.E. | Motion System Design

Some controller/drive systems can commutate highpole (step) motors to form ac brushless motors.
In a perfect motion system, a motor turns a certain predetermined amount for every unit of electricity it is given. But if the
load on the motor becomes too big, it doesn't matter how much power you try to feed it. Beyond a certain limit — maximum
torque rating — motors can no longer turn. Motions become erratic, severely compromising accuracy. Why? Servo systems
pick up on the resulting error right away, but open-loop systems don't. This is most troublesome when it appears in systems
with stepping drive technology. Stepper systems are designed to provide position control without expensive feedback
where precise motion is a requirement. Exceeding the available torque or other limits causes lost steps — failures to
advance in position that go undetected.

As in the below) half-stepping produces eight steps per electrical rotation — every 45°— while microstepping ranges
from 16 steps per revolution to hundreds or even thousands of points around each electrical rotation.
To move the motor, currents to the stator phase windings are varied so as to produce a rotating magnetic field. The rotor
attempts to align itself with the magnetic field, following the rotation and producing motion. The high pole count of most
stepper motors — 100 poles for a common 1.8° stepper motor — requires 50 full electrical rotations of the phase currents
for one rotor rotation. The phase currents are driven with a sine-cosine signal approximation; that is, one phase is driven
with an approximation of a sine wave while the other is driven with an approximation of a cosine signal.
When full-stepping a motor, there are four full steps per electrical rotation. These may be located either at 0, 90, 180, and
270° in the case of wave stepping (when one phase is on) or at 45, 135, 225, and 315° with two-phases-on stepping. Half-
stepping produces eight steps per electrical rotation — every 45° — while microstepping ranges from 16 steps per
revolution to hundreds or even thousands of points on each electrical rotation. In fact, as we'll discuss further, this is the
capability on which “hybrid stepper” solutions to lost steps are based. A hybrid stepper motor is actually a high pole count
ac synchronous permanent-magnet motor that may be operated down to zero frequency.
Resonance problems
A motor produces torque only when its rotor is not aligned with the stator magnetic field. Torque varies in a roughly
sinusoidal manner with this “error angle.” Two things in a motor combine to effectively form a non-linear spring/mass
rotary pendulum:
• The interaction between the stepper motor stator field and the rotor.
• The rotor's moment of inertia.
Each step or fractional step applied to the motor windings shifts the equilibrium point of the pendulum, establishing a new
error angle. The new error angle results in a new torque point, and the rotor — operating as a spring/mass rotary pendulum
— attempts to follow. If the system is lightly damped (which is common) and the system is given enough time, the rotor
overshoots the equilibrium point, ringing back and forth until it settles in. If the next step occurs when the system has
sufficient speed while going in the opposite direction, then the peak instantaneous torque available may not be sufficient
to keep the rotor within ±180 electrical degrees. When this occurs, the system slips into the adjacent cycle of the error-
torque sine wave. When this happens the stepper, in effect, has just lost four steps. If the rotor is not able to regain
synchronization with the stator, many more steps may be lost.
The motor produces torque only when the rotor is not aligned with the stator magnetic field, varying in a roughly
sinusoidal manner with error angle.
A rotor's ringing as a rotary pendulum — associated with dips in torque available from an open-loop stepper — is commonly
called low-frequency resonance. The motor, applied current, and load all affect this resonant frequency, resulting in low-
frequency resonance usually around 50 to 150 rpm, corresponding roughly to 150 to 500 steps per sec.
Stepper correction
Microstepping reduces the amplitude of the torque variations between steps, which reduces the excitation of the pendulum
resonance, and thus the likelihood that the error angle will get large enough to lose steps. (Note microstepping is most
effective with motors that have been optimized for it. To illustrate, many stepper motors optimized for full stepping have
a detent torque that aids full-step positions, but actually causes significant cogging when microstepping.)
The resolution of microstepping drivers often drops as the rotational speed increases; the reduction in resolution is
inevitable due to the limited bandwidth of both controller and driver. For argument's sake, imagine a designer attempted
to operate a microstepping controller with 40,000 steps per sec at 50 rps (3,000 rpm.) It would then have to output
2,000,000 microsteps per sec to keep all the steps. Even if this were possible, a typical PWM driver only operates at 20 to
40 kHz — so the fine interpolations would never reach the motor. To address this inability to hit every microstep at higher
speeds, the number of microsteps per second is often reduced as the motor speed increases. Transitions between these
different resolutions can cause an impulse in torque to the motor, causing ringing that can result in lost steps.
Instability
There is another torque reduction that takes place at higher speeds, roughly corresponding to the speed at which the
power-supply/driver combination becomes unable to control the current. This, in turn, corresponds to the start of the
parabolic “constant power” portion of the torque curve, called mid-resonance instability. Loss of the ability to control
current occurs when a motor's back-EMF rises to the point where power-supply voltage applied to the driver cannot
overcome both the back-EMF and resistive and inductive drops at the requested current. The current undergoes a 90°
phase lag from the commanded current as the driver switches from current control mode to voltage drive mode.
Any mechanical ringing of the rotor pendulum causes the motor to speed up and slow down, changing both the velocity
and relative angle between the driven field angle and the rotor angle. This changes two things: the magnitude and angle of
the back EMF with respect to the phase of the commanded current. Why does this matter? It can cause the driver to switch
back and forth between voltage mode (full on) and current mode (chopping.) This can reduce the damping of the system,
or even pump up the ringing until the rotor loses sync with the commanded position and loses steps, or stops spinning
altogether. Operation in this speed region may require either mechanical damping or electrical damping to stabilize the
operation of the motor to provide usable torque.
Sudden movements, external forces
Low-frequency resonance and mid-frequency instability are not the only ways to lose steps. The rotary pendulum is also
set into swinging (in other words, becomes excited) by sudden changes in commanded velocity and load. Instabilities can
also be mechanical. Shafts, couplings, and power transmission components between motor and load also act as rotary
springs.
For example, gear trains release the load when changing direction, due to backlash. While the load is uncoupled from the
system, the motor accelerates (because of lower inertia) until the backlash has been taken up. When the gears engage
again, the difference in velocity between the motor and load can reflect excess torque back to the motor. Thus the system
cycles: The motor slows below the speed of the load, again the load decouples, and then the motor speeds up. In some
cases, the change in speed may be enough for the gears to first strike on one face and then rebound and strike on the
opposite side, to repeat several times. The exact timing of the reversal ringing may vary with both the position of the gear
train and with the wear of the gears, making it difficult to choose a stepping sequence that compensates.
A different stability issue arises with belt-driven linear movers. These units experience a resonance, the frequency of which
constantly changes. As anyone who has ever played a stringed instrument (or a rubber band stretched across a cup) can
attest, pitch or resonant frequency can be varied by changing either the string's tension or its length. The motion of a linear
belt mechanism varies both of these. Linear force applied to the carrier and its load is the difference between the tensions
of the two belt halves, while the position of the carrier varies the length of these belt sections. (Note that these same effects
change both the resonance frequency of the belt itself, and that of the belt-load system.) This means that the same move
with the same load and motor may work fine with the system starting at position A but not at position B. And what if the
system carries a varying load? That only complicates the matter further.
Increasing stability
Both mechanical and electrical approaches are used to stabilize stepper motors. Mechanical approaches usually involve
increasing motor rotary inertia to make load variations less significant, or adding damping to the system. Rotary inertia is
increased either by swapping out the motor size or design, or by coupling flywheels to the motor shaft as close to the motor
as possible. A system's mechanical damping is increased by including magnetic dampers, viscous inertial dampers,
ferrofluid, and elastic motor mounts, couplers, and belts.
On the other hand, electronic approaches to increase stability typically measure (directly or indirectly) motor position and
speed. Then current to motor windings is varied in a way that damps the system. These electronic methods include:
• Measuring or estimating the back EMF of each winding (which includes both speed and position information) and
adding a portion of the back EMF signal into the commanded current at each winding
• Modifying driver circuits
• Using position/velocity information to modify the applied pulse train to the stepper motor
• Full servo control of the stepper motor.
More resources — for further reading
Leenhouts, Albert. Step Motor Design Handbook. Kingman: Litchfield Engineering Co., 1990.
Labriola, Don and Dan Jones. “Using Magnetic Gearing Performance from a Compact Integrated Servo.” Proc. of 28th
Incremental Motion Control Systems and Devices. Lebanon: IMCSS, 1999.
Houda, Akihiko. “2-Phase Hybrid Stepping Motor with Keep-in-Step Control.” 28th Incremental Motion Control Systems &
Devices.” Proc. of 28th Incremental Motion Control Systems and Devices. Lebanon: IMCSS, 1999.
Rusu, Calin. “DSP Based Control For the Hybrid Stepper Motor with Field Oriented.” Proc. of 28th Incremental Motion
Control Systems and Devices. Lebanon: IMCSS, 1999.
Leenhouts, Albert. “Step Motors and Gear Play.” Proc. of 29th Incremental Motion Control Systems and Devices. Lebanon:
IMCSS, 1998.
Nordquist, Jack. “Origins and Remedies for Resonant Activities in Step Motor Systems.” Proc. of 26th Incremental Motion
Control Systems and Devices. Lebanon: IMCSS, 1997.
Raj, K., B. Moskowitz, J. Torres, D. Cooper, T. Burke, B. Trudeau. “Performance Characteristics of Ferrofluid Steppers.” Proc.
of 23th Incremental Motion Control Systems and Devices. Lebanon: IMCSS, 1994.
Marushima, K. and Ralph Horber. “Development of a High Performance Sensorimotor with Sensor and Driving Coils.” Proc.
of 23th Incremental Motion Control Systems and Devices. Lebanon: IMCSS, 1994.
Ohm, Dal, and Venkatesh Chava. “Torsional Resonance in Servo Systems and Digital Filters.” Proc. of 23th Incremental
Motion Control Systems and Devices. Lebanon: IMCSS, 1994.
Kruse, David. “BLDC/Stepper Motor Controller for High Performance Incremental Motion.” Proc. of 22nd Incremental
Motion Control Systems and Devices. Lebanon: IMCSS, 1993.
Bodson, Marc, John Chiasson, and Ronald Rekowski. “A State Feedback Tracking Controller for a Permanent Magnet Stepper
Motor.” Proc. of 21st Incremental Motion Control Systems and Devices. Lebanon: IMCSS, 1992.
Jufer, Marcel, and G. Heine. “Hybrid Stepping Motors — 25 Years of Development.” Proc. of 25th Incremental Motion
Control Systems and Devices. Lebanon: IMCSS, 1996.
max step frequency of GRBL Atmega328p
pauljay commented on 13 Oct 2011
Is there anyone who achieves more than 40KHz step frequency of GRBL Atmega328p ?
I have executed several tests changing microstep level and seekrate of each axis.
The fastest one I have succeeded in is 38.4Hkz for each axis.
If I adjust parameters to get faster speed, then interrupt handler routines went wrong.
So the pulses in my osciloscope shows broken steps.
Also the EEPROM data area is broken to show incorrect values. But it shows correctly after reseting Atmega328p board.
chamnit commented on 14 Oct 2011
You're likely hitting the limits of grbl. Simen states that 30kHz is about as high as you can go. Keep in mind that torque drops
significantly as you reduce the microstepping size. In most scenarios, you should have it as high as you can get away with. I
personally run half-steps at most 10kHz, which is slightly louder but I have high torque and can run at higher speeds.
aldenhart commented on 15 Oct 2011
The other thing to note about microstepping is that the supposed accuracy can be illusory. Even if the electrical signal is
exact - and it's not always, depending on the driver you are using - the mechanical / electrical system may well not be
keeping up with it. As you increase the microsteps and necessarily also the step rate the time the (highly inductive)
driver/motor system has to reach full current gets proportionately less. Most drivers do not hit full current in the time
interval allowed, thereby further reducing the torque.
This is particularly true at lower voltages, such as 12v. Higher voltages increase the slew rate and therefore the max current
that can be delivered in that interval. (Ironically, this makes running drivers and motors at higher voltages actually run
cooler as less time is taken in switching).
So if the current can't build up, the motor lags, and the "accuracy" you thought you were getting by upping the microstep
rate is lost. This is a problem with many of the belt driven designs that rely on microsteps for accuracy
pauljay commented on 16 Oct 2011
I agree with Alden. I have tested many stepper drivers including mine. But many drivers lose torque at some point.
The motor voltage I had applied was DC24V. I didn't test with higher voltage. I will try higher voltage input.
One other thing I was curious about is jerky sound during movement in case of high speed seekrate.
I have configured GRBL ( Chamnit version ) as follows.
Microstep : 10
Ball Screwpitch : 10mm
$0=200
$1=200
$2=200
$5=2400 ( seekrate 2400mm/min ) --> 40mm/sec
There is no jerky sound during movement.
But when I apply $5=3600 ( seekrate 3600mm/min ) --> 60mm/sec
It generates a jerky sound during movement. Just one time exactly.
I supposed to capture the pulse train but I couldn't yet.
When I try same configuration on the CNC machine with Mach3, I didn't get such jerky sound at same movement.
Also I tried all previous version ( accellation version GRBL ) but same result I got.
Next week I will try it on my motion controller. And will post the result.
thank you Alden and Chamnit.
By the way, is it better to apply higher voltage to stepper in case of microstepping in general ?
chamnit commented on 16 Oct 2011
You should always try to run just under the highest voltage that your motor drivers can handle. This forces the power out
of the windings faster, which means it will let you run at faster feedrates without losing torque. Also running just under the
maximum voltage prevents damaging your drivers if there is some back EMF somewhere in the system.
What exactly do you mean by jerky motion and by it happening only once? When does it happen? Please try to explain in
detail so I can troubleshoot it.
On Oct 15, 2011, at 9:54 PM, pauljay
reply@reply.github.com
wrote:
I agree with Alden. I have tested many stepper drivers including mine. But many drivers lose torque at some point.
The motor voltage I had applied was DC24V. I didn't test with higher voltage. I will try higher voltage input.
One other thing I was curious about is jerky sound during movement in case of high speed seekrate.
I have configured GRBL ( Chamnit version ) as follows.
Microstep : 10
Ball Screwpitch : 10mm
$0=200
$1=200
$2=200
$5=2400 ( seekrate 2400mm/min ) --> 40mm/sec
There is no jerky sound during movement.
But when I apply $5=3600 ( seekrate 3600mm/min ) --> 60mm/sec
It generates a jerky sound during movement. Just one time exactly.
I supposed to capture the pulse train but I couldn't yet.
When I try same configuration on the CNC machine with Mach3, I didn't get such jerky sound at same movement.
Also I tried all previous version ( accellation version GRBL ) but same result I got.
Next week I will try it on my motion controller. And will post the result.
thank you Alden and Chamnit.
By the way, is it better to apply higher voltage to stepper in case of microstepping in general ?
Reply to this email directly or view it on GitHub:
https://github.com/simen/grbl/issues/41#issuecomment-2418960
pauljay commented on 16 Oct 2011
Thank you for your comment.
Under the condition I have describerd in previous post I have tested fast move. G0 command.
$0=200 ( 10 microstep - 10mm advance in 1 revolution of step motor )
$5=3600 ( 60mm advance in 1 second )
$7=0
$8 ( accel ) = 80
My machine is 300x200x60 ( X/Y/Z mm )
The ball screw is used and LM guide is used for linear motion.
The motor is Tamagawa High Torque 2A 0.8degree Bipolar step motor. The step driver is IMS IM483.
The supply voltage for motor is DC24V.
So when I travel X,Y, there is a jerky sound which resembles a break sound to stop momentarily.
I guess some step pulses are lost in steady state after accel is finished.
For example, when I input G0 X50. It generates the sound in the position around between 20 ~25mm.
Now the X position is 50. And then input G0 X100. Then also it generates the sound in position around 70 ~75mm.
But below 20mm movement, there is no such a jerky sound.
It happens always to move more than 20mm from its current position.
This happens in all of my stepper drivers.
pauljay commented on 16 Oct 2011
I guess this scenario might be applied in the jerky sound.
1. step pulses are generated in accel profile.
2. the stepper reaches a target speed.
3. after that, the step pulses are lost
4. Then step motor stop momentarily
5. Now pulses are applied tagain then motor gets pulses at normal speed.
6. This generates very tough sound because motor starts from stop without accel.
This is my guess so that i supposed to capture the step pulses in my osciloscope.
chamnit commented on 16 Oct 2011
Thanks for the info. What you state is in agreement with a problem at the end of an acceleration, which should end at about
22.5mm from the start position. And your settings seem like they should work on grbl. However, logically, the program
shouldn't be losing steps after acceleration. There must be something else going on here.
Although I have not run at high feedrates that you are trying to achieve. Alden: How fast have you gotten on your CNCs?
Some other questions:
 When you say that you tried this on Mach3 with the same settings. Are they exactly the same? The reason I ask is
if this is an issue with torque.
 Which other versions of grbl have you tried? Simen's master and 0.7b edge?
 Do you have any issues for a longer or shorter motion? Like G0X100 or G0X25? Or even just a little longer like
G0X60?
 Does this jerky sound happen once after it gets past 22.5mm? Or does it do it throughout the rest of motion?
 There is a problem where the settings can get corrupt if you switch versions of grbl. They all use different settings
internally. So just make sure that you re-write them to ensure that they are ok.
I will try to reproduce this problem on my end and see if I find out what's going on. There has been a report about some
jerky motion at the end of acceleration before I had started working on this code. I thought I had fixed it, but it maybe
something inherent in grbl that I overlooked. Pauljay, I'd really like to help you solve this, mainly to fix any grbl bugs before
going to a v1.0.
chamnit commented on 16 Oct 2011
I can't reproduce this error, since my system can't go to the peak speed you have. But, I did try many different scenarios to
see if I can observe it. I don't own an oscilloscope (on the list of things to buy), so I can't actually see the step pulses real
time, only what my CNC mill shows me. When you say you have captured on your oscilloscope, have you actually seen this
pause in step pulses at the end of acceleration? And only there?
pauljay commented on 16 Oct 2011
HI Chamnit and Alden,
I found out it was because of torque. This morning simply I have applied DC36V for step driver and get the result what I
want. No jerky sound during movement. I am using very slow feedrate rather seekrate is high.
I have tested it on Chamnit fork of GRBL.
Also I didn't find long slow decelleration tail.
Thank you Chamnit and Alden.
dmmedia commented on 18 Mar 2012
I have just checked my config in terms of maths and figured out, that 24.8 steps/mm and 2500mm/min seek rate give 62kHz
step rate.
Am I pushing GRBL limits too much? All motions smooth and seems to lose no steps.
Do I understand properly, that those figures do not mean that I achieve 2.5m/min speed, but merely, that my Arduino slows
down?
chamnit commented on 18 Mar 2012
Theoretically, grbl should be able to go up to about a 100kHz step rate, but there are many many other things that can
cause it to choke like the stepper interrupt slowing down the main program (parser and planner) or your motor drivers not
being able to keep up. The biggest issue would crop up in cases of rapid short line segments like on curves or performing
arc motions. Although depending on your system size and acceleration setting, you may never reach your maximum feed
rate and your result might be hidden. If your system can do arcs/curves and work when accelerated all the way to the
maximum feedrate, I would say that you have the fastest confirmed step rate reported so far.
dmmedia commented on 18 Mar 2012
I am sorry. I've just found out, that I've messed m/min with m/sec, which gives humble 1kHz step rate.
mihaisalajan commented on 16 Jun 2016
Hi everyone
I have a small issue. please help me.
I just start using GRBL V0.8 firmware, my board is arduino uno the stepper is a nema14 200 steps /revolution the driver is
a4988, i am turning a screw with 8mm lead that means 25 steps/ mm
but the motor is making a lot of noise and the speed is slow, if i set the steps at 100 steps/mm the axis is moving just fine
without noise and the speed is just right but than when i tell it to move 1 mm it moves 4 mm (!!!obvious!!! ) i tried different
speeds ($4 adn $5 from 100-3600) but nothing changes. i need to mention that i am using grbl controller 3.6.1
i also tried different step pulses ($3) from 3 to 30 still without result
another question how ca i set the tA and tB from picture below at the value of 1µs , I had the impression that this is setup
with the speed adjustment
or is it that tA is $3 command and tB is $4and $5 commands ?
PS please excuse my english is not my native language
oleometal commented on 28 Oct 2016
que tengo que hacer para correr grbl a 100 khz, ??
nececito 500 khz para controlar un servomotor yaskawa.
Configuring Grbl v0.8

Grbl has a system ‘$’-command to tweak the settings and trigger runtime commands. Connect to Grbl using the serial
terminal of your choice (baud rate 9600 unless you changed that in config.h) as 8-N-1 (8-bits, no parity, and 1-stop bit.)
Once connected you should get the Grbl-prompt, which looks like this:
Grbl 0.8c ['$' for help]
Type $ and press enter. You should not see any local echo of the $ and enter, but Grbl should respond with a help message:
$$ (view Grbl settings)
$# (view # parameters)
$G (view parser state)
$N (view startup blocks)
$x=value (save Grbl setting)
$Nx=line (save startup block)
$C (check gcode mode)
$X (kill alarm lock)
$H (run homing cycle)
~ (cycle start)
! (feed hold)
? (current status)
ctrl-x (reset Grbl)
Of these commands, only four of them are used to configure Grbl [$$, $x=value, $N, $Nx=line], while the rest are runtime
commands that either report the current state in Grbl or tweak the behavior.
The four configuration commands: $$, $x=val, $N, $Nx=line
$$ - View Grbl settings, $x=val - Save Grbl setting
When connected to Grbl, type $$ and press enter. Grbl should respond with a list of the current system settings, similar to
as shown in the following. All of these settings are persistent and kept in EEPROM, so if you power down, these will be
loaded back up the next time your power up your Arduino.
$0=755.906 (x, step/mm)
$1=755.906 (y, step/mm)
$2=755.906 (z, step/mm)
$3=30 (step pulse, usec)
$4=500.000 (default feed, mm/min)
$5=500.000 (default seek, mm/min)
$6=28 (step port invert mask, int:00011100)
$7=25 (step idle delay, msec)
$8=50.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
$10=0.100 (arc, mm/segment)
$11=25 (n-arc correction, int)
$12=3 (n-decimals, int)
$13=0 (report inches, bool)
$14=1 (auto start, bool)
$15=0 (invert step enable, bool)
$16=0 (hard limits, bool)
$17=0 (homing cycle, bool)
$18=0 (homing dir invert mask, int:00000000)
$19=25.000 (homing feed, mm/min)
$20=250.000 (homing seek, mm/min)
$21=100 (homing debounce, msec)
$22=1.000 (homing pull-off, mm)
To change e.g. the microseconds step pulse option to 10us you would type this, followed by an enter:
$3=10
If everything went well, Grbl will respond with an 'ok' and this setting is stored in EEPROM and will be retained forever or
until you change them. You can check if Grbl has received and stored your setting correctly by typing $$ to view the system
settings again.
$N - View startup blocks, $Nx=line - Save startup block
$Nx are the startup blocks that Grbl runs everytime you power on Grbl or reset Grbl. In other words, a startup block is a
line of g-code that you can have Grbl auto-magically run to set your g-code defaults, or anything else you need Grbl to do
everytime you start up your machine. At the moment, Grbl will store two blocks of g-code as a system default, but it can
store anywhere from 1 to 5, as a compile-time option (changing config.h and re-compiling).
So, when connected to Grbl, type $N and then enter. Grbl should respond with something short like:
$N0=
$N1=
ok
Not much to go on, but this just means that there is no g-code block stored in line $N0 for Grbl to run upon startup. $N1 is
the next line to be run. (If you re-compile to have more, it will execute in order on to $N4.)
To set a startup block, type $N0= followed by a valid g-code block and an enter. Grbl will run the block to check if it's valid
and then reply with an ok or an error: to tell you if it's successful or something went wrong.
For example, say that you want to use your first startup block $N0 to set your g-code parser modes like G54 work
coordinate, G20 inches mode, G17 XY-plane. You would type $N0=G20 G54 G17 with an enter and you should see an 'ok'
response. You can then check if it got stored by typing $N and you should now see a response like $N0=G20G54G17.
Once you have a startup block stored in Grbl's EEPROM, everytime you startup or reset you will see your startup block
printed back to you and a response from Grbl to indicate if it ran ok. So for the previous example, you'll see:
Grbl 0.8c ['$' for help]
G20G54G17ok
If you have multiple g-code startup blocks, they will print back to you in order upon every startup. And if you'd like to clear
one of the startup blocks, type $N0= without anything following the equal sign.
Also, if you have homing enabled, the startup blocks will execute immediately after the homing cycle, not at startup.
IMPORTANT: Be very careful when storing any motion (G0/1,G2/3,G28/30) commands in the startup blocks. These motion
commands will run everytime you reset or power up Grbl, so if you have an emergency situation and have to e-stop and
reset, a startup block move can and will likely make things worse quickly.
Grbl's $x=val settings and what they mean
$0, $1 and $2 – XYZ, steps/mm
Grbl needs to know how far each step will take the tool in reality. To calculate steps/mm for an axis of your machine you
need to know:
 The mm per revolution of the lead screw
 The full steps per revolution of your steppers (typically 200)
 The microsteps per step of your controller (typically 1, 2, 4, 8, or 16). Tip: Using high microstep values (e.g 16) can
reduce your stepper motor torque, so use the lowest that gives you the desired axes resolution and comfortable
running properties.
The steps/mm can then be calculated like this: steps_per_mm = (steps_per_revolution*microsteps)/mm_per_rev
Compute this value for every axis and write these settings to Grbl.
$3 – Step pulse, microseconds
Stepper drivers are rated for a certain minimum step pulse length. Check the data sheet or just try some numbers. You
want as short pulses as the stepper drivers can reliably recognize. If the pulses are too long you might run into trouble
running the system at high feed rates. Generally something between 5 and 50 microseconds works fine.
$4 and $5 – Default feed and seek rates, mm/min
This setting sets the default seek(G0) and feed rates(G1,G2,G3) after Grbl powers on and initializes. The seek rate (aka
rapids) is used for moving from point A to point B as quickly as possible, usually for traversing into position. The seek rate
should be set at the maximum speed your machine can go in any axes movement. The default feed rate usually does not
enter into the picture as feed rates will generally be specified in the g-code program, but if not, this default feed rate will
be used.
NOTE: In future releases, the default feed rate will be removed. G-code standards do not have a default feed rate
(G1,G2,G3), but error out if there has been no 'F' feed rate command specified. The seek rate (aka rapids) will be updated
so users can specify the maximum speed each axes can move, rather than have just one speed that limits all of them.
$6 – Step port invert mask, int:binary
Some cnc-stepper controllers needs its high-low inputs inverted for both direction and steps. Signal lines are normally held
high or low to signal direction or held high and goes low for a couple of microseconds to signal a step event. To achieve
this, Grbl can invert the output bits to accomodate particular needs. The invert mask value is a byte that is xored with the
step and direction data before it is sent down the stepping port. That way you can use this both to invert step pulses or to
invert one or more of the directions of the axes. The bits in this byte corresponds to the pins assigned to stepping in config.h.
Note that bits 0 and 1 are not used for inversion. Per default bits are assigned like this:
#define X_STEP_BIT 2
#define Y_STEP_BIT 3
#define Z_STEP_BIT 4
#define X_DIRECTION_BIT 5
#define Y_DIRECTION_BIT 6
#define Z_DIRECTION_BIT 7
If you wanted to invert the X and Y direction in this setup you would calculate a value by bitshifting like this (in your favorite
calculating environment):
> (1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)
Which is equal to 96, so issuing this command would invert them:
$6=96
Now when you view the current settings, you should now see this in your invert mask line with the binary representation
of the number (bits 5 and 6 should now show a 1 to indicate inversion.)
$6=96 (step port invert mask. int:1100000)
$7 - Step idle delay, msec
Every time your steppers complete a motion and come to a stop, Grbl will disable the steppers by default. The stepper idle
lock time is the time length Grbl will keep the steppers locked before disabling. Depending on the system, you can set this
to zero and disable it. On others, you may need 25-50 milliseconds to make sure your axes come to complete stop before
disabling. (My machine tends to drift just slightly if I don't have this enabled.) OR, you can always keep your axes enabled
at all times by setting this value to the maximum 255 milliseconds. Again, just to repeat, you can keep all axes always
enabled by setting $7=255.
$8 – Acceleration, mm/sec^2
This is the acceleration in mm/second/second. You don’t have to understand what that means, suffice it to say that a lower
value gives smooooother acceleration while a higher value yields tighter moves and reach the desired feedrates much
quicker. In technical terms, this is the point to point acceleration of your machine, independent of axes. Set this acceleration
value as high as your most limiting axes can let you without losing ANY steps. Usually you'd like to give yourself a little
buffer, because if you lose steps, Grbl has no idea this has happened (steppers are open-loop control) and will keep going.
$9 – Junction deviation, mm
Cornering junction deviation is used by the acceleration manager to determine how fast it can move through a path. The
math is a bit complicated but in general, higher values gives generally faster, possibly jerkier motion. Lower values makes
the acceleration manager more careful and will lead to careful and slower cornering. So if you run into problems where
your machine tries to take a corner too fast, decrease this value to make it slow down. If you want your machine to move
faster through junctions, increase this value to speed it up. For technical people, hit this link to read about Grbl's cornering
algorithm, which accounts for both velocity and junction angle with a very simple, efficient, and robust method.
$10 – Arc, mm/segment
Grbl renders circles and arcs by subdividing them into teeny tiny lines. You will probably never need to adjust this value –
but if you find that your circles are too crude (really? one tenth of a millimeter is not precise enough for you? Are you in
nanotech?) you may adjust this. Lower values gives higher precision but may lead to performance issues.
$11 - N-arc correction, int
This is an advanced setting that shouldn't be changed unless there are circumstances that you need to. To make G02/03
arcs possible in Grbl, Grbl approximates the location of the next arc segment by a small angle approximation. N-arc
correction is the number of approximate arc segments performed before Grbl computes an exact arc segment to correct
for the approximation error drift. Computing these exact locations are computationally expensive, but there are some
extreme cases where the small angle approximations can introduce enough error to be noticeable, like very very small arcs
with a large arc segment length. Change this setting only if find strange problems with arcs, but it's not recommended to
go below 3 because this may lead to buffer starvation, where the axes slow down and hiccup. But, results can vary.
$12 - N-decimal, int
Set how many decimal places all of the floating point values Grbl reports. Not much more complicated than that.
$13 - Report inches, bool
Grbl v0.8 has a real-time positioning reporting feature to provide a user feedback on where the machine is exactly at that
time. By default it is set to report in mm, but by sending a $13=1command, you send this boolean flag to true and the status
reporting feature will now report in inches. $13=0 to set back to mm.
$14 - Auto start, bool
In a more professional CNC environment, pros start a job by loading up their program and then pressing the 'cycle start'
button on their machine. It begins the job. Grbl does the same thing, but not by default. As a learning tool, we 'auto-cycle
start' any g-code command that user sends to Grbl, for just jogging the machine to see if move in the direction they think
it should go, or just seeing with what their machine can do. This makes it easier to load up your machine with Grbl and pick
up on how it works, rather than having to diligently hit 'cycle start' anytime you want to move any your axes. Once you
learn your machine and get a good handle on g-code, you can disable the 'auto cycle-start' feature by sending
Grbl $14=0 command. (May need a soft-reset or power cycle to load the change.)
Another way of saying that might be:
If $14=0 then some gcode commands like Xn, Yn etc. won't happen when you enter them at a serial terminal. If $14=1 then
the gcode motion commands will happen.
Apparently big cnc's won't execute gcode until the operator presses a 'cycle start' button. The gcode commands were
received but queued and awaiting the 'cycle start' button. Makes sense yes? When $14=0 then that's how grbl acts too.
You need the button! (in which case attach the feed-hold button too!).
When $14=1 then the grbl software automatically presses a software version of the 'cycle start' for you each time you
'enter' a gcode command line via a serial terminal. This is done to make it more convenient for you to enter commands and
see something happen without having to push the button.
$15 - Invert step enable, bool
By default, the stepper enable pin is high to disable and low to enable. If your setup needs the opposite, just invert the
stepper enable pin by typing $15=1. Disable with $15=0. (May need a power cycle to load the change.)
$16 - Hard limits, bool
Hard limit switches are a safety feature to help prevent your machine from traveling way too far off the ends of travel and
crashing or breaking something expensive. Basically you wire up some switches (mechanical or optical) near the end of
travel of each axes, or where ever you feel like there might be trouble if your program moves too far to where it shouldn't.
When the switch triggers, it will immediately stop all motion, shutdown the coolant and spindle (if connected), and go into
alarm mode, which forces you to check your machine and reset everything.
To use hard limits with Grbl, the limit pins are held high with an internal pull-up resistor, so all you have to do is wire in a
normally-open switch with the pin and ground and enable hard limits with $16=1. That's it. (Disable with $16=0) If you want
a limit for both ends of travel of one axes, just wire in two switches in parallel with the pin and ground, so if either one of
them trips, it triggers the hard limit.
Just know, that a hard limit event is considered to be critical event, where steppers immediately stop and will have likely
lost steps. Grbl doesn't have any feedback on position, so it can't guarantee it has any idea where it is. So, if a hard limit is
triggered, Grbl will go into an infinite loop ALARM mode, giving you a chance to check your machine and forcing you to
reset Grbl. Remember it's a purely a safety feature.
If you have issues with the hard limit switch constantly triggering after you reset, a soft-reset will reset Grbl into an alarm
state, where you can access the settings and Grbl commands, but all g-codes and startup blocks will be locked out. So you
can disable the hard limits setting and then $X unlock the alarm. Or, you can wire in a normally-closed switch in series with
ground to all the limit switches to disconnect the switches temporarily so you can have Grbl move your axes off the switches.
$17 - Homing cycle, bool
Ahh, homing. Something that has been sorely needed in Grbl for a long time. It's now fully supported in v0.8. For those just
initiated into CNC, the homing cycle is used to accurately and precisely locate position zero on a machine (aka machine
zero) everytime you startup your Grbl between sessions. In other words, you know exactly where you are at any given time,
every time. Say you start machining something or are about to start the next step in a job and the power goes out, you re-
start Grbl and Grbl has no idea where it is. You're left with the task of figuring out where you are. If you have homing, you
always have the machine zero reference point to locate from, so all you have to do is run the homing cycle and resume
where you left off.
To set up the homing cycle for Grbl, you need to have limit switches in a fixed position that won't get bumped or moved,
or else your reference point gets messed up. Usually they are setup in the farthest point in +x, +y, +z of each axes. Wire
your limit switches in with the limit pins and ground, just like with the hard limits, and enable homing. If you're curious, you
can use your limit switches for both hard limits AND homing. They play nice with each other.
By default, Grbl's homing cycle moves the Z-axis positive first to clear the workspace and then moves both the X and Y-axes
at the same time in the positive direction. To set up how your homing cycle behaves, there are more Grbl settings down
the page describing what they do (and compile-time options as well.)
Also, one more thing to note, when homing is enabled. Grbl will lock out all g-code commands until you perform a homing
cycle. Meaning no axes motions, unless the lock is disabled ($X) but more on that later. Most, if not all CNC controllers, do
something similar, as it mostly a safety feature to help users from making positioning mistake, which is very easy to do and
be saddening when a mistake ruins a part. If you find this annoying or find any weird bugs, please let us know and we'll try
to work on it so everyone is happy. :)
NOTE: Check out config.h for more homing options for advanced users. You can disable the homing lockout at startup,
configure which axes move first during a homing cycle and in what order, and more.
$18 - Homing dir invert mask, int:binary
By default, Grbl assumes your homing limit switches are in the positive direction, first moving the z-axis positive, then the
x-y axes positive before trying to precisely locate machine zero by going back and forth slowly around the switch. If your
machine has a limit switch in the negative direction, the homing direction mask can invert the axes direction. It works just
like the invert stepper mask, where all you have to do set the axis direction pins to 1 that you want to invert and that axes
will now search for the limit pin in the negative direction.
$19 - Homing feed, mm/min
The homing cycle first searches for the limit switches at a higher seek rate, and after it finds them, it moves at a slower feed
rate to hone into the precise location of machine zero. Homing feed rate is that slower feed rate. Set this to whatever rate
value that provides repeatable and precise machine zero locating.
$20 - Homing seek, mm/min
Homing seek rate is the homing cycle search rate, or the rate at which it first tries to find the limit switches. Adjust to
whatever rate gets to the limit switches in a short enough time without crashing into your limit switches if they come in too
fast. This seek rate behaves a little differently than the main stepper driver. Instead of the rate from point to point, it just
moves all of the axes at the same individual rate, regardless of how many axes are moving at the same time. So, the XY seek
move will seem to move about 41% faster than if you would move it with a G1 command. (You can disable this in config.h
if it bothers you. It's there to speed up the homing cycle.)
$21 - Homing debounce, ms
Whenever a switch triggers, some of them can have electrical/mechanical noise that actually 'bounce' the signal high and
low for a few milliseconds before settling in. To solve this, you need to debounce the signal, either by hardware with some
kind of signal conditioner or by software with a short delay to let the signal finish bouncing. Grbl performs a short delay
only homing when locating machine zero. Set this delay value to whatever your switch needs to get repeatable homing. In
most cases, 5-25 milliseconds is fine.
$22 - Homing pull-off, mm
To play nice with the hard limits feature, where homing can share the same limit switches, the homing cycle will move off
the all of the limit switches by this pull-off travel after it completes. In other words, it helps to prevent accidental triggering
of the hard limit after a homing cycle.
The homing seek rate setting controls how quickly the pull-off maneuver moves, like a G1 command.

Grbl Internal Commands:


Technically, the remaining Grbl commands are not configuration commands, but we're going to explain them here for no
good reason, other than for completeness.
The three current state commands: $G, $#, ?
Grbl provides three commands to report its current state and where it is. Of the three, one of them is real-time, responding
with current position. The other two are not, but respond with how incoming blocks are going to be processed depending
on the states set by g-code, settings, or switches. The reason they are not realtime is that Grbl has an internal buffer that
stores and plans the buffered motions. The incoming gcode blocks just tack on a new motion at the end of the buffer when
it has room. The buffer basically ensures Grbl motion move at the fastest and safest rates possible, constantly re-calculating
it real-time as motions finish and new ones come in.
$G - View gcode parser state
This command prints all of the active gcode modes that the parser will interpret any incoming command. These modes
include G20/G21 inches/mm mode, G54-G59 active work coordinate system, G0/G1/G2/G3 active motion mode,
G17/G18/G19 active plane selection, G90/G91 absolute mode, G93/G94 inverse feed rate mode, M0/M1/M2 program flow,
M3/M4/M5 spindle state, M8/M9 coolant state, T tool number, and F active feed rate. It will also list any active $Sx Grbl
switches, like $S1 block delete. When called, Grbl will return a line like this:
[G0 G54 G17 G21 G90 G94 M0 M5 M9 T0 F500.000]
$# - View gcode parameters
G-code parameters generally store the G54-G59 work coordinate offsets and G28/G30 home positions (must not be
confused with homing and machine zero. These home positions can be set anywhere in the machine space by the
G28.1/G30.1 commands). Most of these parameters are directly written to EEPROM anytime they are changed and are
persistent. Meaning that they will remain the same, regardless of power-down, until they are explicitly changed.
G54-G59 work coordinates can be changed via the G10 L2 Px or G10 L20 Px command defined by the NIST gcode standard
and the EMC2 (linuxcnc.org) standard. G28/G30 home positions can be changed via the G28.1 and the G30.1 commands,
respectively. Please note that G92 is not persistent or held in EEPROM per g-code standards, and will reset to zero when
Grbl is reset. Please read these g-code standard to understand how they are used.
When $# is called, Grbl will respond with the stored offsets from machine coordinates for each system as follows.
[G54:4.000,0.000,0.000]
[G55:4.000,6.000,7.000]
[G56:0.000,0.000,0.000]
[G57:0.000,0.000,0.000]
[G58:0.000,0.000,0.000]
[G59:0.000,0.000,0.000]
[G28:1.000,2.000,0.000]
[G30:4.000,6.000,0.000]
[G92:0.000,0.000,0.000]
For the most part, these offset are not particularly useful unless you have homing enabled. If you do have homing enabled,
these are wonderfully awesome, because once you home, you can always move back to same stored position by using the
work coordinate systems within the accuracy of your machine. Or if you are making multiple parts and have a tool path for
just one part, all you have to do is setup your work coordinate systems to the location where the next part is going to be
made and re-run that same code.
? - Current status
The ? command immediately returns Grbl's active state and the real-time current position, both in machine coordinates
and work coordinates. This may be sent at any time and works asynchronously with all other processes that Grbl is doing.
The $13 Grbl setting determines whether it reports millimeters or inches. When ? is pressed, Grbl will immediately reply
with something like the following:
<Idle,MPos:5.529,0.560,7.000,WPos:1.529,-5.440,-0.000>
The active states Grbl can be in are: Idle, Queue, Run, Hold, Home, Alarm, Check
 Idle: All systems are go and it's ready for anything.
 Queue: Motion(s) are queued in the planner buffer waiting for a cycle start command to be issued. Certain
processes like check g-code mode can't run while something is queued. Reset to clear the queue.
 Run: Indicates a cycle is running.
 Hold: A feed hold is in process of executing, or slowing down to a stop. After the hold is complete, Grbl will enter a
Queue state, waiting for a cycle start to resume the program.
 Home: In the middle of a homing cycle. NOTE: Positions are not updated live during the homing cycle, but they'll
be set to [0,0,0] once done.
 Alarm: This indicates something has gone wrong or Grbl doesn't know its position. This state locks out all g-code
commands, but allows you to interact with Grbl's settings if you need to. '$X' kill alarm lock releases this state and
puts Grbl in the Idle state, which will let you move things again. As said before, be cautious of what you are doing
after an alarm.
 Check: Grbl is in check g-code mode. It will process and respond to all g-code commands, but not motion or turn
on anything. Once toggled off with another '$C' command, Grbl will reset itself.
Other Commands $C $X $H ~ ! Ctrl-X
$C - Check gcode mode
This toggles the Grbl's gcode parser to take all incoming blocks process them completely, as it would in normal operation,
but it does not move any of the axes, ignores dwells, and powers off the spindle and coolant. This is intended as a way to
provide the user a way to check how their new g-code program fares with Grbl's parser and monitor for any errors. (And
eventually this will also check for soft limit violations.)
When toggled off, Grbl will perform an automatic soft-reset (^X). This is for two purposes. It simplifies the code
management a bit. But, it also prevents users from starting a job when their g-code modes are not what they think they
are. A system reset always gives the user a fresh, consistent start.
NOTE: Eventually, the check gcode mode could be re-factored to allow for a "program resume" feature in Grbl. This means
that Grbl could start a g-code program anywhere. It would internally go through all of the g-code program up to the desired
mid-program resume point to set all of the parser states and locations, move to that start point, and begin
executing/moving from that point on. For example, say you had to E-stop in the middle of a program because you forgot
something or you have the wrong tool in the spindle. Your part is fine and need to restart the program. Right now, you'll
have to start the program from the beginning and let it physically move and run up to the point where you e-stopped. If
you have a long program, this could take a while. Instead, a "program resume" will just go through the beginning of the
program internally, without moving anything, and only begin moving from the resume point on.
$X - Kill alarm lock
Grbl's alarm mode is a state when something has gone critically wrong, like a hard limit or an abort during a cycle, or if Grbl
doesn't know its position. By default, if you have homing enabled and power-up the Arduino, Grbl enters the alarm state,
because it does not know its position. The alarm mode will lock all g-code blocks until the '$H' homing cycle has been
performed. Or if a user needs to override the alarm lock to move their axes off their limit switches, for example, '$X' kill
alarm lock will override the locks and allow g-code functions to work again.
But, tread carefully!! This should only be used in emergency situations. The position has likely been lost, and Grbl may not
be where you think it is. So, it's advised to use G91 incremental mode to make short moves. Then, perform a homing cycle
or reset immediately afterwards.
$H - Run homing cycle
This command is the only way to perform the homing cycle in Grbl. Previously, G28 and G30 would automatically start the
homing cycle, but this is incorrect according to the g-code standards. Homing is a completely separate command handled
by the controller. G28 and G30 only move to a 'home'/pre-defined position that is stored in the g-code parameters, which
can be located anywhere in the machine.
TIP: After running a homing cycle, rather jogging manually all the time to a position in the middle of your workspace volume.
You can set a G28 or G30 pre-defined position to be your post-homing position, closer to where you'll be machining. To set
these, you'll first need to jog your machine to where you would want it to move to after homing. Type G28.1 (or G30.1) to
have Grbl store that position. So then after '$H' homing, you could just enter 'G28' (or 'G30') and it'll move there auto-
magically. In general, I would just move the XY axis to the center and leave the Z-axis up. This ensures that there isn't a
chance the tool in the spindle doesn't catch on anything.
~ - Cycle start
This is the cycle start or resume command that can be issued at any time, as it is a real-time command. When Grbl has
motions queued in its buffer and is ready to go, the ~ cycle start command will start executing the buffer and Grbl will begin
moving the axes. However, by default, auto-cycle start is enabled, so new users will not need this command unless a feed
hold is performed. When a feed hold is executed, cycle start will resume the program. Cycle start will only be effective when
there are motions in the buffer ready to go and will not work with any other process like homing.
! - Feed hold
The feed hold command will bring the active cycle to a stop via a controlled deceleration, so not to lose position. It is also
real-time and may be activated at any time. Once finished or paused, Grbl will wait until a cycle start command is issued to
resume to program. Feed hold can only pause a cycle and will not affect homing or any other process.
If you need to stop a cycle mid-program and can't afford losing position, perform a feed hold to have Grbl bring everything
to a controlled stop. Once finished, you can then issue a reset. Always try to execute a feed hold whenever the machine is
running before hitting reset, except of course if there is some emergency situation.
Ctrl-x - Reset Grbl
This is Grbl's soft reset command. It's real-time and can be sent at any time. As the name implies, it resets Grbl, but in a
controlled way, retains your machine position, and all done without powering down your Arduino. The only times a soft-
reset could lose position is when problems like if the steppers were killed while they were moving. If so, it will report if
Grbl's tracking of the machine position has been lost. This is because an uncontrolled deceleration can lead to lost steps,
and Grbl has no feedback to how much it lost (this is the problem with steppers in general). Otherwise, Grbl will just re-
initialize, run the startup lines, and continue on its merry way.
Please note that it's recommended to do a soft-reset before starting a job. This guarantees that there aren't any g-code
modes active that should be from playing around or setting up your machine. So, your machine will always starts fresh and
consistently, and your machine does what you expect it to.
Configuring Grbl v0.9
Getting Started
First, connect to Grbl using the serial terminal of your choice.
Set the baud rate to 115200 as 8-N-1 (8-bits, no parity, and 1-stop bit.)
Once connected you should get the Grbl-prompt, which looks like this:
Grbl 0.9i ['$' for help]
Type $ and press enter to have Grbl print a help message. You should not see any local echo of the $ and enter. Grbl should
respond with:
$$ (view Grbl settings)
$# (view # parameters)
$G (view parser state)
$I (view build info)
$N (view startup blocks)
$x=value (save Grbl setting)
$Nx=line (save startup block)
$C (check gcode mode)
$X (kill alarm lock)
$H (run homing cycle)
~ (cycle start)
! (feed hold)
? (current status)
ctrl-x (reset Grbl)
The ‘$’-commands are Grbl system commands used to tweak the settings, view or change Grbl's states and running modes,
and start a homing cycle. The last four non-'$' commands are realtime control commands that can be sent at anytime, no
matter what Grbl is doing. These either immediately change Grbl's running behavior or immediately print a report of the
important realtime data like current position (aka DRO).
Grbl Settings
$$ - View Grbl settings
To view the settings, type $$ and press enter after connecting to Grbl. Grbl should respond with a list of the current system
settings, as shown in the example below. All of these settings are persistent and kept in EEPROM, so if you power down,
these will be loaded back up the next time you power up your Arduino.
$0=10 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=6 (dir port invert mask:00000110)
$4=0 (step enable invert, bool)
$5=0 (limit pins invert, bool)
$6=0 (probe pin invert, bool)
$10=3 (status report mask:00000011)
$11=0.020 (junction deviation, mm)
$12=0.002 (arc tolerance, mm)
$13=0 (report inches, bool)
$20=0 (soft limits, bool)
$21=0 (hard limits, bool)
$22=0 (homing cycle, bool)
$23=1 (homing dir invert mask:00000001)
$24=50.000 (homing feed, mm/min)
$25=635.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=1.000 (homing pull-off, mm)
$100=314.961 (x, step/mm)
$101=314.961 (y, step/mm)
$102=314.961 (z, step/mm)
$110=635.000 (x max rate, mm/min)
$111=635.000 (y max rate, mm/min)
$112=635.000 (z max rate, mm/min)
$120=50.000 (x accel, mm/sec^2)
$121=50.000 (y accel, mm/sec^2)
$122=50.000 (z accel, mm/sec^2)
$130=225.000 (x max travel, mm)
$131=125.000 (y max travel, mm)
$132=170.000 (z max travel, mm)
$x=val - Save Grbl setting
The $x=val command saves or alters a Grbl setting, which can be done manually by sending this command when connected
to Grbl through a serial terminal program, but most Grbl GUIs will do this for you as a user-friendly feature.
To manually change e.g. the microseconds step pulse option to 10us you would type this, followed by an enter:
$0=10
If everything went well, Grbl will respond with an 'ok' and this setting is stored in EEPROM and will be retained forever or
until you change them. You can check if Grbl has received and stored your setting correctly by typing $$ to view the system
settings again.

Grbl's $x=val settings and what they mean


NOTE: Settings numbering has changed since v0.8c for future-proofing purposes.
$0 – Step pulse, microseconds
Stepper drivers are rated for a certain minimum step pulse length. Check the data sheet or just try some numbers. You
want the shortest pulses the stepper drivers can reliably recognize. If the pulses are too long, you might run into trouble
when running the system at very high feed and pulse rates, because the step pulses can begin to overlap each other. We
recommend something around 10 microseconds, which is the default value.
$1 - Step idle delay, msec
Every time your steppers complete a motion and come to a stop, Grbl will delay disabling the steppers by this value. OR,
you can always keep your axes enabled (powered so as to hold position) by setting this value to the maximum 255
milliseconds. Again, just to repeat, you can keep all axes always enabled by setting $1=255.
The stepper idle lock time is the time length Grbl will keep the steppers locked before disabling. Depending on the system,
you can set this to zero and disable it. On others, you may need 25-50 milliseconds to make sure your axes come to a
complete stop before disabling. This is to help account for machine motors that do not like to be left on for long periods of
time without doing something. Also, keep in mind that some stepper drivers don't remember which micro step they stopped
on, so when you re-enable, you may witness some 'lost' steps due to this. In this case, just keep your steppers enabled
via $1=255.
$2 – Step port invert mask:binary
This setting inverts the step pulse signal. By default, a step signal starts at normal-low and goes high upon a step pulse
event. After a step pulse time set by $0, the pin resets to low, until the next step pulse event. When inverted, the step pulse
behavior switches from normal-high, to low during the pulse, and back to high. Most users will not need to use this setting,
but this can be useful for certain CNC-stepper drivers that have peculiar requirements. For example, an artificial delay
between the direction pin and step pulse can be created by inverting the step pin.
This invert mask setting is a value which stores the axes to invert as bit flags. You really don't need to completely understand
how it works. You simply need to enter the settings value for the axes you want to invert. For example, if you want to invert
the X and Z axes, you'd send $2=5 to Grbl and the setting should now read $2=5 (step port invert mask:00000101).
Setting Value Mask Invert X Invert Y Invert Z

0 00000000 N N N

1 00000001 Y N N

2 00000010 N Y N

3 00000011 Y Y N

4 00000100 N N Y

5 00000101 Y N Y
Setting Value Mask Invert X Invert Y Invert Z

6 00000110 N Y Y

7 00000111 Y Y Y
$3 – Direction port invert mask:binary
This setting inverts the direction signal for each axis. By default, Grbl assumes that the axes move in a positive direction
when the direction pin signal is low, and a negative direction when the pin is high. Often, axes don't move this way with
some machines. This setting will invert the direction pin signal for those axes that move the opposite way.
This invert mask setting works exactly like the step port invert mask and stores which axes to invert as bit flags. To configure
this setting, you simply need to send the value for the axes you want to invert. Use the table above. For example, if want
to invert the Y axis direction only, you'd send $3=2 to Grbl and the setting should now read $3=2 (dir port invert
mask:00000010)
$4 - Step enable invert, bool
By default, the stepper enable pin is high to disable and low to enable. If your setup needs the opposite, just invert the
stepper enable pin by typing $4=1. Disable with $4=0. (May need a power cycle to load the change.)
$5 - Limit pins invert, bool
By default, the limit pins are held normally-high with the Arduino's internal pull-up resistor. When a limit pin is low, Grbl
interprets this as triggered. For the opposite behavior, just invert the limit pins by typing $5=1. Disable with $5=0. You may
need a power cycle to load the change.
NOTE: If you invert your limit pins, you will need an external pull-down resistor wired in to all of the limit pins to prevent
overloading the pins with current and frying them.
$6 - Probe pin invert, bool
By default, the probe pin is held normally-high with the Arduino's internal pull-up resistor. When the probe pin is low, Grbl
interprets this as triggered. For the opposite behavior, just invert the probe pin by typing $6=1. Disable with $6=0. You may
need a power cycle to load the change.
NOTE: If you invert your probe pin, you will need an external pull-down resistor wired in to the probe pin to prevent
overloading it with current and frying it.
$10 - Status report mask:binary
This setting determines what Grbl real-time data it reports back to the user when a '?' status report is sent. By default, Grbl
will send back its running state (can't be turned off), machine position, and work position (machine position with coordinate
offsets and other offsets applied). Three additional reporting features are available that are useful for interfaces or users
setting up their machines, which include the serial RX buffer, planner block buffer usage, and limit pin states (as high or
low, shown in the order ZYX).
To set them, use the table below to determine what data you'd like Grbl to send back. Select the report types you'd like to
see in the status reports and add their values together. This is the value you use to send to Grbl. For example, if you need
machine and work positions, add the values 1 and 2 and send Grbl $10=3 to set it. Or, if you need machine position only
and limit pin state, add the values 1 and 16 and send Grbl $10=17.
In general, keep this real-time status data to a minimum, since it takes resources to print and send this data back at a high
rate. For example, limit pins reporting is generally only needed when users are setting up their machine. Afterwards, it's
recommended to disable it, as it isn't very useful once you've got everything figured out.
Report Type Value

Machine Position 1

Work Position 2

Planner Buffer 4

RX Buffer 8

Limit Pins 16
$11 - Junction deviation, mm
Junction deviation is used by the acceleration manager to determine how fast it can move through line segment junctions
of a G-code program path. For example, if the G-code path has a sharp 10 degree turn coming up and the machine is moving
at full speed, this setting helps determine how much the machine needs to slow down to safely go through the corner
without losing steps.
How we calculate it is a bit complicated, but, in general, higher values gives faster motion through corners, while increasing
the risk of losing steps and positioning. Lower values makes the acceleration manager more careful and will lead to careful
and slower cornering. So if you run into problems where your machine tries to take a corner too fast, decrease this value
to make it slow down when entering corners. If you want your machine to move faster through junctions, increase this
value to speed it up. For curious people, hit this link to read about Grbl's cornering algorithm, which accounts for both
velocity and junction angle with a very simple, efficient, and robust method.
$12 – Arc tolerance, mm
Grbl renders G2/G3 circles, arcs, and helices by subdividing them into teeny tiny lines, such that the arc tracing accuracy is
never below this value. You will probably never need to adjust this setting, since 0.002mm is well below the accuracy of
most all CNC machines. But if you find that your circles are too crude or arc tracing is performing slowly, adjust this setting.
Lower values give higher precision but may lead to performance issues by overloading Grbl with too many tiny lines.
Alternately, higher values traces to a lower precision, but can speed up arc performance since Grbl has fewer lines to deal
with.
For the curious, arc tolerance is defined as the maximum perpendicular distance from a line segment with its end points
lying on the arc, aka a chord. With some basic geometry, we solve for the length of the line segments to trace the arc that
satisfies this setting. Modeling arcs in this way is great, because the arc line segments automatically adjust and scale with
length to ensure optimum arc tracing performance, while never losing accuracy.
$13 - Report inches, bool
Grbl has a real-time positioning reporting feature to provide a user feedback on where the machine is exactly at that time,
as well as, parameters for coordinate offsets and probing. By default, it is set to report in mm, but by sending
a $13=1 command, you send this boolean flag to true and these reporting features will now report in inches. $13=0 to set
back to mm.
$20 - Soft limits, bool
Soft limits is a safety feature to help prevent your machine from traveling too far and beyond the limits of travel, crashing
or breaking something expensive. It works by knowing the maximum travel limits for each axis and where Grbl is in machine
coordinates. Whenever a new G-code motion is sent to Grbl, it checks whether or not you accidentally have exceeded your
machine space. If you do, Grbl will issue an immediate feed hold wherever it is, shutdown the spindle and coolant, and then
set the system alarm indicating the problem. Machine position will be retained afterwards, since it's not due to an
immediate forced stop like hard limits.
NOTE: Soft limits requires homing to be enabled and accurate axis maximum travel settings, because Grbl needs to know
where it is. $20=1 to enable, and $20=0 to disable.
$21 - Hard limits, bool
Hard limit work basically the same as soft limits, but use physical switches instead. Basically you wire up some switches
(mechanical, magnetic, or optical) near the end of travel of each axes, or where ever you feel that there might be trouble
if your program moves too far to where it shouldn't. When the switch triggers, it will immediately halt all motion, shutdown
the coolant and spindle (if connected), and go into alarm mode, which forces you to check your machine and reset
everything.
To use hard limits with Grbl, the limit pins are held high with an internal pull-up resistor, so all you have to do is wire in a
normally-open switch with the pin and ground and enable hard limits with $21=1. (Disable with $21=0.) We strongly advise
taking electric interference prevention measures. If you want a limit for both ends of travel of one axes, just wire in two
switches in parallel with the pin and ground, so if either one of them trips, it triggers the hard limit.
Keep in mind, that a hard limit event is considered to be critical event, where steppers immediately stop and will have likely
have lost steps. Grbl doesn't have any feedback on position, so it can't guarantee it has any idea where it is. So, if a hard
limit is triggered, Grbl will go into an infinite loop ALARM mode, giving you a chance to check your machine and forcing you
to reset Grbl. Remember it's a purely a safety feature.
$22 - Homing cycle, bool
Ahh, homing. For those just initiated into CNC, the homing cycle is used to accurately and precisely locate a known and
consistent position on a machine every time you start up your Grbl between sessions. In other words, you know exactly
where you are at any given time, every time. Say you start machining something or are about to start the next step in a job
and the power goes out, you re-start Grbl and Grbl has no idea where it is. You're left with the task of figuring out where
you are. If you have homing, you always have the machine zero reference point to locate from, so all you have to do is run
the homing cycle and resume where you left off.
To set up the homing cycle for Grbl, you need to have limit switches in a fixed position that won't get bumped or moved,
or else your reference point gets messed up. Usually they are setup in the farthest point in +x, +y, +z of each axes. Wire
your limit switches in with the limit pins and ground, just like with the hard limits, and enable homing. If you're curious, you
can use your limit switches for both hard limits AND homing. They play nice with each other.
By default, Grbl's homing cycle moves the Z-axis positive first to clear the workspace and then moves both the X and Y-axes
at the same time in the positive direction. To set up how your homing cycle behaves, there are more Grbl settings down
the page describing what they do (and compile-time options as well.)
Also, one more thing to note, when homing is enabled. Grbl will lock out all G-code commands until you perform a homing
cycle. Meaning no axes motions, unless the lock is disabled ($X) but more on that later. Most, if not all CNC controllers, do
something similar, as it is mostly a safety feature to prevent users from making a positioning mistake, which is very easy to
do and be saddened when a mistake ruins a part. If you find this annoying or find any weird bugs, please let us know and
we'll try to work on it so everyone is happy. :)
NOTE: Check out config.h for more homing options for advanced users. You can disable the homing lockout at startup,
configure which axes move first during a homing cycle and in what order, and more.
$23 - Homing dir invert mask, int:binary
By default, Grbl assumes your homing limit switches are in the positive direction, first moving the z-axis positive, then the
x-y axes positive before trying to precisely locate machine zero by going back and forth slowly around the switch. If your
machine has a limit switch in the negative direction, the homing direction mask can invert the axes' direction. It works just
like the step port invert and direction port invert masks, where all you have to do is send the value in the table to indicate
what axes you want to invert and search for in the opposite direction.
$24 - Homing feed, mm/min
The homing cycle first searches for the limit switches at a higher seek rate, and after it finds them, it moves at a slower feed
rate to home into the precise location of machine zero. Homing feed rate is that slower feed rate. Set this to whatever rate
value that provides repeatable and precise machine zero locating.
$25 - Homing seek, mm/min
Homing seek rate is the homing cycle search rate, or the rate at which it first tries to find the limit switches. Adjust to
whatever rate gets to the limit switches in a short enough time without crashing into your limit switches if they come in too
fast.
$26 - Homing debounce, ms
Whenever a switch triggers, some of them can have electrical/mechanical noise that actually 'bounce' the signal high and
low for a few milliseconds before settling in. To solve this, you need to debounce the signal, either by hardware with some
kind of signal conditioner or by software with a short delay to let the signal finish bouncing. Grbl performs a short delay,
only homing when locating machine zero. Set this delay value to whatever your switch needs to get repeatable homing. In
most cases, 5-25 milliseconds is fine.
$27 - Homing pull-off, mm
To play nice with the hard limits feature, where homing can share the same limit switches, the homing cycle will move off
all of the limit switches by this pull-off travel after it completes. In other words, it helps to prevent accidental triggering of
the hard limit after a homing cycle.
$100, $101 and $102 – [X,Y,Z] steps/mm
Grbl needs to know how far each step will take the tool in reality. To calculate steps/mm for an axis of your machine you
need to know:
 The mm traveled per revolution of your stepper motor. This is dependent on your belt drive gears or lead screw
pitch.
 The full steps per revolution of your steppers (typically 200)
 The microsteps per step of your controller (typically 1, 2, 4, 8, or 16). Tip: Using high microstep values (e.g., 16) can
reduce your stepper motor torque, so use the lowest that gives you the desired axis resolution and comfortable
running properties.
The steps/mm can then be calculated like this: steps_per_mm = (steps_per_revolution*microsteps)/mm_per_rev
Compute this value for every axis and write these settings to Grbl.
$110, $111 and $112 – [X,Y,Z] Max rate, mm/min
This sets the maximum rate each axis can move. Whenever Grbl plans a move, it checks whether or not the move causes
any one of these individual axes to exceed their max rate. If so, it'll slow down the motion to ensure none of the axes exceed
their max rate limits. This means that each axis has its own independent speed, which is extremely useful for limiting the
typically slower Z-axis.
The simplest way to determine these values is to test each axis one at a time by slowly increasing max rate settings and
moving it. For example, to test the X-axis, send Grbl something like G0 X50with enough travel distance so that the axis
accelerates to its max speed. You'll know you've hit the max rate threshold when your steppers stall. It'll make a bit of noise,
but shouldn't hurt your motors. Enter a setting a 10-20% below this value, so you can account for wear, friction, and the
mass of your workpiece/tool. Then, repeat for your other axes.
NOTE: This max rate setting also sets the G0 seek rates.
$120, $121, $122 – [X,Y,Z] Acceleration, mm/sec^2
This sets the axes acceleration parameters in mm/second/second. Simplistically, a lower value makes Grbl ease slower into
motion, while a higher value yields tighter moves and reaches the desired feedrates much quicker. Much like the max rate
setting, each axis has its own acceleration value and are independent of each other. This means that a multi-axis motion
will only accelerate as quickly as the lowest contributing axis can.
Again, like the max rate setting, the simplest way to determine the values for this setting is to individually test each axis
with slowly increasing values until the motor stalls. Then finalize your acceleration setting with a value 10-20% below this
absolute max value. This should account for wear, friction, and mass inertia. We highly recommend that you dry test some
G-code programs with your new settings before committing to them. Sometimes the loading on your machine is different
when moving in all axes together.
$130, $131, $132 – [X,Y,Z] Max travel, mm
This sets the maximum travel from end to end for each axis in mm. This is only useful if you have soft limits (and homing)
enabled, as this is only used by Grbl's soft limit feature to check if you have exceeded your machine limits with a motion
command.

Grbl's Other '$' Commands


The other $ commands provide additional controls for the user, such as printing feedback on the current G-code parser
modal state or running the homing cycle. This section explains what these commands are and how to use them.
$# - View gcode parameters
G-code parameters store the coordinate offset values for G54-G59 work coordinates, G28/G30 pre-defined positions, G92
coordinate offset, tool length offsets, and probing (not officially, but we added here anyway). Most of these parameters
are directly written to EEPROM anytime they are changed and are persistent. Meaning that they will remain the same,
regardless of power-down, until they are explicitly changed. The non-persistent parameters, which will are not retained
when reset or power-cycled, are G92, G43.1 tool length offsets, and the G38.2 probing data.
G54-G59 work coordinates can be changed via the G10 L2 Px or G10 L20 Px command defined by the NIST gcode standard
and the EMC2 (linuxcnc.org) standard. G28/G30 pre-defined positions can be changed via the G28.1 and
the G30.1 commands, respectively.
When $# is called, Grbl will respond with the stored offsets from machine coordinates for each system as
follows. TLO denotes tool length offset, and PRB denotes the coordinates of the last probing cycle.
[G54:4.000,0.000,0.000]
[G55:4.000,6.000,7.000]
[G56:0.000,0.000,0.000]
[G57:0.000,0.000,0.000]
[G58:0.000,0.000,0.000]
[G59:0.000,0.000,0.000]
[G28:1.000,2.000,0.000]
[G30:4.000,6.000,0.000]
[G92:0.000,0.000,0.000]
[TLO:0.000,0.000,0.000]
[PRB:0.000,0.000,0.000]
$G - View gcode parser state
This command prints all of the active gcode modes in Grbl's G-code parser. When sending this command to Grbl, it will
reply with something like:
[G0 G54 G17 G21 G90 G94 M0 M5 M9 T0 S0.0 F500.0]
These active modes determine how the next G-code block or command will be interpreted by Grbl's G-code parser. For
those new to G-code and CNC machining, modes sets the parser into a particular state so you don't have to constantly tell
the parser how to parse it. These modes are organized into sets called "modal groups" that cannot be logically active at the
same time. For example, the units modal group sets whether your G-code program is interpreted in inches or in millimeters.
A short list of the modal groups, supported by Grbl, is shown below, but more complete and detailed descriptions can be
found at LinuxCNC's website. The G-code commands in bold indicate the default modes upon powering-up Grbl or resetting
it.
Modal Group Meaning Member Words

Motion Mode G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80
Modal Group Meaning Member Words

Coordinate System Select G54, G55, G56, G57, G58, G59

Plane Select G17, G18, G19

Distance Mode G90, G91

Arc IJK Distance Mode G91.1

Feed Rate Mode G93, G94

Units Mode G20, G21

Cutter Radius Compensation G40

Tool Length Offset G43.1, G49

Program Mode M0, M1, M2, M30

Spindle State M3, M4, M5

Coolant State M7, M8, M9


In addition to the G-code parser modes, Grbl will report the active T tool number, S spindle speed, and F feed rate, which
all default to 0 upon a reset. For those that are curious, these don't quite fit into nice modal groups, but are just as important
for determining the parser state.
$I - View build info
This prints feedback to the user the Grbl version and source code build date. Optionally, $I can also store a short string to
help identify which CNC machine you are communicating with, if you have more than machine using Grbl. To set this string,
send Grbl $I=xxx, where xxx is your customization string that is less than 80 characters. The next time you query Grbl with
a $I view build info, Grbl will print this string after the version and build date.
$N - View startup blocks
$Nx are the startup blocks that Grbl runs every time you power on Grbl or reset Grbl. In other words, a startup block is a
line of G-code that you can have Grbl auto-magically run to set your G-code modal defaults, or anything else you need Grbl
to do everytime you start up your machine. Grbl can store two blocks of G-code as a system default.
So, when connected to Grbl, type $N and then enter. Grbl should respond with something short like:
$N0=
$N1=
ok
Not much to go on, but this just means that there is no G-code block stored in line $N0 for Grbl to run upon startup. $N1 is
the next line to be run.
$Nx=line - Save startup block
IMPORTANT: Be very careful when storing any motion (G0/1,G2/3,G28/30) commands in the startup blocks. These
motion commands will run everytime you reset or power up Grbl, so if you have an emergency situation and have to e-
stop and reset, a startup block move can and will likely make things worse quickly. Also, do not place any commands
that save data to EEPROM, such as G10/G28.1/G30.1. This will cause Grbl to constantly re-write this data upon every
startup and reset, which will eventually wear out your Arduino's EEPROM.
Typical usage for a startup block is simply to set your preferred modal states, such as G20 inches mode, always default
to a different work coordinate system, or, to provide a way for a user to run some user-written unique feature that they
need for their crazy project.
To set a startup block, type $N0= followed by a valid G-code block and an enter. Grbl will run the block to check if it's valid
and then reply with an ok or an error: to tell you if it's successful or something went wrong. If there is an error, Grbl will not
save it.
For example, say that you want to use your first startup block $N0 to set your G-code parser modes like G54 work
coordinate, G20 inches mode, G17 XY-plane. You would type $N0=G20 G54 G17 with an enter and you should see an 'ok'
response. You can then check if it got stored by typing $N and you should now see a response like $N0=G20G54G17.
Once you have a startup block stored in Grbl's EEPROM, everytime you startup or reset you will see your startup block
printed back to you and a response from Grbl to indicate if it ran okay. So for the previous example, you'll see:
Grbl 0.9i ['$' for help]
G20G54G17ok
If you have multiple G-code startup blocks, they will print back to you in order upon every startup. And if you'd like to clear
one of the startup blocks, (e.g., block 0) type $N0= without anything following the equal sign.
Also, if you have homing enabled, the startup blocks will execute immediately after the homing cycle, not at startup.
$C - Check gcode mode
This toggles the Grbl's gcode parser to take all incoming blocks and process them completely, as it would in normal
operation, but it does not move any of the axes, ignores dwells, and powers off the spindle and coolant. This is intended as
a way to provide the user a way to check how their new G-code program fares with Grbl's parser and monitor for any errors
(and checks for soft limit violations, if enabled).
When toggled off, Grbl will perform an automatic soft-reset (^X). This is for two purposes. It simplifies the code
management a bit. But, it also prevents users from starting a job when their G-code modes are not what they think they
are. A system reset always gives the user a fresh, consistent start.
$X - Kill alarm lock
Grbl's alarm mode is a state when something has gone critically wrong, such as a hard limit or an abort during a cycle, or if
Grbl doesn't know its position. By default, if you have homing enabled and power-up the Arduino, Grbl enters the alarm
state, because it does not know its position. The alarm mode will lock all G-code commands until the '$H' homing cycle has
been performed. Or if a user needs to override the alarm lock to move their axes off their limit switches, for example, '$X'
kill alarm lock will override the locks and allow G-code functions to work again.
But, tread carefully!! This should only be used in emergency situations. The position has likely been lost, and Grbl may not
be where you think it is. So, it's advised to use G91 incremental mode to make short moves. Then, perform a homing cycle
or reset immediately afterwards.
$H - Run homing cycle
This command is the only way to perform the homing cycle in Grbl. Some other motion controllers designate a special G-
code command to run a homing cycle, but this is incorrect according to the G-code standards. Homing is a completely
separate command handled by the controller.
TIP: After running a homing cycle, rather jogging manually all the time to a position in the middle of your workspace volume.
You can set a G28 or G30 pre-defined position to be your post-homing position, closer to where you'll be machining. To set
these, you'll first need to jog your machine to where you would want it to move to after homing. Type G28.1 (or G30.1) to
have Grbl store that position. So then after '$H' homing, you could just enter 'G28' (or 'G30') and it'll move there auto-
magically. In general, I would just move the XY axis to the center and leave the Z-axis up. This ensures that there isn't a
chance the tool in the spindle will interfere and that it doesn't catch on anything.
$RST=$, $RST=#, and $RST=*- Restore Grbl settings and data to defaults
These commands are not listed in the main Grbl $ help message, but are available to allow users to restore parts of or all
of Grbl's EEPROM data. Note: Grbl will automatically reset after executing one of these commands to ensure the system is
initialized correctly.
 $RST=$ : Erases and restores the $$ Grbl settings back to defaults, which is defined by the default settings file used
when compiling Grbl. Often OEMs will build their Grbl firmwares with their machine-specific recommended
settings. This provides users and OEMs a quick way to get back to square-one, if something went awry or if a user
wants to start over.
 $RST=# : Erases and zeros all G54-G59 work coordinate offsets and G28/30 positions stored in EEPROM. These are
generally the values seen in the $# parameters printout. This provides an easy way to clear these without having to
do it manually for each set with a G20 L2/20 or G28.1/30.1 command.
 $RST=* : This clears and restores all of the EEPROM data used by Grbl. This
includes $$settings, $# parameters, $N startup lines, and $I build info string. Note that this doesn't wipe the entire
EEPROM, only the data areas Grbl uses. To do a complete wipe, please use the Arduino IDE's EEPROM clear example
project.

Real-Time Commands: ~, !, ?, and Ctrl-X


The last four of Grbl's commands are real-time commands. This means that they can be sent at anytime, anywhere, and
Grbl will immediately respond, no matter what it's doing. For those that are curious, these are special characters that are
'picked-off' from the incoming serial stream and will tell Grbl to execute them, usually within a few milliseconds.
~ - Cycle start
This is the cycle start or resume command that can be issued at any time, as it is a real-time command. When Grbl has
motions queued in its buffer and is ready to go, the ~ cycle start command will start executing the buffer and Grbl will begin
moving the axes. However, by default, auto-cycle start is enabled, so new users will not need this command unless a feed
hold is performed. When a feed hold is executed, cycle start will resume the program. Cycle start will only be effective when
there are motions in the buffer ready to go and will not work with any other process like homing.
! - Feed hold
The feed hold command will bring the active cycle to a stop via a controlled deceleration, so as not to lose position. It is
also real-time and may be activated at any time. Once finished or paused, Grbl will wait until a cycle start command is issued
to resume the program. Feed hold can only pause a cycle and will not affect homing or any other process.
If you need to stop a cycle mid-program and can't afford losing position, perform a feed hold to have Grbl bring everything
to a controlled stop. Once finished, you can then issue a reset. Always try to execute a feed hold whenever the machine is
running before hitting reset, except of course if there is some emergency situation.
? - Current status
The ? command immediately returns Grbl's active state and the real-time current position, both in machine coordinates
and work coordinates. Optionally, you can also have Grbl respond back with the RX serial buffer and planner buffer usage
via the status report mask setting. The ? command may be sent at any time and works asynchronously with all other
processes that Grbl is doing. The $13 Grbl setting determines whether it reports millimeters or inches. When ? is pressed,
Grbl will immediately reply with something like the following:
<Idle,MPos:5.529,0.560,7.000,WPos:1.529,-5.440,-0.000>
The active states Grbl can be in are: Idle, Run, Hold, Door, Home, Alarm, Check
 Idle: All systems are go, no motions queued, and it's ready for anything.
 Run: Indicates a cycle is running.
 Hold: A feed hold is in process of executing, or slowing down to a stop. After the hold is complete, Grbl will remain
in Hold and wait for a cycle start to resume the program.
 Door: (New in v0.9i) This compile-option causes Grbl to feed hold, shut-down the spindle and coolant, and wait
until the door switch has been closed and the user has issued a cycle start. Useful for OEM that need safety doors.
 Home: In the middle of a homing cycle. NOTE: Positions are not updated live during the homing cycle, but they'll
be set to the home position once done.
 Alarm: This indicates something has gone wrong or Grbl doesn't know its position. This state locks out all G-code
commands, but allows you to interact with Grbl's settings if you need to. '$X' kill alarm lock releases this state and
puts Grbl in the Idle state, which will let you move things again. As said before, be cautious of what you are doing
after an alarm.
 Check: Grbl is in check G-code mode. It will process and respond to all G-code commands, but not motion or turn
on anything. Once toggled off with another '$C' command, Grbl will reset itself.
Ctrl-x - Reset Grbl
This is Grbl's soft reset command. It's real-time and can be sent at any time. As the name implies, it resets Grbl, but in a
controlled way, retains your machine position, and all is done without powering down your Arduino. The only times a soft-
reset could lose position is when problems arise and the steppers were killed while they were moving. If so, it will report if
Grbl's tracking of the machine position has been lost. This is because an uncontrolled deceleration can lead to lost steps,
and Grbl has no feedback to how much it lost (this is the problem with steppers in general). Otherwise, Grbl will just re-
initialize, run the startup lines, and continue on its merry way.
Please note that it's recommended to do a soft-reset before starting a job. This guarantees that there aren't any G-code
modes active that from playing around or setting up your machine before running the job. So, your machine will always
starts fresh and consistently, and your machine does what you expect it to.

S-ar putea să vă placă și