cmparker Posted November 7, 2013 Posted November 7, 2013 We have several stepper motors in a system that exhibit some strange behavior. Sometimes when a move is commanded, the motor moves in the opposite direction until the Fatal Following Error is hit. When the move is commanded again, the motor moves in the correct direction and stops where commanded. We have also seen the motor move and go open loop with a Fatal Following error when it wasn't commanded to move. This problem happens after several hours or days of continuous operation. What could be the cause(s) of the problems? Some background: The stepper motors were configured before my time and are close loop controlled with attached encoders. We are using a Geo Brick LV, 8 axis controller. Using PmacTuningPro2, doing a Position Step results in no movement of the motor. Doing a Position Ramp or Sinusoidal move results in good movement with low following error. If I lower kp enough, Position Step will work but the following error for the Ramp and Sinusoidal moves is much higher. If wanted I can post the images. In another thread I read most people control steppers using open loop which is less problematic. Also all examples I found are only for open loop (direct microstepping) control. What are some of the problems that can be encountered by using encoder feedback and a stepper? How can these problems be overcome? Are there any examples or guides to follow using close loop control so I can verify our current setup?
Richard Naddaf Posted November 8, 2013 Posted November 8, 2013 You should be able to get very good results in closed loop configuration. We recommend using the encoder for commutation as well. Your symptoms sound like incorrect phasing. See attached sample code below, the key parameters are Ixx72 (set for 2-phase output), and Ixx77 = 0. Everything else should be as if you were setting up a brushless motor. - Make sure that your custom PLC for motor setup and clear faults specifies it for stepper control. - Make sure that your clock settings are correct for say 20KHz PWM. End Gat Del Gat Close // Step 1: I100 = 1 I124 = $800001 I172 = 512 I184 = $FFFC00 I182 = $78006 I183 = $078001 I101 = 1 I177 = 0 I166 ; Compute per the manual (as of for brushless motor) I157 ; Compute per the manual (as of for brushless motor) I158 ; Compute per the manual (as of for brushless motor) I169 ; Compute per the manual (as of for brushless motor) I170 = 360 / 1.8 / 4 ; For a 1.8 deg stepper I171 = 204800 ; Number of counts per rev I129 = 0 I179 = 0 // Step 2: // Tune current loop I161 = 0 I162 = 0 I176 = 0 // Step 3: // Do manual phasing // Step 4: // Open loop test // Step 4: // Tune PID loop I130 = 0 I131 = 0 I132 = 0 I133 = 0 I134 = 0 I135 = 0 I136 = 0 I137 = 0 I138 = 0 I139 = 0 // Step 5: // Set up halls or custom phasing
cmparker Posted November 13, 2013 Author Posted November 13, 2013 You should be able to get very good results in closed loop configuration. We recommend using the encoder for commutation as well. Your symptoms sound like incorrect phasing. See attached sample code below, the key parameters are Ixx72 (set for 2-phase output), and Ixx77 = 0. Everything else should be as if you were setting up a brushless motor. - Make sure that your custom PLC for motor setup and clear faults specifies it for stepper control. - Make sure that your clock settings are correct for say 20KHz PWM. Thank you for the reply. In the old setup I177 was set to 1000, not 0. I have been going through your example and I am stuck on the open loop test. I get the following: Open Loop Test.BMP What should I look at first? Also how is I171 calculated for a stepper with an encoder? For my setup I am using motor 4118S-02D-27RO with Encoder E5-1000-197-I-D-D-D-B. The specs are 1.8deg step, 1.3A/phase, 2.8ohm/phase, 3.6mH/phase, 1000 Counts/Rev Encoder. I can move the motor and get encoder feedback. Based on your example: End Gat Del Gat Close // Step 0: $$$***, Download Suggested M Vars #define MaxPhaseFreq P8000 ; Max Phase Clock [KHz] #define PWMClk P8001 ; PWM Clock [KHz] #define PhaseClk P8002 ; Phase Clock [KHz] #define ServoClk P8003 ; Servo Clock [KHz] #define ContCurrent 1.3 ; Continuous Current Limit [Amps] –User Input #define PeakCurrent 5 ; Instantaneous Current Limit [Amps] –User Input #define MaxADC 33.85 ; Brick LV full range ADC reading (see electrical specifications) #define I2TOnTime 1 ; Time allowed at peak Current [sec] // Clock Setup Parameters (from existing firmware) I7100=1640 I7101=1 I7102=3 I6800=0 I6801=0 I6802=0 I7000=1640 I7001=1 I7002=3 I10=1856284 I7003=2250 I7004=35 I7103=2250 I7104=35 MaxPhaseFreq=117964.8/(2*I6800+3) PWMClk=117964.8/(4*I6800+6) PhaseClk=MaxPhaseFreq/(I6801+1) ServoClk=PhaseClk/(I6802+1) // Step 1: I100 = 1 I124 = $820001 I172 = 512 I184 = $FFFC00 I182 = $78006 I183 = $078001 I101 = 1 I177 = 0 I166=0.95 * I7000 ; Compute per the manual (as of for brushless motor) I157=INT(32767*(ContCurrent*1.414/MaxADC)*cos(30)) ; Compute per the manual (as of for brushless motor) I169=INT(32767*(PeakCurrent*1.414/MaxADC)*cos(30)) ; Compute per the manual (as of for brushless motor) I158=INT((I169*I169-I157*I157)*ServoClk*1000*I2TOnTime/(32767*32767)) ; Compute per the manual (as of for brushless motor) I170 = 360 / 1.8 / 4 ; For a 1.8 deg stepper I171 = 204800 ; Number of counts per rev ??? I129 = 0 I179 = 0 // Step 2: // Tune current loop I161 = 0.02 I162 = 0.1 I176 = 0.5 // Step 3: // Do manual phasing (Pg171 Geo Brick LV) // Step 4: // Open loop test Current Loop Test Results: Current Loop Tuned.BMP
Mr P Mac Posted November 14, 2013 Posted November 14, 2013 Hi cmparker, at our facility we have hundreds of closedloop stepper axes, tuned and working ok. Over the time we have seen lots of different faults occur that can exhibit as you have described, so here are some extras to consider: Stepper motor missing a leg of a phase - can make the motor go the wrong way and move by itself via preload. Phase short to ground - if not "short enough" to trip the GB, can result in a weak motion in one direction. Vacuum or preload forces? - can force a motor the wrong way/move by itself. One leg of the encoder feedback missing - if you lose one "wire" of a quadrature signal some magical things can happen. (Including noise on the signal). Noise on the encoder - resulting in a "Phantom" following error which the axis tries to compensate for. Cumulative Following error at the end of the move, j/ and then it tries to "unwrap" the FE on the next move. Too much Intergral ixx33, can cause to motor to slowly wind one way then the other. Phase offset is set or poorly balanced - what are your ixx29 ixx79? these can add offset to the motor phases to balance the current in each phase. If you have a pair of current clamps you can play with this, or feel the motor shaft for equal torque in each direction. Amp configuration changing; use a plc to ensure stepper configuration has not changed to DC servo. Minus sign in front of ixx22, will send the motor the wrong way through the limits! Hope this might help... Cheers
Richard Naddaf Posted November 14, 2013 Posted November 14, 2013 Do you see encoder feedback in the position window when you move the motor by hand? With 1.8 degree stepper, Ixx70 is the same as stated in the example = 50. Ixx71 should be equal to the number of counts per revolution of the encoder (as seen in the position window). I assume this is a quadrature encoder, how many lines is it? Once you have that set up correctly, you should be able to phase the motor manually as follows. (make sure you have downloaded the suggested M-Variables to use Mxx71). 1. Ixx79 = 1000 #1o0 2. Make sure that the motor is locked to a phase, if not kill, increase Ixx79 and try again. If you don't feel any current running through, then something is set up wrong or missing in the output section but I doubt it because your current loop looks fine. 2. Mxx71 = 0 3. #nK 4. Ixx79 = 0 Now, you can perform an open loop test. If it still fails, change your encoder decode I7mn0 (say from 7 to 3 or vice versa). Phase (again) and try again.
cmparker Posted November 22, 2013 Author Posted November 22, 2013 Hi cmparker, at our facility we have hundreds of closedloop stepper axes, tuned and working ok. Over the time we have seen lots of different faults occur that can exhibit as you have described, so here are some extras to consider: Stepper motor missing a leg of a phase - can make the motor go the wrong way and move by itself via preload. Phase short to ground - if not "short enough" to trip the GB, can result in a weak motion in one direction. Vacuum or preload forces? - can force a motor the wrong way/move by itself. One leg of the encoder feedback missing - if you lose one "wire" of a quadrature signal some magical things can happen. (Including noise on the signal). Noise on the encoder - resulting in a "Phantom" following error which the axis tries to compensate for. Cumulative Following error at the end of the move, j/ and then it tries to "unwrap" the FE on the next move. Too much Intergral ixx33, can cause to motor to slowly wind one way then the other. Phase offset is set or poorly balanced - what are your ixx29 ixx79? these can add offset to the motor phases to balance the current in each phase. If you have a pair of current clamps you can play with this, or feel the motor shaft for equal torque in each direction. Amp configuration changing; use a plc to ensure stepper configuration has not changed to DC servo. Minus sign in front of ixx22, will send the motor the wrong way through the limits! Hope this might help... Cheers Thank you for the advice. Phase and encoder cabling was one of the first things we changed to try and fix the problem. We also tried replacing the motors and Delta Tau to rule out any hardware problems. So far no luck. I got a hold of an oscilloscope and measured the encoder feedback at the Delta Tau (1,2,3,4 = A+,A-,B+,B-): Move by hand: Move with jog: Some extra varying force may be on the motor from a belt in the drive mechanism. We tried tightening and loosening the belt but the problem remains and we do not see any significant differences when doing a step or ramp command. After a move I'm seeing around +/-1 count of following error. I will keep an eye on it to see if it ever jumps up to a large value. From the original setup: Ixx33=500 Ixx29=0 Ixx79=0 Ixx22=5 I will double check the motor configuration and verify it's not changing. Thanks.
cmparker Posted November 23, 2013 Author Posted November 23, 2013 Do you see encoder feedback in the position window when you move the motor by hand? With 1.8 degree stepper, Ixx70 is the same as stated in the example = 50. Ixx71 should be equal to the number of counts per revolution of the encoder (as seen in the position window). I assume this is a quadrature encoder, how many lines is it? Once you have that set up correctly, you should be able to phase the motor manually as follows. (make sure you have downloaded the suggested M-Variables to use Mxx71). 1. Ixx79 = 1000 #1o0 2. Make sure that the motor is locked to a phase, if not kill, increase Ixx79 and try again. If you don't feel any current running through, then something is set up wrong or missing in the output section but I doubt it because your current loop looks fine. 2. Mxx71 = 0 3. #nK 4. Ixx79 = 0 Now, you can perform an open loop test. If it still fails, change your encoder decode I7mn0 (say from 7 to 3 or vice versa). Phase (again) and try again. Yes, I see encoder feedback in the position window. I changed Ixx71 to 1000 to match the encoder. It is a 4 line (+2 Index) differential quadrature encoder.
cmparker Posted November 25, 2013 Author Posted November 25, 2013 Do you see encoder feedback in the position window when you move the motor by hand? With 1.8 degree stepper, Ixx70 is the same as stated in the example = 50. Ixx71 should be equal to the number of counts per revolution of the encoder (as seen in the position window). I assume this is a quadrature encoder, how many lines is it? Once you have that set up correctly, you should be able to phase the motor manually as follows. (make sure you have downloaded the suggested M-Variables to use Mxx71). 1. Ixx79 = 1000 #1o0 2. Make sure that the motor is locked to a phase, if not kill, increase Ixx79 and try again. If you don't feel any current running through, then something is set up wrong or missing in the output section but I doubt it because your current loop looks fine. 2. Mxx71 = 0 3. #nK 4. Ixx79 = 0 Now, you can perform an open loop test. If it still fails, change your encoder decode I7mn0 (say from 7 to 3 or vice versa). Phase (again) and try again. Yes, I see encoder feedback in the position window. It is a 4 line (+2 for Index) differential quadrature encoder. I changed Ixx71 to 1000 to match the encoder. Now when I try to phase the motor I can sometimes feel it oscillating back and forth. If I try the open loop test, I get an amplifier fault (current).
Recommended Posts