0
\$\begingroup\$

I'm doing a project that use brushless geared DC motor,

the motor is connected to a moving platform. I will drive the motor with PWM, the motor then move the platform from -a degree to a degree position.

enter image description here

There's an RPM setting for the motion speed need to be achieved, to do this everytime it reach the peak position (0 degree) I read the angular speed from gyro sensor that was attached in the platform, then procceed the value to PID controller.

I want to ask which one is the correct/better approach to drive the motor: (motor initially stop)

(1) Start from a MINIMUM duty cycle (let say ~30% is the minimum to make the platform move), then I increment the duty cycle at every time interval (e.g. +1% every 100 ms), when it reach 0 degree position I start braking by decrementing the duty cycle (e.g -2% every 100 ms), then stop the motor when reach the end position. That will be one cycle, then after every 1 cycle finished, I will calculate new value for the increment & decrement to achieve the RPM setting.

(2) From the start position, I drive the motor with constant duty cycle, then when reach 0 degree position start braking just like approach (1) using decrement. Then after every 1 cycle finished, I will calculate new value for the constant duty used, and also the decrement value when brakaing.

Which one is the better ALGORITHM with pros and cons?

\$\endgroup\$
2
  • \$\begingroup\$ The question as asked is basically just whether it makes sense to start the motion slowly or abruptly. That depends on whether your application expects the platform to suddenly make a big jump (when the system is turned on) and whether the motor is able to deliver enough power to start the motion without slipping. \$\endgroup\$ Commented Nov 25, 2020 at 8:28
  • \$\begingroup\$ what is preventing you from testing both algorithms and deciding on the one that suits your application? \$\endgroup\$
    – jsotola
    Commented Oct 19 at 15:30

1 Answer 1

1
\$\begingroup\$

You say that you're going to use a PID controller, but then you start talking about driving the motor's duty cycle directly. I believe that you do not understand what a PID controller is.

You should use a linear controller, possibly decorated with integrator anti-windup. Here's a basic block diagram that should work for you. The 'rotation' block is sort of fictitious; it's just there to go from the motor speed to motor position.

You do not need wacky sequencing with timers and if statements and hundreds of lines of code! You just need simple linear controllers, as mankind has been making for the last 100 years.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
5
  • \$\begingroup\$ No no no, my system it's not like that block diagram. OK, forget about the PID, let's say this is just using software code, which one better approach (1) or (2)? That's what I'm asking \$\endgroup\$
    – Qrenz
    Commented Feb 7, 2019 at 3:14
  • \$\begingroup\$ I'm pretty sure that either one will have equally dismal results. I've been doing this for 30 years now, and I've cleaned up after both (1) and (2). I know whereof I speak. Just because something implements a PID loop doesn't mean it isn't an algorithm, so you can use the block diagram I'm giving you and call it an algorithm. \$\endgroup\$
    – TimWescott
    Commented Feb 7, 2019 at 4:02
  • \$\begingroup\$ @Qrenz there is a way to do it - it's very simple and has a ton of examples all over. People who try to reinvent it usually end up chasing problems that have no explanation other than "why did i even try it". PID should not scare you - it's a single line in the code. All that you see on this block diagram is several lines of addition and subtraction. \$\endgroup\$
    – TQQQ
    Commented Oct 19 at 15:41
  • \$\begingroup\$ By the way, you could probably skip the current and velocity control. Most probably a single PID would do. \$\endgroup\$
    – TQQQ
    Commented Oct 19 at 15:43
  • \$\begingroup\$ Separating out current and velocity control is useful if you want to add nonlinearities, like limiting the current so you don't burn anything up, or limiting the velocity to what the motor or other parts of the system can handle. If the electronics and mechanics are robust enough that they can take whatever you throw at them -- yes, just keep it simple. \$\endgroup\$
    – TimWescott
    Commented Oct 19 at 21:12

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.