Grbl v1.1版本配置说明

2018-06-21 21:21:58 (14872)

Grblv1.1 Configuration

Source Websit:https://github.com/gnea/grbl/wiki/Grbl-v1.1-Configuration

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, noparity, and 1-stop bit.)


Once connected you should get the Grbl-prompt, which looks likethis:


Grbl 1.1f ['$' for help]

Type $ and press enter to have Grbl print a help message. You shouldnot see any local echo of the $ and enter. Grbl should respond with:


[HLP:$$ $# $G $I $N $x=val $Nx=line $J=line $SLP $C $X $H ~ ! ?ctrl-x]

The ‘$’-commands are Grbl system commands used to tweak thesettings, view or change Grbl's states and running modes, and start a homingcycle. The last four non-'$' commands are realtimecontrol commands that can be sent at anytime, no matter what Grbl is doing.These either immediately change Grbl's running behavior or immediately print areport 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 theexample below. All of these settings are persistent and kept in EEPROM, so ifyou power down, these will be loaded back up the next time you power up yourArduino


The x of $x=val indicates a particular setting, while val is thesetting value. In prior versions of Grbl, each setting had a description nextto it in () parentheses, but Grbl v1.1+ no longer includes them unfortunately.This was done to free up precious flash memory to add the new featuresavailable in v1.1. However, most good GUIs will help out by attachingdescriptions for you, so you know what you are looking at.


Settings and sample values



Step pulse, microseconds


Step idle delay, milliseconds


Step port invert, mask


Direction port invert, mask


Step enable invert, boolean


Limit pins invert, boolean


Probe pin invert, boolean


Status report, mask


Junction deviation, mm


Arc tolerance, mm


Report inches, boolean


Soft limits, boolean


Hard limits, boolean


Homing cycle, boolean


Homing dir invert, mask


Homing feed, mm/min


Homing seek, mm/min


Homing debounce, milliseconds


Homing pull-off, mm


Max spindle speed, RPM


Min spindle speed, RPM


Laser mode, boolean


X steps/mm


Y steps/mm


Z steps/mm


X Max rate, mm/min


Y Max rate, mm/min


Z Max rate, mm/min


X Acceleration, mm/sec^2


Y Acceleration, mm/sec^2


Z Acceleration, mm/sec^2


X Max travel, mm


Y Max travel, mm


Z Max travel, mm

$x=val - Save Grbl setting

$x=val – 保存设置

The $x=val command saves or alters a Grbl setting, which can be donemanually by sending this command when connected to Grbl through a serialterminal program, but most Grbl GUIs will do this for you as a user-friendlyfeature.

$x=val命令可以保存或改变Grbl的设置,只要通过串口终端程序连接了Grbl,你可以每一个指令,但是大多数的Grbl GUI会给提提供一个友好的功能

To manually change e.g. the microseconds step pulse option to 10usyou would type this, followed by an enter:




If everything went well, Grbl will respond with an 'ok' and thissetting is stored in EEPROM and will be retained forever or until you changethem. You can check if Grbl has received and stored your setting correctly bytyping $$ to view the system settings again.


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

Grbl $x=val 设置和他们的代表的意义

NOTE: From Grbl v0.9 to Grbl v1.1, only $10 status reports changedand new $30/ $31 spindle rpm max/min and $32 laser mode settings were added.Everything else is the same.


$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 thestepper drivers can reliably recognize. If the pulses are too long, you mightrun 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 somethingaround 10 microseconds, which is the default value.


$1 - Step idle delay, milliseconds

$1 – 步进空闲延时,毫秒

Every time your steppers complete a motion and come to a stop, Grblwill delay disabling the steppers by this value. OR, you can always keepyour axes enabled (powered so as to hold position) by setting this value to themaximum 255 milliseconds. Again, just to repeat, you can keep all axes alwaysenabled by setting $1=255.


The stepper idle lock time is the time length Grbl will keep thesteppers locked before disabling. Depending on the system, you can set this tozero and disable it. On others, you may need 25-50 milliseconds to make sureyour axes come to a complete stop before disabling. This is to help account formachine motors that do not like to be left on for long periods of time withoutdoing something. Also, keep in mind that some stepper drivers don't rememberwhich 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

$2- 步进脉冲颠倒接口,mask值(掩码)

This setting inverts the step pulse signal. By default, a stepsignal starts at normal-low and goes high upon a step pulse event. After a steppulse 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 duringthe pulse, and back to high. Most users will not need to use this setting, butthis can be useful for certain CNC-stepper drivers that have peculiarrequirements. For example, an artificial delay between the direction pin andstep pulse can be created by inverting the step pin.


This invert mask setting is a value which stores the axes to invertas bit flags. You really don't need to completely understand how it works. Yousimply need to enter the settings value for the axes you want to invert. Forexample, if you want to invert the X and Z axes, you'd send $2=5 to Grbl andthe setting should now read $2=5 (step port invert mask:00000101).


Setting Value


Invert X

Invert Y

Invert Z









































$3 – Direction portinvert, mask

$3 – 方向颠倒接口,mask值

This setting inverts the direction signal for each axis. By default,Grbl assumes that the axes move in a positive direction when the direction pinsignal is low, and a negative direction when the pin is high. Often, axes don'tmove this way with some machines. This setting will invert the direction pinsignal for those axes that move the opposite way.


This invert mask setting works exactly like the step port invertmask 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 thetable above. For example, if want to invert the Y axis direction only, you'dsend $3=2 to Grbl and the setting should now read $3=2 (dir port invertmask:00000010)


$4 - Step enable invert,boolean

$4 – 步进使能翻转 boolean值(使能)

By default, the stepper enable pin is high to disable and low toenable. If your setup needs the opposite, just invert the stepper enable pin bytyping $4=1. Disable with $4=0. (May need a power cycle to load the change.)


$5 - Limit pins invert,boolean

$5 – 限位引脚翻转,boolean值

By default, the limit pins are held normally-high with the Arduino'sinternal pull-up resistor. When a limit pin is low, Grbl interprets this astriggered. 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: For more advanced usage, the internal pull-up resistor on thelimit pins may be disabled in config.h.


$6 - Probe pin invert, boolean

$6 – 探测引脚翻转,boolean值

By default, the probe pin is held normally-high with the Arduino'sinternal pull-up resistor. When the probe pin is low, Grbl interprets this astriggered. 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.


$10 - Status report, mask

$10 – 状态报告,mask值

This setting determines what Grbl real-time data it reports back tothe user when a '?' status report is sent. This data includes current runstate, real-time position, real-time feed rate, pin states, current overridevalues, buffer states, and the g-code line number currently executing (ifenabled through compile-time options).


By default, the new report implementation in Grbl v1.1+ will includejust about everything in the standard status report. A lot of the data ishidden and will appear only if it changes. This increases efficiencydramatically over of the old report style and allows you to get faster updatesand still get more data about your machine. The interface documentationoutlines how it works and most of it applies only to GUI developers or thecurious.

默认状态下,Grbl v1.1执行的是新的的状态报告它包括了之前的标准状态报告,有许多数据是隐藏的只会显示改变了的数据,这个提升了旧报告样式的效率,允许你更快的获得更新数据并且依然能获得很多机械数据,这个接口文档讲述了它的工作原理,其中大部分只适用于GUI开发人员或业余人员。

To keep things simple and consistent, Grbl v1.1 has only tworeporting options. These are primarily here just for users and developers tohelp set things up.

为了让事情更加简单,统一。Grbl v1.1只有两个报告选项,这些主要是为用户和开发人员设置的。

  • Position type may be specified to show either machine position (MPos:) or work position (WPos:), but no longer both at the same time. Enabling work position is useful in certain scenarios when Grbl is being directly interacted with through a serial terminal, but machine position reporting should be used by default.
  • 位置选项可以是选择是机器位子(Mpos)或工作位置(Wpos),但是两者不会同时显示,工作位置有些时候是有用的比如Grbl通过串口终端连接的时候,但是默认报告使用的是机器位置
  • Usage data of Grbl's planner and serial RX buffers may be enabled. This shows the number of blocks or bytes available in the respective buffers. This is generally used to helps determine how Grbl is performing when testing out a streaming interface. This should be disabled by default.
  • 启用串口接受缓冲区可以知道Grbl的数据利用情况,这个会显示了接受缓冲区可用的块和字节,测试数据数据流接口通常可以帮助我们判断Gerl是如何去执行的

Use the table below enables and disable reporting options. Simplyadd the values listed of what you'd like to enable, then save it by sendingGrbl your setting value. For example, the default report with machine positionand no buffer data reports setting is $10=1. If work position and buffer dataare desired, the setting will be $10=2.


Report Type



Position Type


Enable WPos: Disable MPos:.

Position Type


Enable MPos:. Disable WPos:.

Buffer Data


Enabled Buf: field appears with planner and serial RX available buffer.

$23 - Homing dir invert, mask

$23 – 复位方向翻转,mask值

By default, Grbl assumes your homing limit switches are in thepositive direction, first moving the z-axis positive, then the x-y axespositive before trying to precisely locate machine zero by going back and forthslowly around the switch. If your machine has a limit switch in the negativedirection, the homing direction mask can invert the axes' direction. It worksjust like the step port invert and direction port invert masks, where all youhave to do is send the value in the table to indicate what axes you want toinvert and search for in the opposite direction.


$24 - Homing feed, mm/min

$24 - 复位寻找速度,mm/min

The homing cycle first searches for the limit switches at a higherseek rate, and after it finds them, it moves at a slower feed rate to home intothe precise location of machine zero. Homing feed rate is that slower feedrate. Set this to whatever rate value that provides repeatable and precisemachine zero locating


$25 - Homing seek, mm/min

$25 - 复位给进速度, mm/min

Homing seek rate is the homing cycle search rate, or the rate atwhich it first tries to find the limit switches. Adjust to whatever rate getsto the limit switches in a short enough time without crashing into your limitswitches if they come in too fast


$26 - Homing debounce, milliseconds

$26 – 复位消抖,毫秒

Whenever a switch triggers, some of them can haveelectrical/mechanical noise that actually 'bounce' the signal high and low fora few milliseconds before settling in. To solve this, you need to debounce thesignal, either by hardware with some kind of signal conditioner or by softwarewith a short delay to let the signal finish bouncing. Grbl performs a shortdelay, only homing when locating machine zero. Set this delay value to whateveryour switch needs to get repeatable homing. In most cases, 5-25 milliseconds isfine.


$27 - Homing pull-off, mm

$27 – 复位返回行程, mm

To play nice with the hard limits feature, where homing can sharethe same limit switches, the homing cycle will move off all of the limitswitches by this pull-off travel after it completes. In other words, it helpsto prevent accidental triggering of the hard limit after a homing cycle. Makesure this value is large enough to clear the limit switch. If not, Grbl willthrow an alarm error for failing to clear it.


$30 - Max spindle speed, RPM

$30 – 最大主轴转速,rmp

This sets the spindle speed for the maximum 5V PWM pin output. Forexample, if you want to set 10000rpm at 5V, program $30=10000. For 255rpm at5V, program $30=255. If a program tries to set a higher spindle RPM greaterthan the $30 max spindle speed, Grbl will just output the max 5V, since itcan't go any faster. By default, Grbl linearly relates the max-min RPMs to5V-0.02V PWM pin output in 255 equally spaced increments. When the PWM pinreads 0V, this indicates spindle disabled. Note that there are additionalconfiguration options are available in config.h to tweak how this operates.


$31 - Min spindle speed, RPM

$31 – 最小主轴转速,rmp

This sets the spindle speed for the minimum 0.02V PWM pin output (0Vis disabled). Lower RPM values are accepted by Grbl but the PWM output will notgo below 0.02V, except when RPM is zero. If zero, the spindle is disabled andPWM output is 0V.



$32 - Laser mode, Boolean

$32 – 激光模式,boolean值

When enabled, Grbl will move continuously through consecutive G1,G2, or G3 motion commands when programmed with a S spindle speed (laser power).The spindle PWM pin will be updated instantaneously through each motion withoutstopping. Please read the GRBL laserdocumentation and your laser device documentation prior to using this mode.Lasers are very dangerous. They can instantly damage your vision permanantlyand cause fires. Grbl does not assume any responsibility for any issues thefirmware may cause, as defined by its GPL license.


When disabled, Grbl will operate as it always has, stopping motionwith every S spindle speed command. This is the default operation of a millingmachine to allow a pause to let the spindle change speeds.


$100, $101 and $102 – [X,Y,Z] steps/mm

$100, $101 and $102 – [X,Y,Z]步/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:

Grbl需要知道实际中使用的工具每一步走了多远,为了计算每一轴的 步/mm 你需要知道

  • 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)
  • 每转一圈全部的步数(通常为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
  • 控制器每步的微步(通常为1,2,4,8或16)。提示:使用高微步数值(例如16)可以降低步进电机的转矩,因此请使用最低值,以获得所需的轴分辨率和舒适的运行属性

The steps/mm can then be calculated like this: steps_per_mm =(steps_per_revolution*microsteps)/mm_per_rev

这个 步/mm 可以这样计算:步每毫米 =(步每圈*微步)/毫米每圈

Compute this value for every axis and write these settings to Grbl.


$110, $111 and $112 – [X,Y,Z] Max rate, mm/min

$110, $111 and $112 – [X,Y,Z] 最大速率,mm/分钟

This sets the maximum rate each axis can move. Whenever Grbl plans amove, it checks whether or not the move causes any one of these individual axesto exceed their max rate. If so, it'll slow down the motion to ensure none ofthe axes exceed their max rate limits. This means that each axis has its ownindependent speed, which is extremely useful for limiting the typically slowerZ-axis.


The simplest way to determine these values is to test each axis oneat a time by slowly increasing max rate settings and moving it. For example, totest the X-axis, send Grbl something like G0 X50with enough traveldistance so that the axis accelerates to its max speed. You'll know you've hitthe max rate threshold when your steppers stall. It'll make a bit of noise, butshouldn't hurt your motors. Enter a setting a 10-20% below this value, so youcan account for wear, friction, and the mass of your workpiece/tool. Then,repeat for your other axes.

确定这些值的最简单方法是逐个测试每个轴,方法是缓慢增加最大速率设置并移动它。例如,要测试X轴,请发送Grbl的指令比如 G0X50并且有足够的行进距离,以便轴加速到其最大速度。当你的步进电机失速时,你就知道你达到了最高速率阈值。它会产生一些噪音,但不应该伤害你的电机。输入一个比该值低10-20%的设置,这样就可以缓解磨损,摩擦以及工件/工具的质量。然后,重复您的其他轴。

NOTE: This max rate setting also sets the G0 seek rates.


$120, $121, $122 – [X,Y,Z] Acceleration, mm/sec^2

$120, $121, $122 – [X,Y,Z] 加速度,mm/s^2

This sets the axes acceleration parameters in mm/second/second.Simplistically, a lower value makes Grbl ease slower into motion, while ahigher value yields tighter moves and reaches the desired feed rates muchquicker. Much like the max rate setting, each axis has its own accelerationvalue and are independent of each other. This means that a multi-axis motionwill only accelerate as quickly as the lowest contributing axis can.


Again, like the max rate setting, the simplest way to determine thevalues for this setting is to individually test each axis with slowlyincreasing values until the motor stalls. Then finalize your accelerationsetting with a value 10-20% below this absolute max value. This should accountfor wear, friction, and mass inertia. We highly recommend that you dry testsome G-code programs with your new settings before committing to them.Sometimes the loading on your machine is different when moving in all axestogether.,


$130, $131, $132 – [X,Y,Z] Max travel, mm

$130, $131, $132 – [X,Y,Z] 最大行程,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 isonly used by Grbl's soft limit feature to check if you have exceeded yourmachine limits with a motion command.



Quick Guide to Setting Up Your Machine for the First Time


Grbl's default configuration is intentionally very generic to helpensure users can see successful motion without having to tweak settings.Generally, the first thing you'll want to do is get your stepper motorsrunning, usually without it connected to the CNC. Wire Grbl to your stepperdrivers and stepper motors according to your manufacturer guidelines. Connectto Grbl through a serial terminal or one of many Grbl GUIs. Send some G1 or G0 commandsto Grbl. You should see your stepper motor rotating. If you are having troublewith your stepper motors, try the following:


  • Ensure everything is wired and powered correctly per your stepper driver manufacturer guidelines.
  • If your steppers are mounted in your CNC already, ensure your axes move freely and don't obviously bind. If you can't easily tell, try removing your steppers and check if they run under no load.
  • Ensure your stepper motors and axes linear mechanisms are all tight and secure. Small set screws on drivetrain components becoming loose is a very common problem. Re-tighten and try applying some non-permenant thread locker (Loctite blue) if it continually loosens.
  • For more difficult issues, try the process of elimination to quickly isolate the problem. Start by disconnecting everything from the Arduino. Test if Grbl is operating ok by itself. Then, add one thing at a time and test.
  • If your steppers are powered and making a grinding noise when trying to move, try lowering the '$' acceleration and max rate settings. This sound is a sign that your steppers is losing steps and not able to keep up due too much torque load or going too fast.
  • Grbl's default step pulse settings cover the vast majority of stepper drivers on the market. While very uncommon, check these settings if you are still experiencing problems or have a unusual setup.

Next, you will need to make sure your machine is moving in thecorrect directions according to a Cartesian(XYZ) coordinate frame and satisfiesthe right-hand rule, as shown:


Mount your stepper motors into your CNC, if you haven't already doneso. Send Grbl some motion commands, such as G91 G0 X1 or G91 G0 X-1, which willmove the x-axis +1mm and -1mm, respectively. Check all axes. If an axis is notmoving correctly, alter the $3 direction port mask setting to invert thedirection.

安装你的步进电机到你的CNC系统中,如果你完成了这些工作,发送一些Grbl运动命令,例如G91 G0 X1或G91 G0 X-1,将分别移动x轴+1mm和-1mm,然后用同样的方法检查所有的轴,如果有一个轴没有正确的移动,更改$3方向设定可以改变设定方向

If you are unfamiliar with how coordinate frames are setup on CNCmachines, see this great diagram by LinuxCNC.Just keep in mind that motions are relative to the tool. So on atypical CNC gantry router, the tool will move rather than the fixed table. Ifthe x-axis is aligned positive to the right, a positive motion command willmove the tool to the right. Whereas, a moving table with a fixed tool will movethe table to the left for the same command, because the tool is moving to theright relative to the table.


合作伙伴:万网 | 新网 | 新网互联 NDF网站建设淘宝店 | 实用工具 | 外貿網站建設 | 联系我们
鲁公网安备 37110202000336号 鲁ICP备2021027697号-1 Sitemap - RSSRSS订阅