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\$
1
  • \$\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\$ Nov 25, 2020 at 8:28

1 Answer 1

0
\$\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\$
2
  • \$\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
    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
    Feb 7, 2019 at 4:02

Your Answer

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

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