GRBL is one of the most popular motion control software used by CNC hobbyists.
How do you get started with GRBL? What are the steps involved?
This guide will walk you through the absolute basics of GRBL software along with some basic troubleshooting techniques.
MellowPine is reader-supported. When you buy through links on my site, I may earn an affiliate commission at no extra cost to you.
What is GRBL?
GRBL is one of the most popular open-source software that guides the motion of a CNC machine. It takes G-codes as the input and translates them into the motion of the CNC machine. GRBL is compatible with all ATmega328-based microcontrollers that are commonly used with Arduino boards.
Firmware is a type of software that is embedded into a controller. It serves the logic behind the actions performed by a controller system.
Although various CNC controllers are available in the market, GRBL firmware is generally compatible with all ATmega328-based microcontrollers.
These microcontrollers are commonly used with Arduino Nano and Arduino Uno boards.
The GRBL firmware is uploaded on a CNC GRBL controller that processes the G-codes and sends out the electrical signals to the stepper motor driver.
These electrical signals control the motion of stepper motors, thereby controlling the movements of the CNC machine.
Therefore, in simple terms, we can conclude that the GRBL firmware translates the G-codes into the movements of a CNC machine.
Its easy-to-use interface and simple configuration make GRBL ideal for beginners and DIY enthusiasts.
However, it can control a maximum of 3 axes and cannot be used for applications involving 4 or more axes systems.
A GRBL-based CNC machine consists of a few basic elements.
The Arduino houses a microcontroller system that acts as the brain of the CNC machine.
GRBL firmware requires an ATmega328-based Arduino system to control the movements of the CNC machine.
The G-codes from a GRBL-compatible software are interpreted by the GRBL firmware and translated into electrical impulses through the pins of the Arduino system.
The electrical impulses produced by Arduino control the motion of stepper motors connected to it via stepper drivers.
These stepper motors are connected to various elements of the CNC machine through a drive system.
The rotary motion of the stepper motor activates the drive system and produces a movement in the CNC machine.
There are various types of stepper motors available in the market, and selecting the appropriate stepper motors for your CNC will enhance its efficiency.
A GRBL-based Arduino can support various types of stepper motors ranging from small-sized NEMA 11 to heavy-duty motors such as NEMA 23.
Stepper Motor Drivers
A stepper motor requires a special circuit that supplies calculated electric pulses to the motor and imparts the desired motion. These circuits are known as stepper motor drivers.
There are various factors that determine the best stepper motor driver for your CNC.
However, the selection of the driver primarily depends upon the type of stepper motor used in your CNC.
Generally, DIY CNC machines equipped with small-size stepper motors, such as NEMA 17 require A4988 or TB6600 drivers.
Arduino CNC Shield
Arduino shields are used to enhance the functionality of an Arduino.
These boards have a similar pin configuration to Arduino and can be plugged on top of an Arduino board to provide additional features to the system.
There are various types of Arduino shields, such as wifi shields, sensor shields, CNC shields, etc.
A GRBL-based CNC machine requires an Arduino CNC shield that provides connectivity options for various elements such as stepper motor drivers, limit/homing switches, spindle/laser heads, cooling fan/air assist, etc.
Steps to Install GRBL
Flashing the GRBL firmware on an Arduino-based controller consists of a few easy steps.
Install Arduino IDE
To install GRBL on your Arduino system, you need an Arduino IDE tool that allows programming the Arduino.
Download the IDE installer from their official website and run the .exe file.
Follow through with the procedure and complete the installation.
Download GRBL source code (.zip file)
After installing Arduino IDE, select the latest release of GRBL from GitHub and download the source code as a zip file.
After downloading the zip file, extract its contents and look for a folder named 'grbl'.
Open the 'grbl-master' folder and look for a subfolder named 'grbl'.
Load GRBL library into Arduino IDE
Launch the Arduino IDE and navigate to sketch>include library>add .ZIP library.
Select the sub-folder named 'grbl' and click 'open'.
This will add the grbl library to the libraries of Arduino IDE.
Upload GRBL to Arduino
After adding grbl to Arduino libraries, you can now upload grbl to your Arduino board.
Before uploading grbl, navigate to Tools>Board and select the board you want to flash the grbl on.
Furthermore, also ensure that you have selected the correct serial port by navigating to Tools>Serial Port.
Now connect the computer with your Arduino board and upload grbl by navigating to file>examples>grbl>grblUpload.
This opens a pop-up window in the Arduino IDE for uploading grbl.
Click on the upload button and wait for the process to get completed.
Configuring GRBL with your CNC machine
Now that firmware is uploaded to the controller of your CNC machine, it's time to configure GRBL to adapt to your CNC.
To configure the GRBL, you need to open the Arduino ide serial monitor by clicking the icon on the top right corner of the IDE window.
This will open the Arduino IDE serial monitor window with a default display message "Grbl x.xj ['$' for help]".
If you don't see the default message, ensure that you have plugged into the right port and set the baud rate to 115200.
After ensuring everything is working properly, type in "$$" to display the current settings of the Arduino system.
The system will display the settings as shown in the example below.
$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)
All these values represent different parameters of your CNC machine.
For example, $110 represents the maximum travel speed in the x-direction.
In order to change the setting, you can type $110=800 and press enter. This will set the new maximum travel speed along the x-direction to 800 mm/min.
Similarly, $130 will set the maximum travel distance in the x-direction and should be set according to the work area available on your CNC machine.
One of the most important settings that need to be set appropriately is step/mm.
These settings determine the number of steps made by the stepper motor in order to move 1mm on the axis.
After setting the appropriate values, type $x=val to save the GRBL settings.
How Does the GRBL System Work?
GRBL is the firmware that interprets the G-codes and translates them into the motion of the CNC machine.
However, GRBL-compatible CAM software is required to stream the G-codes to the GRBL firmware.
After configuring the GRBL to adapt to your CNC machine, you can use CAD software to prepare the design and convert the design into G-codes by using CAM software.
Although various GRBL-compatible software is available for streaming G-codes, Universal G-code Sender (UGS) is one of the most popular software with GRBL systems.
UGS takes the CAD software's design file as the input and converts it into G-codes.
The G-codes are then streamed to the controller, where GRBL translates them into precise movements of the drive system of your CNC machine.
Troubleshooting Issues on GRBL
While working with GRBL firmware, there are various issues that can occasionally hinder the smooth functioning of your CNC.
Therefore, it is important to be aware of some common issues and their troubleshooting procedure.
Soft limit Alarms
When working with a CNC machine that houses GRBL firmware, sometimes the system runs into an error where it sets off false limit alarms.
This means that the system interprets the position of the tool at the limiting value even though it is well within the working area of your CNC machine.
One of the easiest solutions to this error is resetting the machine by manually moving the router (tool) to the origin (0,0,0) and restarting the GRBL system to set the new soft limits.
Tool abnormality is the error when the tool does not respond to the controller commands appropriately.
This error generally consists of two types of abnormalities. Either the tool (router/laser) starts operating before being positioned at the desired location on the workpiece, or the tool does operate at all.
The most common source of these abnormalities is poor software connection or bugs in the computer system.
Therefore, to rectify these errors, it is recommended to restart the computer system or reinstall the GRBL software.
The G-codes written for a CNC process can vary from one controller system to another.
Therefore, copying a G-code that is not compatible with the GRBL controller can result in improper functioning of the CNC machine and often lead to unexpected stops in the process.
For example, GRBL does not support automatic tool-changing codes. So, if you include certain tool change commands in your G-code, the controller will not recognize the command and halt the process.
In order to troubleshoot this error, it is advised to thoroughly look for the line of code that caused the error and rectify it.
Alternatives to GRBL
Although GRBL is one of the most commonly used open-source firmware for CNC applications, it does not provide support for controlling servo motors and systems consisting of more than 3-axes.
However, there are various advanced GRBL versions that extend its functionality and overcome the limitations.
GRBL ESP32 is one such updated version of GRBL, which is compatible with 32-bit controllers that provide faster processing speed than 8-bit Arduino systems.
The 32-bit GRBL ESP32 houses more RAM and provides support for 4-axis systems.
Its built-in WiFi and Bluetooth module enhances the connectivity by providing support for wireless connections to control your CNC by a smartphone or PC, eliminating the need for a USB cable.
GRBL Servo is another enhanced version of GRBL that extends its functionality by providing support to control servo motors.
This version of GRBL is most commonly used in pen plotter applications where a small servo motor, such as an SG90 micro servo, is used to control the movement of the pen.
Apart from the extended versions of GRBL, there are various other software that can be used as an alternative to GRBL firmware.
|Marlin||Best suitable for 3D printers|
|LinuxCNC||Supports systems with up to 5 axes and can control servo motors.|
|AccelStepper||Supports multiple stepper motors with individual stepping.|
Alternatives to GRBL firmware and their features
Marlin is one of the most popular firmware among the 3D printing community.
It offers high process flexibility and enhanced portability by supporting printing via an SD card.
However, GRBL provides advanced features for milling that are not available in Marlin firmware.
Marlin supports a maximum step rate of around 40 kHz and provides the feature of 'babystepping'.
Babystepping enables precisely setting the z-height by controlling the minute adjustments in the axis movement.
This feature is generally used in 3D printing to adjust the height of the layer to ensure a successful print.
LinuxCNC is a versatile firmware that provides support for CNC machines with a maximum of 5-axis coordinate systems.
It is a Linux-based firmware which makes it ideal for users operating on Linux platforms.
Furthermore, its support for controlling servo motors gives it an edge over the standard GRBL firmware.
However, the user-friendly interface and ease of use make GRBL a preferable choice for beginners.
AccelStepper supports multiple stepper motors simultaneously with an independent stepping value on each stepper.
However, GRBL outperforms AccelStepper by providing a faster stepping speed.
AccelStepper provides a maximum stepping rate of around 4kHz, whereas the stepping frequency on certain GRBL firmware can go as high as 100kHz.
Frequently Asked Questions (FAQ)
Is GRBL software free?
Yes, GRBL is free, open-source software that can be downloaded and used by anyone, which makes it one of the most popular CNC firmware among beginners and DIY enthusiasts.
Does GRBL support CNC laser cutting machines?
Yes, GRBL supports CNC laser cutting machines. LaserGRBL is a dedicated GRBL software for controlling and interacting with your CNC laser cutting and engraving machines.
Does GRBL have backlash compensation?
No, GRBL does not have backlash compensation. However, you can tweak the G-codes to include backlash compensation in your GRBL system. Various users share their tweaked G-codes in various community forums that you can copy and use for your CNC machine.
The comments are closed.