Steppers & Encoders
29 Nov 2010 13:30 #5724
by bengineer
Steppers & Encoders was created by bengineer
Hello all,
I've been paging through the user & integrator manuals to find out how easily using encoders is with steppers. I've been designing and just begun building my gantry mill under the assumption that I'll figure out how to implement the two when I get to that point, but the thought occurred to me that it's possible that it might be beyond my limited skills (being a mechanical) and I'm left with some expensive encoders collecting dust on my shelf.
So far I'm seeing either servo/encoder or just stepper in the manuals. Has anyone successfully used encoders with steppers in EMC2? How easy or hard is it to set up in the software?
Thanks.
I've been paging through the user & integrator manuals to find out how easily using encoders is with steppers. I've been designing and just begun building my gantry mill under the assumption that I'll figure out how to implement the two when I get to that point, but the thought occurred to me that it's possible that it might be beyond my limited skills (being a mechanical) and I'm left with some expensive encoders collecting dust on my shelf.
So far I'm seeing either servo/encoder or just stepper in the manuals. Has anyone successfully used encoders with steppers in EMC2? How easy or hard is it to set up in the software?
Thanks.
Please Log in or Create an account to join the conversation.
29 Nov 2010 13:42 #5725
by andypugh
Replied by andypugh on topic Re:Steppers & Encoders
From a software point of view it is fairly easy. You set up the stepgen components in velocity mode, and then the rest of the configuration looks just like a servo setup.
However, mechanically it is not a particularly good solution. Steppers lose torque the faster you drive them. A PID-controlled servo loop will increase the output value (current, torque) to recover position. With your stepper-servo system that means that if you start lagging position then the step rate will be increased, losing you a bit of torque, probably making the undershoot worse, so the step rate goes up... And you end up in a vicious circle.
You _can_ use encoders to give actual position feedback in place of the software feedback from the stepgen components. That will allow you to get genuine f-error alerts (and program halt) if you stall a stepper.
You _might_ be able to not use the PID output to control the stepgen but instead link it to the adaptive feed pin, so that position undershoots throttle back the traverse speed. That might work.
However, mechanically it is not a particularly good solution. Steppers lose torque the faster you drive them. A PID-controlled servo loop will increase the output value (current, torque) to recover position. With your stepper-servo system that means that if you start lagging position then the step rate will be increased, losing you a bit of torque, probably making the undershoot worse, so the step rate goes up... And you end up in a vicious circle.
You _can_ use encoders to give actual position feedback in place of the software feedback from the stepgen components. That will allow you to get genuine f-error alerts (and program halt) if you stall a stepper.
You _might_ be able to not use the PID output to control the stepgen but instead link it to the adaptive feed pin, so that position undershoots throttle back the traverse speed. That might work.
Please Log in or Create an account to join the conversation.
29 Nov 2010 15:45 #5731
by aike
Replied by aike on topic Re:Steppers & Encoders
Hi!
You can see the working example here : www.linuxcnc.org/component/option,com_ku...,30/id,5487/lang,ru/
I use servodrive with servomotor in step mode.
The output of encoder (from servo motor) connected to PID.
All works well
You can see the working example here : www.linuxcnc.org/component/option,com_ku...,30/id,5487/lang,ru/
I use servodrive with servomotor in step mode.
The output of encoder (from servo motor) connected to PID.
All works well
Please Log in or Create an account to join the conversation.
29 Nov 2010 16:10 #5732
by andypugh
Replied by andypugh on topic Re:Steppers & Encoders
However that is a servo drive with step-direction input, not a stepper motor and drive with an encoder added. Not really the same thing.
Please Log in or Create an account to join the conversation.
29 Nov 2010 18:04 #5739
by aike
Replied by aike on topic Re:Steppers & Encoders
andypugh wrote:
Stepper motor operate fine for RPM less then 300, if the RPM increase, the torgue fall.
You can use as stepper so as servo drive with step/dir control, but the HAL configuration will be the same.However that is a servo drive with step-direction input, not a stepper motor and drive with an encoder added. Not really the same thing.
Stepper motor operate fine for RPM less then 300, if the RPM increase, the torgue fall.
Please Log in or Create an account to join the conversation.
07 Dec 2010 21:27 #5919
by bengineer
Replied by bengineer on topic Re:Steppers & Encoders
So, I understand if I put an encoder on a stepper, I risk a downward spiral if I start to lag. If I lag, the velocity will try to catch up, and for a stepper, that means the torque drops, likely lagging worse, increasing velocity, etc...
If I set my maximum speed of the motor well within the optimum torque curve of the motor, I gather the motor might not be able to catch up from a lag, but the torque should never drop to a detrimental level.
So in theory, the motor will never catch up until that axis stops. So if I'm milling a circle with X and Y, and X has a slight lag, I might get a little more of an oval. Or will something else happen in the control to try an compensate, like slowing down the Y to match actual X & Y position?
If I set my maximum speed of the motor well within the optimum torque curve of the motor, I gather the motor might not be able to catch up from a lag, but the torque should never drop to a detrimental level.
So in theory, the motor will never catch up until that axis stops. So if I'm milling a circle with X and Y, and X has a slight lag, I might get a little more of an oval. Or will something else happen in the control to try an compensate, like slowing down the Y to match actual X & Y position?
Please Log in or Create an account to join the conversation.
07 Dec 2010 21:54 #5920
by jmelson
Replied by jmelson on topic Re:Steppers & Encoders
If you "start to lag" then the "downward spiral" has already been entered. A stepper motor must stay in sync with the drive currents or torque truly drops to zero. Four full steps represent a complete "cycle" of a two-phase stepper motor. The magnets must follow the current drive in the windings within one half of a cycle. The greatest torque is produced when the rotor is pushed 1/4 of a cycle from the drive waveform. The torque is zero when the rotor is exactly on the pole, and ALSO when it is 1/2 of a cycle leading or lagging. So, it is most important that the motor always be kept within 0 and 1/4 of a cycle deflection. Once past one full step, the torque begins to decrease as the deflection increases, and this condition will rapidly descend into a complete stall, like within a millisecond.
There is no scheme that can detect and remedy this situation after the one full step point has been reached, as the stall develops so quickly. Detecting the approach to one full step and reducing feed on all axes just before the one full step lag has developed is the way to handle it. Unfortunately, because steppers are not perfectly accurate, and affordable encoders are only a bit better, keeping track of the actual phase angle to the required degree is difficult. On a standard 1.8 degree motor, this requires knowing the shift between commanded position and actual position within a range of 0 - 1.8 degrees, with suitable resolution to measure the angle. Even if only 10% resolution of the difference angle is needed, that requires an encoder of 2000 counts/rev, neglecting the inherent accuracy of the motor.
Detecting the stall AFTER it occurs, however, is quite easy, and can be made to trip fast enough that in many cases the workpiece can be saved. ALSO, because EMC2 has real-time graphing capability, the following error can be measured during a variety of speeds and loads, and the operational envelope of the drive-motor combination can be explored safely to find out what the machine can and can't do. You then either beef up the motors or limit the speeds and loads to what you have demonstrated are within its capabilities. If a stall ever occurs later, it is either a jam-up in the mechanical part of the machine, or a "crash" due to feeding too fast into too hard a workpiece.
Jon
There is no scheme that can detect and remedy this situation after the one full step point has been reached, as the stall develops so quickly. Detecting the approach to one full step and reducing feed on all axes just before the one full step lag has developed is the way to handle it. Unfortunately, because steppers are not perfectly accurate, and affordable encoders are only a bit better, keeping track of the actual phase angle to the required degree is difficult. On a standard 1.8 degree motor, this requires knowing the shift between commanded position and actual position within a range of 0 - 1.8 degrees, with suitable resolution to measure the angle. Even if only 10% resolution of the difference angle is needed, that requires an encoder of 2000 counts/rev, neglecting the inherent accuracy of the motor.
Detecting the stall AFTER it occurs, however, is quite easy, and can be made to trip fast enough that in many cases the workpiece can be saved. ALSO, because EMC2 has real-time graphing capability, the following error can be measured during a variety of speeds and loads, and the operational envelope of the drive-motor combination can be explored safely to find out what the machine can and can't do. You then either beef up the motors or limit the speeds and loads to what you have demonstrated are within its capabilities. If a stall ever occurs later, it is either a jam-up in the mechanical part of the machine, or a "crash" due to feeding too fast into too hard a workpiece.
Jon
The following user(s) said Thank You: hoffb77
Please Log in or Create an account to join the conversation.
Time to create page: 0.152 seconds