I have here a motor with a magnetic encoder, which has 2^14 bit resolution. It is connected to an stm32f3, that I use for position control of the motor. Now, normally the P position controller uses as a second stage a PI velocity controller and as a third stage a PI current controller. I have some problems with this structure, since when I try to feed the position controller to the speed controller, the system seems not to be stabilizable, but when I directly feed the position control signal to the current loop, it is pretty stable.

Now how should I process with the speed controller? First of all I need an accurate measurement of my velocity, but this is not possible with this reoslution for very slow speeds, right? Especially since there is also noise on the sensor. Since this control structure is usally used for a PMSM servo motor, I ask here, how the velocity should be taken into account?


1 Answer 1


1st you are missing a D control to differentiate position to get velocity and integral of current. Then you are missing acceleration feedback from current and the 2nd derivative of position.

Pi feedback adds delay and delay adds instability. Unfortunately you don't seem to grasp the basics of Loop gain transfer functions, PID feedback, Bode Plots, Root Locus methods and Barkhausen stability criteria. and 1st order feedback needed for stable control with 2nd order feedback to reduce jitter. 3rd order feedback with 2 integrators results in positive feedback.

I won't detail your solution , rather just suggest topics for reading above for learning how to solve the problems with many approaches.

A 14 bit encoder sounds like it has enough resolution, but how does that translate to your Position Error tolerance, overshoot SPEC and input profile for Position seek, velocity ramp and acceleration limits with F=ma and force of motor and current limits.

Force will not be constant as Torque declines with higher speed, so there are many variables to define, quantize and compute. Once these "specs" are all defined the problem becomes manageable by engineered calculations.

The minimal solution is to have two feedback loops for position error and velocity error, then have 2 control modes, velocity control ramps and position control ramps when velocity is below a certain threshold. This is 1st order or Proportional (P) feedback and guaranteed stable under limited conditions such as no backlash, no delays, no moments of inertia.

The optimal solution will have 3 sources of feedback, a,v,p to compare with a target profile to get an error signal to control each value of acceleration, velocity and position error within your defined specs. Normally acceleration feedback is derived motor current above some no load threshold.

HDD's have high resolution position , velocity and acceleration feedback to obtain the fastest seek with the smallest time and lowest position error using thee methods. enter image description here

enter image description here

  • \$\begingroup\$ Ok, thank you, I will try to understand your proposed approach. What I was refering to is the following, which cannot be that wrong since it's used from a manufaturer: trinamic.com/technology/std-technologies/field-oriented-control \$\endgroup\$ Sep 30, 2017 at 16:05
  • \$\begingroup\$ Yes . they use current feedback from 2 lines. What is wrong with your velocity signal? \$\endgroup\$ Sep 30, 2017 at 16:20
  • \$\begingroup\$ I got the position controller now pretty stable with the velocity loop as the second stage, the derivate part of the position PD controller was essential, thank you. \$\endgroup\$ Oct 1, 2017 at 12:42
  • \$\begingroup\$ Now measure impulse response to a disturbance and step response for v at different levels and define overshoot or setttling time then compare with objective (SPEC) If you dont have a spec , Make One. Include all sources of signal spectrum, gain and noise variations \$\endgroup\$ Oct 1, 2017 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.