Step motor closed loop

More
31 May 2014 04:05 - 31 May 2014 04:32 #47561 by melhima
Hello!

I used on my machine 2 phases step motor 12Nm (1.8°) With parport
To get better accuracy I want to put encoder to give a feedback to the cnc
I made the connection on the Hal file and every thinks woks fine if I turn the encoder I can see the axis value changed

But my problem is when I connect my motor and try to move my machine I have a fallowing error my motor start and stop just 1 degree , I thinks the value on the INI file are wrong

I use a 600 lines encoder I have try to put in the SCALE this value but no way I start to get a headache! :pinch:

there are the value if you could tell me what should be the right value

[AXIS_3]

TYPE = ANGULAR
HOME = 0.000
MAX_VELOCITY = 30
MAX_ACCELERATION = 50
BACKLASH = 0.000
INPUT_SCALE = 1.666666667 (600/360°)
OUTPUT_SCALE = 1.000
MIN_LIMIT = 0
MAX_LIMIT = 4.5
FERROR = 0.200
MIN_FERROR = 0.01
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_USE_INDEX = YES
HOME_IGNORE_LIMITS = NO
P = 1
I = 0
D = 0
BIAS = 0
FF0 = 0
FF1 = 1
FF2 = 0
DEADBAND= 0.002

Thanks!
Last edit: 31 May 2014 04:32 by melhima.

Please Log in or Create an account to join the conversation.

More
31 May 2014 11:06 #47567 by jmelson
Replied by jmelson on topic Step motor closed loop

Hello!



I use a 600 lines encoder I have try to put in the SCALE this value but no way I start to get a headache! :pinch:

if the encoder actually has 600 lines, then you will get 2400 quadrature counts/turn.
Or, is it a 150 line encoder giving 600 counts/turn?

Anyway, INPUT_SCALE should be set to either 6.66666 for the 2400 counts or the value
you used if it is actually a 150 line encoder giving 600 counts/rev.

Then, just turn the shaft manually through a full revolution and check the
change in the A axis display to see if it moves approximately 360 counts.
That will tell you the correct encoder count. Then, set MIN_FERROR to a
much larger value. It MUST be larger than one encoder count, preferably
several counts. So, for 600 counts, you want it to be something like
1.2 - 2.5 (Note that with only 600 counts/rev, then your individual encoder
counts are 0.6 degree).

So, the numbers you have GUARANTEE a following error. Note than
FERROR is a velocity-proportional adder to MIN_FERROR, which is
the base value for the following error. At zero velocity, it is the only
thing that sets the error tolerance for the axis.

Jon

Please Log in or Create an account to join the conversation.

More
31 May 2014 13:22 #47569 by melhima
Replied by melhima on topic Step motor closed loop
Hi Jon

Thanks for your reply
Thats right its a 600 lines encoder so the scale should be 2400 / 360 = 6.666666667
I put this value in INPUT_SCALE

1.2 - 2.5 (Note that with only 600 counts/rev, then your individual encoder
counts are 0.6 degree).

I dont understand this value 1.2 is MIN_FERROR?
how you do to get 0.6 degree ?
Could you modify my INI file to see the right config it will be easier for me to understand

Thanks a lot!

Please Log in or Create an account to join the conversation.

More
31 May 2014 21:55 #47577 by jmelson
Replied by jmelson on topic Step motor closed loop

Hi Jon

Thanks for your reply
Thats right its a 600 lines encoder so the scale should be 2400 / 360 = 6.666666667
I put this value in INPUT_SCALE

1.2 - 2.5 (Note that with only 600 counts/rev, then your individual encoder
counts are 0.6 degree).

I dont understand this value 1.2 is MIN_FERROR?
how you do to get 0.6 degree ?
Could you modify my INI file to see the right config it will be easier for me to understand

Thanks a lot!

OK, so if it is 2400 counts/rotation, then INPUT_SCALE = 6.666667, as you say.
Inverting that, you get 0.15 degrees per encoder count. Now, you need the minimum
following error tolerance to be somewhat larger than that. I'd start with something
much higher, like 5 degrees, and watch the servo performance with Halscope.
As you tune the PID response, you can reduce the following error to a small
value, but it may remain 2 or more encoder counts. Eventually, you might be
able to get MIN_FERROR = 0.3 or somewhere around there.

I say "servo" a couple sentences back because this is what you are creating,
is a servo with a stepper motor. The problem with this is that a stepper
driver cannot be told to "try harder" when the motot lags, so it will cause
a stall for sure. But, as long as there is no lag in position, then it will
work at some level. If you use a Gecko drive, it will give 2000 (micro)steps/rev,
but your encoder gives 2400 steps/rev, so there is a mismatch. This means
some positions of the encoder are impossible to reach! You need to set a
deadband equal to 1.5 encoder counts to make sure the PID can settle
at any commanded position. So, you would have
DEADBAND = 0.225
The deadband as you have it will cause eternal hunting at certain posiitons
as the PID commands steps going in one direction until the encoder moves
too far one way, then starts stepping back the other way until it moves
too far, again. Because of the springy response of microstepped stepper
motors and friction, you may have to increase DEADBAND further to
stop the hunting.

Jon

Please Log in or Create an account to join the conversation.

More
01 Jun 2014 00:33 - 01 Jun 2014 04:57 #47584 by melhima
Replied by melhima on topic Step motor closed loop
Hello

Thanks again
I can put microstepping with my driver it can go up to 10000 step/rev
Could you tell me if the OUTPUT_SCALE is the driver resolution?
I can setup on my leadshine driver at 2400 step/rev that will match with the encoder resolution
Normally with stepgen you set the motor resolution and microstepping so that calculate the right scale
So at this time my driver is set at 400 steps but i can change it by switch on the driver if it could give help
Last edit: 01 Jun 2014 04:57 by melhima.

Please Log in or Create an account to join the conversation.

More
20 Jun 2014 13:56 #48140 by melhima
Replied by melhima on topic Step motor closed loop

Hi Jon

Thanks for your reply
Thats right its a 600 lines encoder so the scale should be 2400 / 360 = 6.666666667
I put this value in INPUT_SCALE

1.2 - 2.5 (Note that with only 600 counts/rev, then your individual encoder
counts are 0.6 degree).

I dont understand this value 1.2 is MIN_FERROR?
how you do to get 0.6 degree ?
Could you modify my INI file to see the right config it will be easier for me to understand

Thanks a lot!

Please Log in or Create an account to join the conversation.

Time to create page: 0.127 seconds
Powered by Kunena Forum