All,
As promised on a previous thread I've made an adapter for the Gecko G540 as well as sorting out the parameters required for the Sherline/Gecko package. I'm still working on the lathe and need to sort out the rotary encoder. The adapter is as simple as possible, connecting only the step and dir pins for the 4 axis of the gecko.
REMEMBER TO DISABLE THE CHARGE PUMP ON THE G540 USING THE SWITCH if using this adapter board.
I have now built and tested the boards, so am happy to release the board design files as open-source. Please don't sell the boards I've designed, check the license. The Eagle files can be downloaded here.
I've written a little C Program that helps to configure the board. I found this most straightforward when testing as I'm not a mouse person so hate clicking things.
Code:
#include "KMotionDef.h"
// Defines axis 0, 1, 2 as simple step dir outputs
// enables them
// sets them as an xyz coordinate system for GCode
const int X=0, Y=1, Z=2, A=3;
const double VEL=66000;
const double ACCEL=160000;
const double JERK=4e+006;
const double PIDP=0, PIDI=0.01, PIDD=0;
int main() {
FPGA(STEP_PULSE_LENGTH_ADD)=32+0x80;
ch0->InputMode=NO_INPUT_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel=VEL;
ch0->Accel=ACCEL;
ch0->Jerk=JERK;
ch0->P=PIDP;
ch0->I=PIDI;
ch0->D=PIDD;
ch0->OutputChan0=X+8;
ch0->LimitSwitchOptions=0x100;
ch0->LimitSwitchNegBit=0;
ch0->LimitSwitchPosBit=0;
ch0->SoftLimitPos=1e+009;
ch0->SoftLimitNeg=-1e+009;
ch0->BacklashMode=BACKLASH_OFF;
ch0->BacklashAmount=0;
ch0->BacklashRate=0;
ch1->InputMode=NO_INPUT_MODE;
ch1->OutputMode=STEP_DIR_MODE;
ch1->Vel=VEL;
ch1->Accel=ACCEL;
ch1->Jerk=JERK;
ch1->P=PIDP;
ch1->I=PIDI;
ch1->D=PIDD;
ch1->OutputChan0=Y+8;
ch1->LimitSwitchOptions=0x100;
ch1->LimitSwitchNegBit=0;
ch1->LimitSwitchPosBit=0;
ch1->SoftLimitPos=1e+009;
ch1->SoftLimitNeg=-1e+009;
ch1->BacklashMode=BACKLASH_OFF;
ch1->BacklashAmount=0;
ch1->BacklashRate=0;
ch2->InputMode=NO_INPUT_MODE;
ch2->OutputMode=STEP_DIR_MODE;
ch2->Vel=VEL;
ch2->Accel=ACCEL;
ch2->Jerk=JERK;
ch2->P=PIDP;
ch2->I=PIDI;
ch2->D=PIDD;
ch2->OutputChan0=Z+8;
ch2->LimitSwitchOptions=0x100;
ch2->LimitSwitchNegBit=0;
ch2->LimitSwitchPosBit=0;
ch2->SoftLimitPos=1e+009;
ch2->SoftLimitNeg=-1e+009;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch3->InputMode=NO_INPUT_MODE;
ch3->OutputMode=STEP_DIR_MODE;
ch3->Vel=VEL;
ch3->Accel=ACCEL;
ch3->Jerk=JERK;
ch3->P=PIDP;
ch3->I=PIDI;
ch3->D=PIDD;
ch3->OutputChan0=A+8;
ch3->LimitSwitchOptions=0x100;
ch3->LimitSwitchNegBit=0;
ch3->LimitSwitchPosBit=0;
ch3->SoftLimitPos=1e+009;
ch3->SoftLimitNeg=-1e+009;
ch3->BacklashMode=BACKLASH_OFF;
ch3->BacklashAmount=0;
ch3->BacklashRate=0;
EnableAxisDest(X,0);
EnableAxisDest(Y,0);
EnableAxisDest(Z,0);
EnableAxisDest(A,0);
DefineCoordSystem(X,Y,Z,A);
printf("4 Axis init done!\n");
return 0;
}
The Gecko G540 has 10 micro-steps. The Sherline supplied steppers have a 1.8 degree step angle. 360/1.8 = 200 steps * 10 micro-steps gives 2000 steps per revolution. Looking at the specs I can see the motors run out of steam above 2500 RPM, so I'll stick with 2000RPM with reasonable torque. So, 2000 RPM / 60 seconds * 2000 usteps = 66,666.6667 hz which is the VEL parameter in the code. My Sherline is metric with 1 rev = 1mm. So at 66KHz / 2000 usteps = 33 mm/s or 1980 mm/min
Frankly moving at that speed on something as small as a sherline is almost pointless, but nice to know I can safely go way above the 25KHz limitation of my XP/Mach 3 machine
Here are the Sherline stepper motor specs:
Code:
|-----------------------+----------------------------------------|
| Sherline P/N: | 67127 (w/ DIN plug and flats of shaft) |
| | 67130 (no plug, flats on shaft) |
| Manufacturer: | NMB (Minebea Co. Ltd.) |
| Mfg. P/N (Type): | 23KM-K035-62V (double shaft) |
| Frame size: | NEMA #23 |
| Step angle: | 1.8° |
| Voltage: | 3.2 V |
| Current: | 2.0 A/Φ |
| Resistance: | 1.6 Ω/Φ |
| Inductance: | 3.6 mH/Φ |
| Holding torque: | 9.7 kg-cm |
| Rotor inertia: | 250 g-cm2 |
| Number of wire leads: | 6 (See color code diagram below) |
| Weight: | 1.32 lb (0.6 Kg.) |
| Length: | 2.13" (54 mm) |
| Shaft: | Double ended, 1/4" dia. |
|-----------------------+----------------------------------------|
And here are the pinouts I've used for my adapter board:
Code:
|-----------+-----------------------------------------------------+----------+------------------------------------------------------|
| KFlop Pin | Kflop Note | DB25 Pin | Gecko Note |
|-----------+-----------------------------------------------------+----------+------------------------------------------------------|
| 1 | VDD+3.3 | | |
| 2 | VDD+3.3 | | |
| 3 | VDD+12 | | |
| 4 | RESET | | |
| 5 | IO44 GPIO (3.3V Only) | | |
| 6 | IO45 GPIO (3.3V Only) | | |
| 7 | IO0 GPIO (5v) or Encoder 0 Input Phase A | | |
| 8 | IO1 GPIO (5v) or Encoder 0 Input Phase B | | |
| 9 | IO2 GPIO (5v) or Encoder 1 Input Phase A | | |
| 10 | IO3 GPIO (5v) or Encoder 1 Input Phase B | | |
| 11 | IO4 GPIO (5v) or Encoder 2 Input Phase A | | |
| 12 | IO5 GPIO (5v) or Encoder 2 Input Phase B | | |
| 13 | IO6 GPIO (5v) or Encoder 3 Input Phase A | | |
| 14 | IO7 GPIO (5v) or Encoder 3 Input Phase B | | |
|-----------+-----------------------------------------------------+----------+------------------------------------------------------|
| | | 1 | OUTPUT 2 (e.g. Coolant on Terminal blk #6) |
| 15 | IO8 GPIO (5v) or Axis 0 Home (or Step 0 output) | 2 | X-Axis Step |
| 16 | IO9 GPIO (5v) or Axis 1 Home (or Dir 0 output) | 3 | X-Axis Direction |
| 17 | IO10 GPIO (5v) or Axis 2 Home (or Step 1 output) | 4 | Y-Axis Step |
| 18 | IO11 GPIO (5v) or Axis 3 Home (or Dir 1 output) | 5 | Y-Axis Direction |
| 19 | IO12 GPIO (5v) or Axis 0 + Limit (or Step 2 output) | 6 | Z-Axis Step |
| 20 | IO13 GPIO (5v) or Axis 0 - Limit (or Dir 2 output) | 7 | Z-Axis Direction |
| 21 | IO14 GPIO (5v) or Axis 1 + Limit (or Step 3 output) | 8 | A-Axis Step |
| 22 | IO15 GPIO (5v) or Axis 1 - Limit (or Dir 3 output) | 9 | A-Axis Direction |
| | | 10 | INPUT 1 (e.g. NC Limit sw on Terminal blk #1 to #12) |
| | | 11 | INPUT 2 (e.g. NC Limit sw on Terminal blk #2 to #12) |
| | | 12 | INPUT 3 (e.g. NC Limit sw on Terminal blk #3 to #12) |
| | | 13 | INPUT 4 (e.g. NC Limit sw on Terminal blk #4 to #12) |
| | | 14 | VFD PWM (50 hz) |
| | | 15 | FAULT (input to PC) |
| | | 16 | CHARGE PUMP (> 10kHz) |
| | | 17 | OUTPUT 1 (e.g. motor on Terminal blk #5) |
| | | 18 to 25 | GND |
|-----------+-----------------------------------------------------+----------+------------------------------------------------------|
| 23,24 | VDD+5 | | |
| 25,26 | GND | | |
|-----------+-----------------------------------------------------+----------+------------------------------------------------------|
I've had KMotion CNC running very well with my mill. I'll try and share the settings tomorrow for the 4-axis mill (with sherline rotary table). My next post will be some pictures and videos.
- Paul (gresham . at . mediavisual . dot . com)
Similar Threads: