0
\$\begingroup\$

The type of motor that I am working with is a 12V brushed permanent magnet DC motor.

By following this video by Mr. Paul McWhorter I was able to control the speed of my DC motor by using the analogWrite() command of Arduino. I came to the conclusion that by changing the duty cycle of the PWM signal the average voltage across the motor could be changed, which would naturally change the speed of the motor. I had used my motor without any load inertia to be driven. No load torque was applied on the motor's shaft. I believe this is called the "no-load" running condition.

Now I am actually interested in position control of the motor shaft instead of simple speed control. Now this video by DroneBot Workshop suggests that the duty cycle of the PWM input signal to the motor controls motor shaft position. But won't the duty cycle of the PWM input signal actually control the speed of the motor instead of its position? I am quite confused regarding this.

EDIT : I am trying to carry out closed loop position control of a simple DC motor. The details of how I get the position reading of the motor shaft and by what kind of sensor are not relevant to this question. Assuming that I have a sensor signal that I can use as a feedback signal, how do I control my DC motor's position? Do I need to change the PWM duty cycle, or its frequency? I think changing duty cycle will affect the speed and to get the position I'll have to integrate the speed with respect to time. But then how to control the acceleration and deceleration phases? How do I even know how much time time the motor takes to accelerate/decelerate and what kind of speed vs time curve the motor follows during these phases?

I am purposefully using a simple DC motor here for learning purpose. I do not intend to use a servo or stepper motor. My goal is to do closed loop position control of a simple DC motor for a project.

EDIT 2 : The details of the closed loop control by PID or some method is not relevant to this question. What I am simply asking is what kind of input voltage signal do I need to give my motor for a desired position and which one of the above two videos should I follow.

\$\endgroup\$
5
  • 3
    \$\begingroup\$ Is the second video talking about a servo? Because that's how you control a servo. \$\endgroup\$
    – Hearth
    May 26, 2022 at 15:04
  • \$\begingroup\$ @Hearth In the second video a simple DC Motor is converted to a servo motor by using positional feedback. \$\endgroup\$
    – Quadro
    May 26, 2022 at 15:16
  • \$\begingroup\$ Your edit turns this into an entirely different question, and you're now asking about control theory. That's a perfectly valid question, but should probably be a separate question. And you should mention how much you know about control theory already, like how familiar are you with Laplace-domain representations and machine modelling, do you know what the Park transform is, and so on. \$\endgroup\$
    – Hearth
    May 26, 2022 at 15:27
  • 1
    \$\begingroup\$ The details of the closed-loop control very much do matter, because those details are how you control the motor's position. The only thing you can directly affect is the motor's torque, and your control system has to do the rest. \$\endgroup\$
    – Hearth
    May 26, 2022 at 15:36
  • \$\begingroup\$ Think of when driving a car. Your arms are the motor that applies a turning force to the steering wheel. Your eyes determine if you are following the correct path. Your brain tells your arms when to turn and how fast. Once you’ve achieved the required path, your arms no longer turn the steering wheel.if you wander off the path, the arms apply a correction force. PWM is used to start/stop the motor. Note that for a servo system you need to control the motor direction as well. \$\endgroup\$
    – Kartman
    May 26, 2022 at 17:30

1 Answer 1

1
\$\begingroup\$

The second video you have posted, as @Hearth said in the comments, is a servo which is specifically designed to control for velocity and position. The first video you have posted is for a simple motor which will, as you correctly stated, change speeds with the varying PWM input that you have. Depending on which servo you may be using the position can be controlled by PWM frequency or a fixed frequency with a varied duty cycle (and other control schemes).

If you are looking to control the amount of times a motor rotates or determine position based on the amount of rotation then you're likely looking for what's called a stepper motor. Stepper motors typically have a rotary encoder that divides one full rotation of the shaft into an equal amount of countable 'steps' that can be read out by a uC such as your Arduino, you can also use this information to inform the motor how many rotations to complete as well. Stepper motors come in a variety of different step sizes which can determine the amount of granularity you can control the motor with depending on your applications, there are certain pitfalls with stepper motors when driving at particularly low speeds though so this may require more consideration before you pick a motor for your specific application.

\$\endgroup\$
3
  • \$\begingroup\$ You can also put a positional encoder on any old motor if you want to use your own form of positional feedback. Or even just a magnetic sensor as commonly used on BLDC motors (aka PMSMs with control circuitry). \$\endgroup\$
    – Hearth
    May 26, 2022 at 15:26
  • 1
    \$\begingroup\$ It would be less common for a stepper motor to have an encoder. The beauty of a stepper motor is you pulse the windings and it moves a given step. No need for an encoder. \$\endgroup\$
    – Kartman
    May 26, 2022 at 17:20
  • \$\begingroup\$ @Kartman Unless there's the possibility of the load becoming to great and skipping steps. \$\endgroup\$
    – Hearth
    May 26, 2022 at 20:31

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.