Difference between revisions of "GRBL"

From Robert-Depot
Jump to: navigation, search
(Storing Home)
 
(44 intermediate revisions by the same user not shown)
Line 1: Line 1:
*<code>AVRPATH=/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr</code>
+
[[Home | <<< back to Wiki Home]]
*<code>export DEVPATH=/dev/tty.usbmodem1411</code>
 
*<code>export GRBLHEX=grbl.hex</code>
 
*From grbl directory, run <code>$AVRPATH/bin/avrdude -C$AVRPATH/etc/avrdude.conf -pm328p -carduino -P$DEVPATH -D -Uflash:w:$GRBLHEX</code>
 
**from https://github.com/grbl/grbl/wiki/Flashing-Grbl-to-an-Arduino
 
  
 +
=To compile GRBL and upload to the Arduino=
 +
*Download GRBL: https://github.com/grbl/grbl/archive/master.zip
 +
*unzip grbl-master
 +
*Open Terminal.
 +
*Set the following environment variabels (i.e. run these commands in the terminal):
 +
<syntaxhighlight lang="bash">
 +
export AVRPATH=/Applications/Arduino.app/Contents/Java/hardware/tools/avr/
 +
</syntaxhighlight>
 +
<syntaxhighlight lang="bash">
 +
export DEVPATH=/dev/tty.usbmodem1411
 +
</syntaxhighlight>
 +
***(note: DEVPATH should match the name of your currently connected arduino. you can find this from arduino software under Port selection)
 +
<syntaxhighlight lang="bash">
 +
export GRBLHEX=grbl.hex
 +
</syntaxhighlight>
 +
*Add the avr compiler's to your PATH. type this into the terminal:
 +
<syntaxhighlight lang="bash">
 +
export PATH="$PATH:$AVRPATH/bin"
 +
</syntaxhighlight>
 +
*Change to the grbl directory:
 +
<syntaxhighlight lang="bash">
 +
cd ~/Downloads/grbl-master
 +
</syntaxhighlight>
 +
**NOTE: replace <code>~/Downloads</code> with the full path where you downloaded GRBL.
 +
*Compile GRBL. In the grbl-master director, type:
 +
<syntaxhighlight lang="bash">
 +
make
 +
</syntaxhighlight>
 +
GRBL should compile.
 +
*Upload GRBL to the arduino. From the grbl-master directory, run:
 +
<syntaxhighlight lang="bash">
 +
$AVRPATH/bin/avrdude -C$AVRPATH/etc/avrdude.conf -pm328p -carduino -P$DEVPATH -D -Uflash:w:$GRBLHEX
 +
</syntaxhighlight>
 +
adapted from here: https://github.com/grbl/grbl/wiki/Flashing-Grbl-to-an-Arduino
 +
==Upload to Nano V3.0 (slower baud rate)==
 +
Needs 57600 baud rate instead of default uno 115200
 +
<syntaxhighlight lang="bash">
 +
$AVRPATH/bin/avrdude -C$AVRPATH/etc/avrdude.conf -b57600 -pm328p -carduino -P$DEVPATH -D -Uflash:w:$GRBLHEX
 +
</syntaxhighlight>
  
== My GRBL defaults ==
+
== How to connect pins of Arduino for GRBL ==
<code>
+
https://dl.dropbox.com/u/2221997/Grbl_Pin_Diagram.png
 +
https://github.com/grbl/grbl/wiki/Connecting-Grbl
 +
 
 +
== What the GRBL settings mean, and how to change them ==
 +
*https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.8
 +
 
 +
== GCode Command Reference ==
 +
These are the standard GCode commands implemented by GRBL:
 +
* https://github.com/grbl/grbl/wiki
 +
==Getting Started with GRBL Commands==
 +
Some basic GRBL commands
 +
*How to pull up the help menu: <code>$</code>
 +
*fast move (G0) (a.k.a "seek")
 +
*slow move (G1)
 +
*Absolute vs. Relative positioning:
 +
<pre>
 +
G90 # absolute positioning
 +
G92 X10.0 y1.0 # set coordinates of current position
 +
</pre>
 +
 
 +
*Homing routines. what is a homing routine.
 +
*feed hold and resume.
 +
*interrupting a command and starting something totally new (though keeping your position information)
 +
**reset GRBL.<code>ctrl-x</code>
 +
*querying your position: <code>?</code>
 +
*How to configure GRBL: see next section.
 +
 
 +
== My GRBL Settings ==  
 +
<pre>
 
$0=28.175 (x, step/mm)
 
