這段期間研究GBRL的source code,也越來越清楚如何“客製”這些GPIO pins。
因為PCB-CNCv1.0的layout做了些改變,必須修改Grbl的pin define。
cpu_map_atmega328p.h:
#define X_STEP_BIT 3 // Uno Digital Pin 3
#define Y_STEP_BIT 4 // Uno Digital Pin 4
#define Z_STEP_BIT 6 // Uno Digital Pin 6
#define X_DIRECTION_BIT 2 // Uno Digital Pin 2
#define Y_DIRECTION_BIT 5 // Uno Digital Pin 5
#define Z_DIRECTION_BIT 7 // Uno Digital Pin 7
#define X_LIMIT_BIT 4 // Uno Digital Pin 12
#define Y_LIMIT_BIT 3 // Uno Digital Pin 11
#define Z_LIMIT_BIT 1 // Uno Digital Pin 9
//Regis
// Define probe switch input pin.
#define PROBE_DDR DDRB
#define PROBE_PIN PINB
#define PROBE_PORT PORTB
#define PROBE_BIT 2 // Uno Digital Pin 10
在Auto probe的部份,我搞了好久才搞懂如何與bCNC做自動測距!我一直以為是Z軸的pin,原來還有一根probe來設定。
公式:步進數 = 360/步距角/螺距 x A4988微步細分 x 齒輪減速比
42步進電機:
步距角:1.8°
M8螺距:1.25mm
A4988: 16 step
X/Y軸 步進數 = 360/1.8/1.25 x 16 x (21/21) = 2560
Z軸 步進數 = 360/1.8/1.25 x 16 x (15/8) = 4800
步距角:1.8°
M8螺距:1.25mm
A4988: 16 step
X/Y軸 步進數 = 360/1.8/1.25 x 16 x (21/21) = 2560
Z軸 步進數 = 360/1.8/1.25 x 16 x (15/8) = 4800
有兩種方法:
修改defaults_generic.h
#define DEFAULT_X_STEPS_PER_MM 2560
#define DEFAULT_Y_STEPS_PER_MM 2560
#define DEFAULT_Z_STEPS_PER_MM 4800
或者透過UART直接在GRBL firmware內設定:
$100=2560
$101=2560
$102=4800
更多command參考:https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9
全部設定:
$0=4 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=3 (dir port invert mask:00000011)
$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=0 (hard limits, bool)
$22=1 (homing cycle, bool)
$23=3 (homing dir invert mask:00000011)
$24=30.000 (homing feed, mm/min)
$25=400.000 (homing seek, mm/min)
$26=25 (homing debounce, msec)
$27=1.500 (homing pull-off, mm)
$100=2560.000 (x, step/mm)
$101=2560.000 (y, step/mm)
$102=4800.000 (z, step/mm)
$110=400.000 (x max rate, mm/min)
$111=400.000 (y max rate, mm/min)
$112=400.000 (z max rate, mm/min)
$120=5.000 (x accel, mm/sec^2)
$121=5.000 (y accel, mm/sec^2)
$122=10.000 (z accel, mm/sec^2)
$130=160.000 (x max travel, mm)
$131=100.000 (y max travel, mm)
$132=33.000 (z max travel, mm)
現在PCB與firmware都差不多設定完成,列印件是個挑戰了,因為每一件都很大件,打印時間都要好幾個小時,尤其是X軸的frame,左右兩邊各自要6個多小時啊!!!!
#define DEFAULT_Y_STEPS_PER_MM 2560
#define DEFAULT_Z_STEPS_PER_MM 4800
或者透過UART直接在GRBL firmware內設定:
$100=2560
$101=2560
$102=4800
更多command參考:https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9
全部設定:
$0=4 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=3 (dir port invert mask:00000011)
$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=0 (hard limits, bool)
$22=1 (homing cycle, bool)
$23=3 (homing dir invert mask:00000011)
$24=30.000 (homing feed, mm/min)
$25=400.000 (homing seek, mm/min)
$26=25 (homing debounce, msec)
$27=1.500 (homing pull-off, mm)
$100=2560.000 (x, step/mm)
$101=2560.000 (y, step/mm)
$102=4800.000 (z, step/mm)
$110=400.000 (x max rate, mm/min)
$111=400.000 (y max rate, mm/min)
$112=400.000 (z max rate, mm/min)
$120=5.000 (x accel, mm/sec^2)
$121=5.000 (y accel, mm/sec^2)
$122=10.000 (z accel, mm/sec^2)
$130=160.000 (x max travel, mm)
$131=100.000 (y max travel, mm)
$132=33.000 (z max travel, mm)
現在PCB與firmware都差不多設定完成,列印件是個挑戰了,因為每一件都很大件,打印時間都要好幾個小時,尤其是X軸的frame,左右兩邊各自要6個多小時啊!!!!
沒有留言:
張貼留言