simple 2 axis lathe initial lathe set up

Moderators: TomKerekes, dynomotion

turbothis
Posts: 310
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 7:31 pm

yup, thats me
Attachments
picard-facepalm.jpg

turbothis
Posts: 310
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 7:52 pm

ok
spindle works great with speed and performance
i wanted it to be free/not holding once it slows to a stop.
i had this before, so i searched up my old thread and added in the disable axis part like you provided then
now it works
however now when i try and turn spindle back on it does nothing?
i am feeling like there needs to be an axis enable in the front of the CW and CCW codes?

my M5

Code: Select all

#include "KMotionDef.h"

#include "MySpindleDefs.h"


// desired speed is passed from KMotionCNC in variable KMVAR
// save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
// save in user variable SPEEDVAR the last desired speed

main()
{
	// spin down

	ClearBit(SPINDLECW_BIT);
	ClearBit(SPINDLECCW_BIT);
	Jog(SPINDLEAXIS, 0);
	printf("Jogging Spindle Stop\n");
	persist.UserData[STATEVAR] = 0;	// remember we are Off
	while (!CheckDone(SPINDLEAXIS));
	if (CS0_axis_a == -1)		// is A axis not defined in the Coordinate System?
		DisableAxis(2);			// yes, disable the axis, otherwise leave it enabled
}

turbothis
Posts: 310
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 10:14 pm

need like a

Code: Select all

  if  spindle dac = 0 (DisableAxis(2));
      else  do nothing
lol

User avatar
TomKerekes
Posts: 2546
Joined: Mon Dec 04, 2017 1:49 am

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Wed Dec 13, 2023 10:28 pm

I think you need to enable the axis before Jogging in the CW and CCW programs

Code: Select all

	if (CS0_axis_a == -1 && !ch2->Enable)		// is A axis not defined in the Coordinate System and not enabled?
		EnableAxis(2);			// yes, enable the axis
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 310
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 10:58 pm

exactly!
works perfect now

my X axis runs away some and i think it is the encoder (mechanical related?)
it reads good and the right direction
the first tests the servo ran backwards so i changed the

ch0->InputGain0=1;
ch0->InputGain1=1;

to

ch0->InputGain0=-1;
ch0->InputGain1=-1;

to get the servo driving the correct way instead of swapping +/- leads
is this fine and appropriate?

i notice when the X axis tries to run off ( i smack the Estop) and the DAC is at full output. this is with me jogging it only about -226 = 1.104 V
maybe this is the servo trying to catch up to position?
the axis can go nice and slow with jogging though......
Attachments
Capture.JPG

User avatar
TomKerekes
Posts: 2546
Joined: Mon Dec 04, 2017 1:49 am

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Thu Dec 14, 2023 1:29 am

my X axis runs away some and i think it is the encoder (mechanical related?)
it reads good and the right direction
the first tests the servo ran backwards so i changed the

ch0->InputGain0=1;
ch0->InputGain1=1;

to

ch0->InputGain0=-1;
ch0->InputGain1=-1;

to get the servo driving the correct way instead of swapping +/- leads
is this fine and appropriate?
If the servo is working (negative feedback to hold position) and you reverse the input gain then you will have positive feedback (runaway) instead of negative feedback. So you also need to also reverse the output gain to maintain negative feedback.


i notice when the X axis tries to run off ( i smack the Estop) and the DAC is at full output. this is with me jogging it only about -226 = 1.104 V
maybe this is the servo trying to catch up to position?
the axis can go nice and slow with jogging though......
If the Estop just removes motor power then KFLOP will ramp to full output trying to correct any error without any result. If you set small Max Following Error then whenever the servo can't correct the error then the axis will fault with a following error, the axis will disable, and the DAC will go to 0. So in this case the axis wont run away in the first place.


HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 310
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Thu Dec 14, 2023 1:36 am

cool

the old encoder felt tight and clunky when i spin it by finger. pretty sure it is not great
with new encoder and putting

ch0->InputGain0=1;
ch0->InputGain1=1;

back, X axis functions as it should

i think mostly this is ready to cut something :D

is there any way to test the Z pulse on the spindle?

turbothis
Posts: 310
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Fri Dec 15, 2023 2:03 am

hey, if i have my step settings at 1.00 and the A axis on degrees. shouldn't it step a single degree at a time?
it seems to step kinda odd in that it is random steps about .600-.800 in the A axis
Attachments
settings.JPG

User avatar
TomKerekes
Posts: 2546
Joined: Mon Dec 04, 2017 1:49 am

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Fri Dec 15, 2023 6:29 pm

is there any way to test the Z pulse on the spindle?
See Axis Homing and Indexing

if i have my step settings at 1.00 and the A axis on degrees. shouldn't it step a single degree at a time?
it seems to step kinda odd in that it is random steps about .600-.800 in the A axis
Yes it should. Observe the KMotion | Axis Screen. Does the Command and Position change by 22.2222222 counts?
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply