I'm trying to control the position of a brushless DC gearmotor. To drive the motor, I have a controller box that provides a velocity that is proportional to a 0 to 5 V input. The motor has it's own Hall sensors for measuring velocity. I also have a rotary encoder attached to the motor to measure position.

enter image description here

I'm looking for an algorithm to control absolute position/angle of the motor (i.e. the outer loop in the diagram above). The first thing I tried was a PID loop which supplied a 0 to 5 V signal based on the position error calculated from the encoder. I was not able to tune the loop to go to a position quickly and accurately. And I have my doubts as to whether PID is even suitable for this kind of topology.

The algorithm I'm using now is to use KP only, but as my motor gets close to the setpoint, I lower the KP. I think I lower the KP about 4 times before I come to a complete stop. This algorithm kind of works, but it's highly unusual. It is pretty fast.

I've seen this question but found the answers to not be helpful.

  • $\begingroup$ what is your question? $\endgroup$
    – jsotola
    Commented Oct 20, 2021 at 0:25
  • $\begingroup$ found the answers to not be helpful ... why were the answers not helpful? $\endgroup$
    – jsotola
    Commented Oct 20, 2021 at 0:27
  • $\begingroup$ @jstola, My question is: what is a suitable algorithm for controlling position of a motor that already has a velocity controller. As to why the answers weren't helpful. Well, the accepted answer was (to paraphrase) "use a PI loop, be careful with KI term, and also use feedforward". A PI loop. That I can do. But I don't know what to do with feed forward. $\endgroup$
    – bfris
    Commented Oct 20, 2021 at 0:42
  • $\begingroup$ @bfris Thanks for your question. Unfortunately reviewing this question I don't think that it's currently worded as a good question for this site. The PID controller that you've stated doesn't work is the most basic algorithm typically used for things like this. There's an art to tuning PID loops for different systems. With three parameters and many different characteristics of the system there's likely ways to tune the different parameters to solve your problem. There could also be ways to improve your system to make it easier to tune the parameters. However your question doesn't provide any o $\endgroup$
    – Tully
    Commented Oct 20, 2021 at 7:34
  • 1
    $\begingroup$ As I mentioned this question doesn't have enough information to be answerable which is the first requirement for questions here: robotics.stackexchange.com/help/dont-ask It also is kind of a shopping question: stackoverflow.blog/2010/11/23/qa-is-hard-lets-go-shopping and there's very close duplicates which have been pointed to by others. Please consider updating your question to be better by these metrics otherwise it's liable for being closed out. $\endgroup$
    – Tully
    Commented Oct 21, 2021 at 17:56


Your Answer

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

Browse other questions tagged or ask your own question.