Grbl is an open-source G-code parser and motion control firmware that runs on small microcontrollers, originally the 8-bit ATmega328P found on the Arduino Uno, and turns G-code commands into precisely timed step and direction pulses for stepper motor drivers. In 3D printing & making, and particularly in CNC & laser cutting, it is the most widespread controller firmware for hobby CNC routers, desktop mills and diode laser engravers.
Grbl was started by Simen Svale Skogsrud and later developed for many years by Sungeun Jeon. The classic AVR branch reached version 1.1, which remains a de facto reference, while 32-bit descendants such as grblHAL and FluidNC carry the same command set to faster processors.
How Grbl controls a machine
Grbl works as a real-time motion controller that receives G-code over a serial link from a host computer, interprets each line and executes it as coordinated axis motion. It does not generate toolpaths itself; CAM software produces the G-code, and a separate program called a G-code sender streams it to the controller line by line.
Inside the firmware, a look-ahead motion planner buffers upcoming moves and calculates trapezoidal acceleration profiles across them, so the machine can keep speed through gentle direction changes instead of stopping at every segment. A step generator driven by hardware timers then emits pulses at rates of roughly 30 kHz on the original AVR, which is sufficient for most hobby machines with typical microstepping.
The table below outlines the main functional blocks of the firmware.
| Block | Function | Practical effect |
|---|---|---|
| G-code parser | Validates and interprets each line | Rejects unsupported or malformed commands |
| Motion planner | Buffers moves, plans acceleration | Smooth motion through short segments |
| Step generator | Produces timed step pulses | Accurate positioning of each axis |
| Real-time handler | Processes urgent single-character commands | Instant feed hold, resume and reset |
| Settings storage | Keeps parameters in EEPROM | Configuration survives power cycles |
Configuring Grbl with dollar settings
Grbl is configured through numbered settings prefixed with a dollar sign, which a user types or sends from the host. Sending $$ lists all current values, and a command such as $100=80 sets a parameter directly without recompiling the firmware.
Correct calibration of these settings is essential for dimensional accuracy and safe operation. Steps per millimeter must match the drive mechanics, while maximum rates and accelerations must stay below the point where the steppers lose steps under load.
| Setting | Meaning | Typical consideration |
|---|---|---|
| $100 to $102 | Steps per millimeter for X, Y and Z | Depends on pulley, lead screw and microstepping |
| $110 to $112 | Maximum rate per axis in mm/min | Limited by motor torque and frame rigidity |
| $120 to $122 | Acceleration per axis in mm/s² | Too high causes lost steps |
| $130 to $132 | Maximum travel per axis in mm | Used for soft limits |
| $22 | Homing cycle enable | Required for repeatable machine zero |
| $32 | Laser mode enable | Allows continuous motion with power changes |
Grbl for laser cutting and engraving
Grbl 1.1 introduced a dedicated laser mode that makes the firmware a common choice for diode laser engravers. With laser mode enabled, the controller changes spindle output power without stopping motion, which is necessary for raster engraving where power varies thousands of times per pass.
The M4 command activates dynamic laser power, which scales output with the actual speed during acceleration and deceleration. This prevents darker burns at corners where the head slows down, a typical artifact of constant power set with M3. Laser software such as LightBurn supports Grbl directly and generates G-code tuned to these modes.
Grbl compared with other controller options
Grbl occupies the lightweight, embedded end of the controller spectrum. LinuxCNC runs on a full PC with a real-time kernel and supports complex kinematics, many axes and extensive customization, while Grbl offloads the user interface to a sender and keeps only motion control on the microcontroller.
| Solution | Hardware | Strength | Limitation |
|---|---|---|---|
| Grbl 1.1 | 8-bit ATmega328P | Simple, proven, inexpensive | Three axes, limited speed and memory |
| grblHAL | 32-bit microcontrollers | Higher step rates, more axes | Board-specific builds |
| FluidNC | ESP32 boards | Wi-Fi, file-based configuration | Different setup model |
| LinuxCNC | PC with real-time kernel | Advanced kinematics and tooling | More complex installation |
For a three-axis router or a diode laser, classic Grbl remains adequate. Machines that need a fourth axis, automatic tool changes or very high feed rates benefit from grblHAL or LinuxCNC.
Operating states, alarms and common mistakes
Grbl reports a machine state such as Idle, Run, Hold, Jog or Alarm in response to the ? status query. An Alarm state locks out motion after events such as a triggered limit switch, a failed homing cycle or a reset during movement, and the user must home the machine or send $X to unlock it.
- Unlocking with $X without homing leaves the controller unaware of the real position, so soft limits cannot protect the machine.
- Wrong steps per millimeter scale every part incorrectly; calibrate by measuring a known move.
- Electrical noise on limit switch wires causes false alarms; shielded cable and filtering help.
- Unsupported G-code, such as tool change commands or canned cycles, triggers error messages and stops the job.
The simple explanation
A CNC machine needs a small brain to move its motors. Grbl is the software inside that brain. A computer sends it simple text instructions. Each one says where to move and how fast. Grbl turns those instructions into exact motor steps.
It is a bit like a translator between a drawing and a pair of hands. The computer plans the work. Grbl makes the motors carry it out smoothly. It is free, small and works on very cheap boards, which is why so many home routers and laser engravers use it.
How it is used in practice
A furniture hobbyist builds a 600 by 600 mm desktop CNC router with stepper motors, GT2 belts on X and Y and a lead screw on Z, controlled by an Arduino Uno with a Grbl-compatible driver shield. After flashing Grbl 1.1, the builder sets steps per millimeter to 80 for the belt axes and 400 for the Z screw.
A test cut of a 100 mm square measures 99.4 mm, so the builder corrects the X and Y values slightly and enables homing with limit switches. The builder also lowers the acceleration to 300 mm/s² after hearing missed steps during fast moves.
The router now cuts drawer pulls from 18 mm oak using G-code from a CAM program, streamed through a desktop sender. Later, the builder mounts a diode laser, enables laser mode with $32=1 and engraves logos on the same machine with dynamic M4 power.