6.3. grbl firmware for Arduino CNC motion

We will be using the grbl Arduino firmware for the exercises utilizing stepper motor drivers and the CNC Arduino Shield. This open-source software is designed for three-axis control of stepper-motor based CNC machines. It receives ASCII commands and G-code and performs smooth linear and circular interpolation for three stepper motors.

In order that we all use an identical version, a specific version has been cloned from github for use in the course. The specific version included is grbl v0.9j, commit SHA 90ad129ad262bd6e785cf11b8387a1c376cdd11a.

The firmware can be installed on an Arduino using the standard IDE, even though it does not actually use the Arduino libraries or API. The complete instructions can be found on the grbl wiki. Following are quick start instructions for grbl installation:

  1. install Arduino IDE if necessary
  2. copy the grbl subfolder named grbl/ into your Arduino libraries folder.
  3. using the Arduino IDE open the grblUpload sketch located within the grbl examples/ folder
  4. set the Board to Arduino Uno using the Tools menu
  5. compile and download as usual

6.3.1. grbl G-codes

G-code implementations are notoriously variant across CNC machines. However, grbl implements a relatively simple and standard subset of G-code. The notable exclusions are related to tool radius compensation, which shouldn’t limit any projects for this course.

Following are references to the specific codes and restrictions:

More general references pertaining to G-code:

6.3.2. grbl Streaming

The Arduino has very little memory to store G-code instructions, so grbl operates strictly in a streaming mode (‘drip-feeding’) without the usual CNC capabilitity to upload an entire program before starting.

We will use a simple Python script to accomplish feeding, but GUI-based applications are available and more friendly for actual CNC use. For more details, see the following: