0

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.

bfris
  • 109
  • 2
  • what is your question? – jsotola Oct 20 '21 at 00:25
  • found the answers to not be helpful ... why were the answers not helpful? – jsotola Oct 20 '21 at 00:27
  • @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. – bfris Oct 20 '21 at 00:42
  • @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 – Tully Oct 20 '21 at 07:34
  • @Tully. I agree that PID controllers and tuning algorithms are well known and widely used. However, using an outer PID loop to control an inner velocity loop is less well known. – bfris Oct 20 '21 at 16:08
  • Nested PID loops are instead very common. One of the most common approaches, in fact, resorts to 3 nested loops, in this order (from inner to outer): current, velocity, position. See https://robotics.stackexchange.com/a/21937/6941 for reference. – Ugo Pattacini Oct 20 '21 at 20:56
  • @UgoPattacini. Maybe nested PID loops is a common thing, but I am having difficulty finding implementation details. The textbook page for your answer provides a diagram similar to the diagram in the OP, but little else. – bfris Oct 20 '21 at 21:08
  • First off, convince yourself that nested loops are the way to go. BLDC motor control is done this way at all levels. The diagram is the implementation. Perhaps, you're referring to how to tune the loops. In this case, the textbook page says: "The loops can also be tuned sequentially starting with the inner loop". – Ugo Pattacini Oct 20 '21 at 21:21
  • 1
    As I mentioned this question doesn't have enough information to be answerable which is the first requirement for questions here: https://robotics.stackexchange.com/help/dont-ask It also is kind of a shopping question: https://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. – Tully Oct 21 '21 at 17:56

0 Answers0