simple 2 axis lathe initial lathe set up

Moderators: TomKerekes, dynomotion

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

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Sun Nov 12, 2023 9:49 pm

I suspect there is noise or the hall signal doesn’t do a clean transition so a transition is being counted multiple times. Do you have an oscilloscope to check it?

Approximately how many degrees is the signal high?

You might add something like a 0.01 second delay in the loop so multiple transitions within that time period will only be counted once.
Regards,

Tom Kerekes
Dynomotion, Inc.

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

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Sun Nov 12, 2023 10:07 pm

i do have a scope but are terrible at setting it up
looks to be about 10 degrees worth of rotation :?
i am using the bolt head for this. i can mill it down to a much smaller point! makes sense.....
the delay did work but it definitely feels sloppy on the reading

Image

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

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Sun Nov 12, 2023 10:26 pm

What min max RPM range will you be using?

I don’t think making the sensor target smaller would be helpful.

What do you mean by sloppy?

Because of only 1 pulse per rev the Update and Filter times will need to be set long to have stable readings.

Do you plan to do single point threading?
Regards,

Tom Kerekes
Dynomotion, Inc.

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

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Sun Nov 12, 2023 10:27 pm

ok so it may be the worst looking thing ever! lol
0-1000RPM
just watching the rpm read speed is jumping all sloppy like.
my digital reader is rock solid like the spindle speed

huge yes on threading
i am not afraid of machining out a toothed wheel with like 36 or 72 teeth or what ever divides nicest

Image

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

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Sun Nov 12, 2023 10:33 pm

same settings with nothing on
only powered pieces are computer, kflop, and VFD at idle

Image

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

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Mon Nov 13, 2023 4:29 pm

Multiple teeth would be helpful. With 2 hall sensors with one shifted N + 1/4 pitch from the other would generate a quadrature signal like an encoder so a hardware encoder input could be used.

You might add a ceramic capacitor and a resistor to reduce high frequency noise. Also consider shielded cables.

60/1000 RPM * 10/360 = 1.6 millisecond minimum pulse length
Regards,

Tom Kerekes
Dynomotion, Inc.

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

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Mon Nov 13, 2023 5:06 pm

it is a shielded cable with one end of the drain wire to the ground on JP11

i can pull another encoder from a servo and get that on the spindle for 2000 count and Z pulse. the hall was just a supper simple and easy install so i wanted to try it first

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

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Mon Nov 13, 2023 6:35 pm

ok so i am stopping the first idea of a single pulse hall on the spindle. it was a plan of minimal parts and tech but was not hammering out

NOW plan 2!
i am going to just mount my FANUC 10M servo to the spindle by a timing belt. this was the long term idea and is now seems to be the right time
straight 1 to 1 ratio timing belt drive
it has the same 2000 count encoder and now will be an axis right?

does the spindle ( A axis? ) get axis parameters or does the spindle jog C codes do this? or both?

Code: Select all

#include "KMotionDef.h"



