GRBL - dlx-designlab/Attune GitHub Wiki
We use GRBL to control the X,Y,Z axis stepper motors on the self-positioning scope rig. We are using GRBL 1.1 which comes pre-installed on the RaspberryPi CNC Hat.
More information about working with and configuring GRBL can be found on the GRBL Settings Wiki
:warning: IMPORTANT: Double Check the VREF of the motor drives before performing the calibration below.
The voltage on each motor should be 200 mV
but you can increase it to 500 mV
max if the motor has difficulties to move.
The easiest way to configure and check GRBL settings, such as motion limits and motor behavior is via the bCNC software:
- If it's not pre-installed on the system, get it via pip:
sudo pip3 install --upgrade bCNC sudo apt-get install python3-tk
- Run:
sudo python3 -m bCNC
- In "File" tab, select the right port (e.g. /dev/ttlUSB0), Baud (for GRBL 1.1 it's 115200), GRBL version and click "OPEN"
- In "Terminal" tab type
$$
in the "command" box and check the settings correspond to the template below - Check limit switches are Installed and GRBL settings $20-$22 are set to "1"
- :warning: IMPORTANT: BE READY to UNPLUG MOTORS POWER supply in case the homing cycle goes in the wrong direction - away from the limit switches.
- In "Control" tab, click "Home" to check homing cycle works as expected.
- :warning: IMPORTANT: Once Homing is complete, click "XYZ=0".
"WPos" should update to 0,0,0
"MPos" should update to the soft limits (settings $130-132) negative values + the value of setting $27.
For example if $13=16 and $27=2, after "Homing" the MPos for X axis should be -15 + 2 = -13mm - Check motors motion smoothness, speed, noise and range using the control-arrows buttons
- Double check the "WPos" is set to 0,0,0 and "MPos" to the soft limits negative values after "Homing".
Sample Settings For our device v1.1:
$0=10 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=1 (dir port invert mask:00000001)
$4=0 (step enable invert, bool)
$5=0 (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=1 (soft limits, bool)
$21=1 (hard limits, bool)
$22=1 (homing cycle, bool)
$23=7 (homing dir invert mask:00000000)
$24=400.000 (homing feed, mm/min)
$25=600.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=2.000 (homing pull-off, mm)
$30=1000
$31=0
$32=0
$100=200.000 (x, step/mm)
$101=200.000 (y, step/mm)
$102=100.000 (z, step/mm)
$110=600.000 (x max rate, mm/min)
$111=600.000 (y max rate, mm/min)
$112=500.000 (z max rate, mm/min)
$120=150.000 (x accel, mm/sec^2)
$121=150.000 (y accel, mm/sec^2)
$122=150.000 (z accel, mm/sec^2)
$130=15.000 (x max travel, mm)
$131=17.000 (y max travel, mm)
$132=15.000 (z max travel, mm)
GRBL Settings update October 3rd 2023:
$0=10
$1=100
$2=0
$3=1
$4=0
$5=0
$6=0
$10=3
$11=0.010
$12=0.002
$13=0
$20=1
$21=1
$22=1
$23=7
$24=400.000
$25=600.000
$26=250
$27=2.000
$30=1000
$31=0
$32=0
$100=200.000
$101=200.000
$102=100.000
$110=800.000
$111=800.000
$112=1200.000
$120=400.000
$121=400.000
$122=800.000
$130=16.000
$131=17.000
$132=15.000