In order to work with the
Arduino CNC Shield and to to
interpret the GCODE we use
GRBL software.
Grbl is a no-compromise, high performance, low cost alternative to parallel-port-based motion control for CNC milling. It will run on a vanilla Arduino (Duemillanove/Uno) as long as it sports an Atmega 328.
Flashing it in our Arduino Uno was very simple: we downloaded the source code from
Here, we unzipped the folder and we copied the
grbl folder inside Arduino IDE's
Libraries folder (in Mac OS
Arduino app/Contents/Java/libraries).
Than we connected our Arduino board and we upload the example sketch named
grblUpload. Than we opened the Arduino Serial Monitor and, after setting up
Return cart and
115200 baud rate this is the result:
A complete list of GRBL commands is available
Here.
Using one of them we tried to communicate with the board using the simple command
g1 x10 y10 f200 and the result was "ok", so GRBL was properly uploaded and ready to use. The command means:
G1 - it's for motion mode. Means "go to coordinate X, Y... at speed F that I will tell you"
X10 - point 10 on X axis
Y10 - point 10 on Y axis
F200 - it's the feed rate
After that we searching online something could be useful for us to control a servo motor via GRBL. We found a good solution inside
This Tutorial: basically it explain how to move two stepper motors for X and Y axis and use a servo for the Z. But it asks to modify GRBL software to be flashed again on Arduino board.
The first condition is to use a modified version of
spindle_control.c available
Here to be copied inside the GRBL replacing the original one in the folder in Arduino IDE example folder.This allows us to control the servo motor via gcode.The second is to modify the
config.h file at line 189, uncommenting
#define COREXY;
. We are saying "
Hey, GRBL, I want to work with a CoreXY mechanism!"
Than we open again Arduino IDE and upload again GRBL using
grblUpload sketch with these new changes.
--> Download modified config.h
--> Download modified spindle_control.c
During this occasion we also setted up
steps and
max rate for X and Y axis. According with
Official GRBL Setting Guide, we launched these commands via serial monitor:
$100=51
--> X steps/mm
$101=51
--> Y steps/mm
$110=600
--> X max rate, mm/min
$111=600
--> Y max rate, mm/min
The formula to calculate steps/mm is:
steps_per_mm = (steps_per_revolution*microsteps)/mm_per_rev, where:
steps_per_revolution = 200
microsteps = 8
mm_per_rev = 10*π