$0=28.175 (x, step/mm)
 
$1=28.175 (y, step/mm)
 
$1=28.175 (y, step/mm)
Line 29: Line 92:
 
$19=25.000 (homing feed, mm/min)
 
$19=25.000 (homing feed, mm/min)
 
$20=250.000 (homing seek, mm/min)
 
$20=250.000 (homing seek, mm/min)
 +
$21=100 (homing debounce, msec)
 +
$22=1.000 (homing pull-off, mm)
 +
</pre>
 +
 +
=== current 20130703 pre-homing save===
 +
<pre>
 +
Grbl 0.8c ['$' for help]
 +
G20ok
 +
G91M3ok
 +
$0=6.964 (x, step/mm)
 +
$1=6.964 (y, step/mm)
 +
$2=6.964 (z, step/mm)
 +
$3=10 (step pulse, usec)
 +
$4=20320.000 (default feed, mm/min)
 +
$5=65000.000 (default seek, mm/min)
 +
$6=56 (step port invert mask, int:00111000)
 +
$7=25 (step idle delay, msec)
 +
$8=900.000 (acceleration, mm/sec^2)
 +
$9=0.050 (junction deviation, mm)
 +
$10=0.100 (arc, mm/segment)
 +
$11=25 (n-arc correction, int)
 +
$12=3 (n-decimals, int)
 +
$13=1 (report inches, bool)
 +
$14=1 (auto start, bool)
 +
$15=0 (invert step enable, bool)
 +
$16=0 (hard limits, bool)
 +
$17=0 (homing cycle, bool)
 +
$18=0 (homing dir invert mask, int:00000000)
 +
$19=25.000 (homing feed, mm/min)
 +
$20=250.000 (homing seek, mm/min)
 +
$21=100 (homing debounce, msec)
 +
$22=1.000 (homing pull-off, mm)
 +
</pre>
 +
 +
=== With Homing ===
 +
<pre>
 +
$0=28.175 (x, step/mm)
 +
$1=28.175 (y, step/mm)
 +
$2=250.000 (z, step/mm)
 +
$3=10 (step pulse, usec)
 +
$4=500.000 (default feed, mm/min)
 +
$5=10000.000 (default seek, mm/min)
 +
$6=56 (step port invert mask, int:00111000)
 +
$7=25 (step idle delay, msec)
 +
$8=500.000 (acceleration, mm/sec^2)
 +
$9=0.050 (junction deviation, mm)
 +
$10=0.100 (arc, mm/segment)
 +
$11=25 (n-arc correction, int)
 +
$12=3 (n-decimals, int)
 +
$13=0 (report inches, bool)
 +
$14=1 (auto start, bool)
 +
$15=0 (invert step enable, bool)
 +
$16=0 (hard limits, bool)
 +
$17=1 (homing cycle, bool)
 +
$18=255 (homing dir invert mask, int:11111111)
 +
$19=400.000 (homing feed, mm/min)
 +
$20=2000.000 (homing seek, mm/min)
 +
$21=100 (homing debounce, msec)
 +
$22=1.000 (homing pull-off, mm)
 +
</pre>
 +
===trying to improve continuation of stroke behavior===
 +
<pre>
 +
$0=6.964 (x, step/mm)
 +
$1=6.964 (y, step/mm)
 +
$2=6.964 (z, step/mm)
 +
$3=10 (step pulse, usec)
 +
$4=20320.000 (default feed, mm/min)
 +
$5=65000.000 (default seek, mm/min)
 +
$6=56 (step port invert mask, int:00111000)
 +
$7=25 (step idle delay, msec)
 +
$8=900.000 (acceleration, mm/sec^2)
 +
$9=0.050 (junction deviation, mm)
 +
$10=0.100 (arc, mm/segment)
 +
$11=25 (n-arc correction, int)
 +
$12=3 (n-decimals, int)
 +
$13=1 (report inches, bool)
 +
$14=1 (auto start, bool)
 +
$15=0 (invert step enable, bool)
 +
$16=0 (hard limits, bool)
 +
$17=1 (homing cycle, bool)
 +
$18=0 (homing dir invert mask, int:00000000)
 +
$19=400.000 (homing feed, mm/min)
 +
$20=10000.000 (homing seek, mm/min)
 
$21=100 (homing debounce, msec)
 
$21=100 (homing debounce, msec)
 
$22=1.000 (homing pull-off, mm)
 
$22=1.000 (homing pull-off, mm)
 
ok
 
ok
ok
+
</pre>
</code>
+
===GRBL 1 - 20131129 ===
 +
<pre>
 +
