Skip to content

GRBL & GCode Control

AngelLM edited this page Jul 24, 2017 · 6 revisions

GRBL & GCode Control

Compiling and Uploading GRBL to the Arduino Mega board.

It's suggested to follow this links of the official GRBL wiki to learn how to generate the .hex file and then how to flash it into the Arduino Mega.

If you want to modify the firmware's code, first modify it using your favorite text editor then compile it and then flash it to the board.

Controlling Thor via Gcode

Universal GCode Sender can be used to send the GCodes to the board. Gcodes can be sent typing them in the dialog box and pressing SEND button (or enter). They can also be sent making a .gcode file and opening it with the GCode Sender (this is pretty useful to program a movement sequence)

Move : G0 & G1

Usage

G0 Annn Bnnn Cnnn Dnnn Xnnn Ynnn Znnn Fnnn
G1 Annn Bnnn Cnnn Dnnn Xnnn Ynnn Znnn Fnnn

Variables

Not all variables need to be used, but at least one has to be used

  • Annn : The angle to rotate to on the First Articulation (Motor #1)
  • Bnnn : The angle to rotate to on the Second Articulation (Motor #2)
  • Cnnn : The angle to rotate to on the Second Articulation (Motor #3)
  • Dnnn : The angle to rotate to on the Third Articulation (Motor #4)
  • Xnnn : The angle to rotate to on the Forth Articulation (Motor #5)
  • Ynnn : The angle to rotate to on the Fifth & Sixth Articulation (Motor #6)
  • Znnn : The angle to rotate to on the Fifth & Sixth Articulation (Motor #7)
  • Fnnn : The feedrate per minute of the move between the starting angle and ending angle (if supplied)

Note: B&C must be the same number

Examples

G0 A10 B45 C45 D-45 X15 Y5 Z-5
This code will move to 10º the 1st Art., to 45º the 2nd Art., to -45º the 3rd Art., to 15º the 4th Art. and will rotate the wrist (5th&6th Art)

G1 A20 X-20 F1000
This code will move to 20º the 1st Art. and to -20º the 4th Art at 1000 degrees/min speed

Tool : M3

Usage

M3 Snnn

Variables

  • Snnn : Output tool signal value

GRBL Commands

GRBL also has its own commands, here is a list. The most useful ones are:

My $$ settings

$0=10 (step pulse, usec)
$1=255 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=0 (dir port invert mask:00000000)
$4=0 (step enable invert, bool)
$5=1 (limit pins invert, bool)
$6=0 (probe pin invert, bool)
$10=3 (status report mask:00000011)
$11=0.010 (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=1 (homing cycle, bool)
$23=0 (homing dir invert mask:00000000)
$24=25.000 (homing feed, mm/min)
$25=500.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=2.000 (homing pull-off, mm)
$100=44.500 (a, step/mm)
$101=270.000 (b, step/mm)
$102=270.000 (c, step/mm)
$103=265.000 (d, step/mm)
$104=20.000 (e, step/mm)
$105=250.000 (f, step/mm)
$106=250.000 (g, step/mm)
$110=2000.000 (a max rate, mm/min)
$111=800.000 (b max rate, mm/min)
$112=800.000 (c max rate, mm/min)
$113=800.000 (d max rate, mm/min)
$114=2000.000 (e max rate, mm/min)
$115=500.000 (f max rate, mm/min)
$116=500.000 (g max rate, mm/min)
$120=10.000 (a accel, mm/sec^2)
$121=10.000 (b accel, mm/sec^2)
$122=10.000 (c accel, mm/sec^2)
$123=10.000 (d accel, mm/sec^2)
$124=10.000 (e accel, mm/sec^2)
$125=10.000 (f accel, mm/sec^2)
$126=10.000 (g accel, mm/sec^2)
$130=200.000 (a max travel, mm)
$131=200.000 (b max travel, mm)
$132=200.000 (c max travel, mm)
$133=200.000 (d max travel, mm)
$134=200.000 (e max travel, mm)
$135=200.000 (f max travel, mm)
$136=200.000 (g max travel, mm)