Page 1 of 1

Spindle Interface

Posted: Fri Mar 31, 2023 10:26 pm
by jackgiz
Hi Tom,
I have my spindle mostly working. I can turn it on and off, change rotation and change speed. However, having some problems with getting requested speed and actual speed to agree. From the console I did Jog6=100000 and set V out from my C6 board to 10 volts which gave me 24,000 RPM on the inverter display. I did a Jog6=50000 and measured the voltage again and it was 5volts like I would expect. However, instead of 12,000 RPM I had 14,500. I took 100,000/24,000 RPM = 4.166 and used that number in the spindle programs "Factor" variable. I then did an M3 S10000 and got something like 14,000 RPM. As I increased S the difference between the requested RPM and actual got closer. At 24,000 it was right on. The different line slopes between requested RPM and Actual RPM I believe is an inverter issue but I don't see a setting to help correct that problem in the invert documentation. What is the best way to over come this issue in Kmotion? Should I come up with a formula that I can use in the Factor variable or is there a better way?

Jack

Re: Spindle Interface

Posted: Sun Apr 02, 2023 8:03 pm
by TomKerekes
Hi Jack,

If the measured voltages respond linearly then KFLOP and the C6 are working correctly. I agree the issue seems to be with the Inverter.

Is there an encoder output from the Spindle or Inverter? If so you could run closed loop for exact speed control.

Otherwise I think you would need to include a correction formula.

Re: Spindle Interface

Posted: Tue May 02, 2023 1:01 am
by jackgiz
Hi Tom,
I found that moving the inverter and C6 as far from the control panel and wiring as possible and running a shielded CAT 5 cable between the Kflop and C6 seems to have fixed the non linear issues and any other strange occurrences.

It does appear that there is an output that could be used for feedback to the Kflop with a couple of different operating modes. See attachment. This is all the documentation I can find at the moment. Is there a sample C program that I might be able to use for this feedback loop?

The only remaining minor issue is that when the spindle is running, if I adjust the spindle speed slider the spindle turns off. If I then click the ON CW button the spindle restarts and goes to the new speed set by the slider. I'm using the Spindle C programs provided with Kmotion, i.e., SpindleMillJogDir.c, SpindleOnCCWJogDir.c, SpindleOnCWJogDir.c and SpindleOffJogDir.c. Why is the Spindle turning off?

Jack

Re: Spindle Interface

Posted: Tue May 02, 2023 1:03 am
by jackgiz
forgot to attach this file to the previous reply.

Re: Spindle Interface

Posted: Tue May 02, 2023 1:33 am
by TomKerekes
Hi Jack,

I can't think of a reason the Spindle would stop.

What is printed on the KMotion.exe Console when you move the slider and the Spindle stops?

What Version of KMotion are you running?

Usually you are required to modify those program's defines for your system. Please post the exact 4 programs you are using.

Also post KMotionCNC's Tool Setup's configuration for those files.

Re: Spindle Interface

Posted: Wed May 03, 2023 4:29 pm
by jackgiz
Hi Tom,
What is printed on the KMotion.exe Console when you move the slider and the Spindle stops?
Today's issue is slightly different. If I start my spindle out at 12,000 RPM (50832 counts/sec) and click on the slider the spindle doesn't stop but immediately slows to 6000 RPM even though the console shows an increase in counts/sec.

Jogging Spindle 50832.000000 counts/sec //Now click on slider. Slider display still says 1.00 but counts increase
Jogging Spindle 52008.000000 counts/sec //Clicking on Off stops the spindle.
Jogging Spindle Stop
What Version of KMotion are you running?
version
KFLOP 4.35h Build 14:31:18 Sep 19 2022
KFLOP 4.35h
Ready
Usually you are required to modify those program's defines for your system. Please post the exact 4 programs you are using.
See Attached.
Also post KMotionCNC's Tool Setup's configuration for those files.
See Attached.

Am I using KMVAR correctly?

Jack

Re: Spindle Interface

Posted: Wed May 03, 2023 6:22 pm
by TomKerekes
Hi Jack,

I think I see the problem. In SpindeMillJogDir.c this:

Code: Select all

	Jog(SPINDLEAXIS, LastState * speed);
	printf("Jogging Spindle %f counts/sec\n", speed * FACTOR);
Commands the speed without using the FACTOR but prints using it. Try changing to:

Code: Select all

	Jog(SPINDLEAXIS, speed * FACTOR);
	printf("Jogging Spindle %f counts/sec\n", speed * FACTOR);

Re: Spindle Interface

Posted: Fri May 05, 2023 2:53 am
by jackgiz
Hi Tom,
Thanks, that was it. I must have changed that line when I was getting my spindle working and forgot to change it back.

Next question, if I change the slider while running a program that new slider multiplier does not reset when I start the next program. How can I get the slider to reset to 1 when I start the next program? Same question for resetting the forward speed slider.

Jack

Re: Spindle Interface

Posted: Sat May 06, 2023 8:58 pm
by TomKerekes
Hi Jack,

Its not clear if an Operator would always want that.

But calling this from a forever loop should reset them whenever execution begins.

Code: Select all

// Reset all sliders whenever execution starts
void ResetSliders(void)
{
	static int PrevJobActive=-1;
	int NewJobActive;
	
	NewJobActive = JOB_ACTIVE;  //sample
	if (NewJobActive != PrevJobActive)  // changed?
	{
		PrevJobActive = NewJobActive; //save
		
		if (NewJobActive) // started?
		{
			DoPCFloat(PC_COMM_SET_FRO,1);  // Reset Sliders
			DoPCFloat(PC_COMM_SET_RRO,1);
			DoPCFloat(PC_COMM_SET_SSO,1);
		}
	}
}

Re: Spindle Interface

Posted: Wed May 10, 2023 5:28 pm
by jackgiz
Hi Tom,
That worked. Took a little bit of thinking for a copy and paste programmer like me but I finally figured it out.
Jack