$0=6.964 (x, step/mm)
 +
$1=6.964 (y, step/mm)
 +
$2=6.964 (z, step/mm)
 +
$3=10 (step pulse, usec)
 +
$4=20320.000 (default feed, mm/min)
 +
$5=65000.000 (default seek, mm/min)
 +
$6=56 (step port invert mask, int:00111000)
 +
$7=25 (step idle delay, msec)
 +
$8=900.000 (acceleration, mm/sec^2)
 +
$9=0.050 (junction deviation, mm)
 +
$10=0.100 (arc, mm/segment)
 +
$11=25 (n-arc correction, int)
 +
$12=3 (n-decimals, int)
 +
$13=1 (report inches, bool)
 +
$14=1 (auto start, bool)
 +
$15=0 (invert step enable, bool)
 +
$16=0 (hard limits, bool)
 +
$17=1 (homing cycle, bool)
 +
$18=0 (homing dir invert mask, int:00000000)
 +
$19=400.000 (homing feed, mm/min)
 +
$20=10000.000 (homing seek, mm/min)
 +
$21=100 (homing debounce, msec)
 +
$22=1.000 (homing pull-off, mm)
 +
</pre>
 +
=== GRBL2 - 20131210 ===
 +
<pre>
 +
['$H'|'$X' to unlock]
 +
$0=14.000 (x, step/mm)
 +
$1=14.000 (y, step/mm)
 +
$2=250.000 (z, step/mm)
 +
$3=10 (step pulse, usec)
 +
$4=2540.000 (default feed, mm/min)
 +
$5=15240.000 (default seek, mm/min)
 +
$6=32 (step port invert mask, int:00100000)
 +
$7=25 (step idle delay, msec)
 +
$8=1000.000 (acceleration, mm/sec^2)
 +
$9=0.050 (junction deviation, mm)
 +
$10=0.100 (arc, mm/segment)
 +
$11=25 (n-arc correction, int)
 +
$12=3 (n-decimals, int)
 +
$13=0 (report inches, bool)
 +
$14=1 (auto start, bool)
 +
$15=0 (invert step enable, bool)
 +
$16=0 (hard limits, bool)
 +
$17=1 (homing cycle, bool)
 +
$18=0 (homing dir invert mask, int:00000000)
 +
$19=1000.000 (homing feed, mm/min)
 +
$20=5000.000 (homing seek, mm/min)
 +
$21=100 (homing debounce, msec)
 +
$22=2.550 (homing pull-off, mm)
 +
</pre>
 +
 
 +
== Buffer overflows==
 +
<pre>
 +
// Serial send and receive buffer size. The receive buffer is often used as another streaming
 +
// buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming
 +
// interfaces will character count and track each block send to each block response. So,
 +
// increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable
 +
// memory allows. The send buffer primarily handles messages in Grbl. Only increase if large
 +
// messages are sent and Grbl begins to stall, waiting to send the rest of the message.
 +
// #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h
 +
// #define TX_BUFFER_SIZE 64
 +
</pre>
 +
https://github.com/grbl/grbl/blob/master/config.h#L194
 +
==Storing Home==
 +
# Home: <syntaxhighlight lang="bash">$H</syntaxhighlight>
 +
# Query position: <syntaxhighlight lang="bash">?</syntaxhighlight> response <syntaxhighlight lang="bash"><Idle,MPos:0.000,199.800,0.000,WPos:0.000,0.002,0.000></syntaxhighlight>
 +
# Store home (using X and Y from query, 0 and 199.8 in the example above): <syntaxhighlight lang="bash">G10L2P0X0Y199.8</syntaxhighlight>
 +
# Query again to check that it worked: <syntaxhighlight lang="bash">?</syntaxhighlight> WPos should be 0,0,0 <syntaxhighlight lang="bash"><Idle,MPos:0.000,199.800,0.000,WPos:0.000,0.000,0.000></syntaxhighlight>
 +
 
 +
=GIKFUN wch340 serial=
 +
*disable system integrity protection:
 +
**boot into recovery: CMD-r
 +
**open terminal
 +
**run:
 +
<syntaxhighlight lang="bash">csrutil disable</syntaxhighlight>
 +
*install driver http://www.wch.cn/download/CH341SER_MAC_ZIP.html
 +
reference: https://tzapu.com/making-ch340-ch341-serial-adapters-work-under-el-capitan-os-x/

Latest revision as of 13:04, 5 May 2016

<<< back to Wiki Home

To compile GRBL and upload to the Arduino