int main() {

   
	ch0->InputMode=ENCODER_MODE;
	ch0->OutputMode=DAC_SERVO_MODE;
	ch0->Vel=100;
	ch0->Accel=1000;
	ch0->Jerk=10000;
	ch0->P=1;
	ch0->I=0;
	ch0->D=0;
	ch0->FFAccel=0;
	ch0->FFVel=0;
	ch0->MaxI=200;
	ch0->MaxErr=200;
	ch0->MaxOutput=200;
	ch0->DeadBandGain=1;
	ch0->DeadBandRange=0;
	ch0->InputChan0=0;
	ch0->InputChan1=0;
	ch0->OutputChan0=0;
	ch0->OutputChan1=0;
	ch0->MasterAxis=-1;
	ch0->LimitSwitchOptions=0x100;
	ch0->LimitSwitchNegBit=0;
	ch0->LimitSwitchPosBit=0;
	ch0->SoftLimitPos=1e+09;
	ch0->SoftLimitNeg=-1e+09;
	ch0->InputGain0=1;
	ch0->InputGain1=1;
	ch0->InputOffset0=0;
	ch0->InputOffset1=0;
	ch0->OutputGain=1;
	ch0->OutputOffset=0;
	ch0->SlaveGain=1;
	ch0->BacklashMode=BACKLASH_OFF;
	ch0->BacklashAmount=0;
	ch0->BacklashRate=0;
	ch0->invDistPerCycle=1;
	ch0->Lead=0;
	ch0->MaxFollowingError=1000000000;
	ch0->StepperAmplitude=250;

	ch0->iir[0].B0=1;
	ch0->iir[0].B1=0;
	ch0->iir[0].B2=0;
	ch0->iir[0].A1=0;
	ch0->iir[0].A2=0;

	ch0->iir[1].B0=1;
	ch0->iir[1].B1=0;
	ch0->iir[1].B2=0;
	ch0->iir[1].A1=0;
	ch0->iir[1].A2=0;

	ch0->iir[2].B0=1;
	ch0->iir[2].B1=0;
	ch0->iir[2].B2=0;
	ch0->iir[2].A1=0;
	ch0->iir[2].A2=0;
    

	ch1->InputMode=ENCODER_MODE;
	ch1->OutputMode=DAC_SERVO_MODE;
	ch1->Vel=100;
	ch1->Accel=1000;
	ch1->Jerk=10000;
	ch1->P=1;
	ch1->I=0;
	ch1->D=0;
	ch1->FFAccel=0;
	ch1->FFVel=0;
	ch1->MaxI=200;
	ch1->MaxErr=200;
	ch1->MaxOutput=200;
	ch1->DeadBandGain=1;
	ch1->DeadBandRange=0;
	ch1->InputChan0=1;
	ch1->InputChan1=0;
	ch1->OutputChan0=1;
	ch1->OutputChan1=0;
	ch1->MasterAxis=-1;
	ch1->LimitSwitchOptions=0x100;
	ch1->LimitSwitchNegBit=0;
	ch1->LimitSwitchPosBit=0;
	ch1->SoftLimitPos=1e+09;
	ch1->SoftLimitNeg=-1e+09;
	ch1->InputGain0=1;
	ch1->InputGain1=1;
	ch1->InputOffset0=0;
	ch1->InputOffset1=0;
	ch1->OutputGain=1;
	ch1->OutputOffset=0;
	ch1->SlaveGain=1;
	ch1->BacklashMode=BACKLASH_OFF;
	ch1->BacklashAmount=0;
	ch1->BacklashRate=0;
	ch1->invDistPerCycle=1;
	ch1->Lead=0;
	ch1->MaxFollowingError=1000000000;
	ch1->StepperAmplitude=250;

	ch1->iir[0].B0=1;
	ch1->iir[0].B1=0;
	ch1->iir[0].B2=0;
	ch1->iir[0].A1=0;
	ch1->iir[0].A2=0;

	ch1->iir[1].B0=1;
	ch1->iir[1].B1=0;
	ch1->iir[1].B2=0;
	ch1->iir[1].A1=0;
	ch1->iir[1].A2=0;

	ch1->iir[2].B0=1;
	ch1->iir[2].B1=0;
	ch1->iir[2].B2=0;
	ch1->iir[2].A1=0;
	ch1->iir[2].A2=0;
	
	
	ch0->InputMode=ENCODER_MODE;
	ch2->OutputMode=DAC_SERVO_MODE;
	ch2->Vel=100;
	ch2->Accel=1000;
	ch2->Jerk=10000;
	ch2->P=1;
	ch2->I=0;
	ch2->D=0;
	ch2->FFAccel=0;
	ch2->FFVel=0;
	ch2->MaxI=200;
	ch2->MaxErr=200;
	ch2->MaxOutput=200;
	ch2->DeadBandGain=1;
	ch2->DeadBandRange=0;
	ch2->InputChan0=2;
	ch2->InputChan1=0;
	ch2->OutputChan0=2;
	ch2->OutputChan1=0;
	ch2->MasterAxis=-1;
	ch2->LimitSwitchOptions=0x100;
	ch2->LimitSwitchNegBit=0;
	ch2->LimitSwitchPosBit=0;
	ch2->SoftLimitPos=1e+09;
	ch2->SoftLimitNeg=-1e+09;
	ch2->InputGain0=1;
	ch2->InputGain1=1;
	ch2->InputOffset0=0;
	ch2->InputOffset1=0;
	ch2->OutputGain=1;
	ch2->OutputOffset=0;
	ch2->SlaveGain=1;
	ch2->BacklashMode=BACKLASH_OFF;
	ch2->BacklashAmount=0;
	ch2->BacklashRate=0;
	ch2->invDistPerCycle=1;
	ch2->Lead=0;
	ch2->MaxFollowingError=1000000000;
	ch2->StepperAmplitude=250;

	ch2->iir[0].B0=1;
	ch2->iir[0].B1=0;
	ch2->iir[0].B2=0;
	ch2->iir[0].A1=0;
	ch2->iir[0].A2=0;

	ch2->iir[1].B0=1;
	ch2->iir[1].B1=0;
	ch2->iir[1].B2=0;
	ch2->iir[1].A1=0;
	ch2->iir[1].A2=0;

	ch2->iir[2].B0=1;
	ch2->iir[2].B1=0;
	ch2->iir[2].B2=0;
	ch2->iir[2].A1=0;
	ch2->iir[2].A2=0;
	
	EnableAxis(0);
    EnableAxis(1);
    EnableAxis(2);

	DefineCoordSystem(0,-1,1,2);
    
    }

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

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Mon Nov 13, 2023 7:40 pm

does the spindle ( A axis? ) get axis parameters or does the spindle jog C codes do this? or both?
If the Axis is included in the Coordinate System as you have shown it will operate like an A Axis and Spindle Jog Commands should not be used.

If it is excluded from the Coordinate System then it can be operated as a Spindle with Jog Commands.

You can create M Codes to add or remove it from the Coordinate System to switch modes on the fly.
Regards,

Tom Kerekes
Dynomotion, Inc.

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

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Mon Nov 13, 2023 7:46 pm

excellent
i am excited to murder my next code together with chatbot
thanks tom!

Post Reply