General inquiry on Permanent Magnet DC motor control

Thread Starter

Xavier Pacheco Paulino

Joined Oct 21, 2015
This post is kind of long, but anyone willing to read it and contribute is well appreciated.

As far as I know, DC motor control is a topic widely covered and well understood. With today's technology, it has become relatively easy the speed control of this kind of motor. As a project for college, I decided to genuinely build a PWM based PMDC motor speed controller for treadmill application. I wanted to use PI/PID controller for the speed control. My project idea was kind of ambicious because I wanted to control any treadmill that has PMDC motor up to 4HP. Some of you have seen my previous posts on this, and I'm happy to say that I've put into practice many of your advices with excellent results. When I say that I've been "genuinely building" this controller, I mean that I have been able to design, theoretically calculate, and select the appropiate components from a simple resistor to the power semiconductors. Also, the full development of the hardware and software. I'm aware that nowadays there are many DC motor controllers, but the idea of the project is all learning, not putting it into production. I'm having the opportunity to work in the electronics field while studying, which has helped me a lot to see the things from a practical insight.

I can say the project works 80%. Just some adjustments to be done. Now, let me explain why I'm writing this post and need the opinion of experienced people on the topic.

As I said above, DC motor speed control should not be a complex topic, and for the application I'm working I don't need a complicated control (I think). I have seen many cheap DC motor controllers, and they don't have anything sophisticated (and they work :D). I have been discussing with my professor the following issues, and I want to know if I'm wrong, or he's wrong, or both of us are wrong.

First scenario
He says: Control system setpoints should be given in steps.
I say: My setpoint should be a ramp, because in treadmills you can't go from 0.5 mph to 1 mph instantly. The speed should be gradually increasing.
He says: You don't need a ramp to slow down the sudden speed changes. Your P parameter should adjust the time response of the system.
I say: Once the final setpoint is reached as ramp, the PID controller should compensate the output for changes in the load. My feedback is a speed sensor that will tell the controller the actual speed. If I said my setpoint is 0.5 mph, the PID doesn't care if gave the setpoint as a ramp or step.

Second scenario
He is asking me that my software should identify the motor parameters&characteristics, and autotune the PID gains for the specific motor connected, because I told him I wanted to control any PMDC motor up to 4HP. And this is to be done without MATLAB, all embedded software. Also, the motor parameters should give the right PWM frequency. I thought motor characteristics have very little to do with PID control. It is the reaction of entire system (a.k.a. Plant) and the desired PID behavior (response time, stabilization time, overshoot etc.) that define control terms. Also, I thought that any DC motor would work for a PWM frequency ranging from 2 to 25 kHz. To sum up, I do not have a master degree on control systems, all I know is the basics, and feel this is a complex topic.

Finally, I would appreciate your advices as I'm feeling I'm digging too deep in something that probably doesn't require it.


Joined Jun 19, 2012
Seems like the first part should be to define the goals.

The complexity of the system should be based on achievement of the specified performance, not your professor's whimsy.
I would harass the professor to define what it's supposed to - exactly, then you decide what's necessary to do the job.

If it's really just a treadmill, it doesn't need that much in terms of precision control.
You are correct in your idea that the set point should be ramped, relying on the PID control system response makes little sense.
You want to build a control loop that responds to control "authority"- then you craft an input (ramp) that makes it do what you want, without contradictory parameters. (ramp speed vs. response to load)


Joined Jul 18, 2013
Most T.M. controllers and other 'simple' systems do not require full PID control and do not use this. If any do it is often PI at most.
Full PID control is usually reserved where great precision is required as in Servo systems, CNC, etc.
In the latter systems, modern encoders go up as far as 100,000 p/rev and usually start at 2500 p/rev, minimum.


Joined Jan 23, 2018
One option that is quite good and demonstrates a great deal of creativity is to do the speed control as a phase locked loop, with an optical pickup, such as an encoder, producing a frequency base on the motor RPM, and the phase error signal then increasing or decreasing the drive to the motor. Then your setpoint device becomes the reference oscillator for the PLL. Now going from one speed to another is simply a matter of changing the oscillator frequency. And frquency control of oscillators is a very mature technology, so you will have lots of resources available. I used this method for the speed control of a maglev device that was supposed to go into the Disney World EPCOT center many years ago. When my design worked perfectly I was let go so that others could produce the maglev hardware, that was the last that I saw of it. but the PLL for motor speed control was really good.