export AVRPATH=/Applications/Arduino.app/Contents/Java/hardware/tools/avr/
export DEVPATH=/dev/tty.usbmodem1411
      • (note: DEVPATH should match the name of your currently connected arduino. you can find this from arduino software under Port selection)
export GRBLHEX=grbl.hex
  • Add the avr compiler's to your PATH. type this into the terminal:
export PATH="$PATH:$AVRPATH/bin"
  • Change to the grbl directory:
cd ~/Downloads/grbl-master
    • NOTE: replace ~/Downloads with the full path where you downloaded GRBL.
  • Compile GRBL. In the grbl-master director, type:
make

GRBL should compile.

  • Upload GRBL to the arduino. From the grbl-master directory, run:
$AVRPATH/bin/avrdude -C$AVRPATH/etc/avrdude.conf -pm328p -carduino -P$DEVPATH -D -Uflash:w:$GRBLHEX

adapted from here: https://github.com/grbl/grbl/wiki/Flashing-Grbl-to-an-Arduino

Upload to Nano V3.0 (slower baud rate)

Needs 57600 baud rate instead of default uno 115200

$AVRPATH/bin/avrdude -C$AVRPATH/etc/avrdude.conf -b57600 -pm328p -carduino -P$DEVPATH -D -Uflash:w:$GRBLHEX

How to connect pins of Arduino for GRBL

Grbl_Pin_Diagram.png https://github.com/grbl/grbl/wiki/Connecting-Grbl

What the GRBL settings mean, and how to change them

GCode Command Reference

These are the standard GCode commands implemented by GRBL:

Getting Started with GRBL Commands

Some basic GRBL commands

  • How to pull up the help menu: $
  • fast move (G0) (a.k.a "seek")
  • slow move (G1)
  • Absolute vs. Relative positioning:
 G90 # absolute positioning 
 G92 X10.0 y1.0 # set coordinates of current position
  • Homing routines. what is a homing routine.
  • feed hold and resume.
  • interrupting a command and starting something totally new (though keeping your position information)
    • reset GRBL.ctrl-x
  • querying your position: ?
  • How to configure GRBL: see next section.

My GRBL Settings

$0=28.175 (x, step/mm)
$1=28.175 (y, step/mm)
$2=250.000 (z, step/mm)
$3=10 (step pulse, usec)
$4=17780.000 (default feed, mm/min)
$5=17780.000 (default seek, mm/min)
$6=56 (step port invert mask, int:00111000)
$7=25 (step idle delay, msec)
$8=500.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
$10=0.100 (arc, mm/segment)
$11=25 (n-arc correction, int)
$12=3 (n-decimals, int)
$13=0 (report inches, bool)
$14=1 (auto start, bool)
$15=0 (invert step enable, bool)
$16=0 (hard limits, bool)
$17=0 (homing cycle, bool)
$18=0 (homing dir invert mask, int:00000000)
$19=25.000 (homing feed, mm/min)
$20=250.000 (homing seek, mm/min)
$21=100 (homing debounce, msec)
$22=1.000 (homing pull-off, mm)

current 20130703 pre-homing save

Grbl 0.8c ['$' for help]
G20ok
G91M3ok
$0=6.964 (x, step/mm)
$1=6.964 (y, step/mm)
$2=6.964 (z, step/mm)
$3=10 (step pulse, usec)
$4=20320.000 (default feed, mm/min)
$5=65000.000 (default seek, mm/min)
$6=56 (step port invert mask, int:00111000)
$7=25 (step idle delay, msec)
$8=900.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
$10=0.100 (arc, mm/segment)
$11=25 (n-arc correction, int)
$12=3 (n-decimals, int)
$13=1 (report inches, bool)
$14=1 (auto start, bool)
$15=0 (invert step enable, bool)
$16=0 (hard limits, bool)
$17=0 (homing cycle, bool)
$18=0 (homing dir invert mask, int:00000000)
$19=25.000 (homing feed, mm/min)
$20=250.000 (homing seek, mm/min)
$21=100 (homing debounce, msec)
$22=1.000 (homing pull-off, mm)

With Homing

$0=28.175 (x, step/mm)
$1=28.175 (y, step/mm)
$2=250.000 (z, step/mm)
$3=10 (step pulse, usec)
$4=500.000 (default feed, mm/min)
$5=10000.000 (default seek, mm/min)
$6=56 (step port invert mask, int:00111000)
$7=25 (step idle delay, msec)
$8=500.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
$10=0.100 (arc, mm/segment)
$11=25 (n-arc correction, int)
$12=3 (n-decimals, int)
$13=0 (report inches, bool)
$14=1 (auto start, bool)
$15=0 (invert step enable, bool)
$16=0 (hard limits, bool)
$17=1 (homing cycle, bool)
$18=255 (homing dir invert mask, int:11111111)
$19=400.000 (homing feed, mm/min)
$20=2000.000 (homing seek, mm/min)
$21=100 (homing debounce, msec)
$22=1.000 (homing pull-off, mm)

trying to improve continuation of stroke behavior

$0=6.964 (x, step/mm)
$1=6.964 (y, step/mm)
$2=6.964 (z, step/mm)
$3=10 (step pulse, usec)
$4=20320.000 (default feed, mm/min)
$5=65000.000 (default seek, mm/min)
$6=56 (step port invert mask, int:00111000)
$7=25 (step idle delay, msec)
$8=900.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
$10=0.100 (arc, mm/segment)
$11=25 (n-arc correction, int)
$12=3 (n-decimals, int)
$13=1 (report inches, bool)
$14=1 (auto start, bool)
$15=0 (invert step enable, bool)
$16=0 (hard limits, bool)
$17=1 (homing cycle, bool)
$18=0 (homing dir invert mask, int:00000000)
$19=400.000 (homing feed, mm/min)
$20=10000.000 (homing seek, mm/min)
$21=100 (homing debounce, msec)
$22=1.000 (homing pull-off, mm)
ok

GRBL 1 - 20131129

$0=6.964 (x, step/mm)
$1=6.964 (y, step/mm)
$2=6.964 (z, step/mm)
$3=10 (step pulse, usec)
$4=20320.000 (default feed, mm/min)
$5=65000.000 (default seek, mm/min)
$6=56 (step port invert mask, int:00111000)
$7=25 (step idle delay, msec)
$8=900.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
$10=0.100 (arc, mm/segment)
$11=25 (n-arc correction, int)
$12=3 (n-decimals, int)
$13=1 (report inches, bool)
$14=1 (auto start, bool)
$15=0 (invert step enable, bool)
$16=0 (hard limits, bool)
$17=1 (homing cycle, bool)
$18=0 (homing dir invert mask, int:00000000)
$19=400.000 (homing feed, mm/min)
$20=10000.000 (homing seek, mm/min)
$21=100 (homing debounce, msec)
$22=1.000 (homing pull-off, mm)

GRBL2 - 20131210

['$H'|'$X' to unlock]
$0=14.000 (x, step/mm)
$1=14.000 (y, step/mm)
$2=250.000 (z, step/mm)
$3=10 (step pulse, usec)
$4=2540.000 (default feed, mm/min)
$5=15240.000 (default seek, mm/min)
$6=32 (step port invert mask, int:00100000)
$7=25 (step idle delay, msec)
$8=1000.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
$10=0.100 (arc, mm/segment)
$11=25 (n-arc correction, int)
$12=3 (n-decimals, int)
$13=0 (report inches, bool)
$14=1 (auto start, bool)
$15=0 (invert step enable, bool)
$16=0 (hard limits, bool)
$17=1 (homing cycle, bool)
$18=0 (homing dir invert mask, int:00000000)
$19=1000.000 (homing feed, mm/min)
$20=5000.000 (homing seek, mm/min)
$21=100 (homing debounce, msec)
$22=2.550 (homing pull-off, mm)

Buffer overflows

// Serial send and receive buffer size. The receive buffer is often used as another streaming
// buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming
// interfaces will character count and track each block send to each block response. So, 
// increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable
// memory allows. The send buffer primarily handles messages in Grbl. Only increase if large
// messages are sent and Grbl begins to stall, waiting to send the rest of the message.
// #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h
// #define TX_BUFFER_SIZE 64

https://github.com/grbl/grbl/blob/master/config.h#L194

Storing Home

  1. Home:
    $H
    
  2. Query position:
    ?
    
    response
    <Idle,MPos:0.000,199.800,0.000,WPos:0.000,0.002,0.000>
    
  3. Store home (using X and Y from query, 0 and 199.8 in the example above):
    G10L2P0X0Y199.8
    
  4. Query again to check that it worked:
    ?
    
    WPos should be 0,0,0
    <Idle,MPos:0.000,199.800,0.000,WPos:0.000,0.000,0.000>
    

GIKFUN wch340 serial

  • disable system integrity protection:
    • boot into recovery: CMD-r
    • open terminal
    • run:
csrutil disable

reference: https://tzapu.com/making-ch340-ch341-serial-adapters-work-under-el-capitan-os-x/