# Controller for a Brushless DC motor (with ESC)

I have one of those BLDC Motors which are used in quadcopters and also an ESC to control it. I give it a PWM signal and it outputs the necessary condition for the motor to spin (AC signal).

The first question is: I think the ESC's output relative to its input is nonlinear. In other words, multiplying the width of the input pulse by 2 will not increase motor's speed in a factor of two. Am I right?

The second question is based on the first: in case it is a nonlinear system, how can I use a PID to control it? Suppose I want to build a controller (PID) in which I give a specific angular speed and the motors reach this angular speed as fast as it can with low or none overshoot. The input to this system will be something like a RPM value and the output is will be another RPM value (some speed sensor coupled to the motor). But somewhere inside the control loop one should place a gain K which converts the RPM value to a voltage or PWM value. If this relation is nonlinear, how can this be done?

• "I think the ESC's output relative to its input is nonlinear" that's my expectation too. Are you measuring rpm under load? Aug 15, 2014 at 19:04
• I did not measure yet because I have to build this sensor to read its RPM. I was designing the PID theoretically and this question came into my mind... I will try to measure now the angular speed with no load with an o'scope Aug 15, 2014 at 19:21
• I am not an expert on ESC's. However, I am told that if there is no load, some ESCs might try to burn out the motor. So when you measure, try to have some sort of load. Aug 15, 2014 at 19:26
• @gbulmer these ESC's know where the rotor is, they can do closed loop speed control. Oct 15, 2014 at 3:11
• @ChrisStratton - I can't see anything specific about the ESC in this question. Have you been chatting to the OP? Oct 15, 2014 at 14:34

If the nonlinear relationship holds for a wide variety of conditions, you could create a mapping function that removes the nonlinearity. The only issue would be if the function is non-monotonic (ie has a dip). Of course, you could always just apply the PID and experiment with parameter values. Unless the system is VERY badly behaved, you will probably find a result you like.

TL;DR Stop worrying and just try it

Most RC model ESC's have a linear throttle response. Specifically, the throttle input is linearly translated to a PWM ratio. If your ESC is designed to give a non-linear response then its instruction manual should tell you.

linear PWM control produces linear effective voltage and no-load rpm, however under load the speed will drop due to voltage lost in the motor's winding resistance. If the load is non-linear (eg. a propeller) then linearity will be affected and you may have to adjust PID tuning to compensate.

Most ESC's deliberately slow down the throttle response speed to filter out glitches and reduce current surging under heavy acceleration. One way to improve response speed is to increase the input pulse rate. The standard rate is 50Hz, but many ESC's can handle up to 400Hz. Some ESC's can be re-flashed with 3rd party firmware for even faster response, and you can even buy ESC's which have been pre-flashed for use with quadcopters.

• But note that there are three different things involved: pwm input, rpm and thrust. As long as I know thrust depends on the propellers but mostly you can approximate a quadratic function in respect to rpm (rpm vs thrust). Besides that you have the pwm vs rpm relation. I've made some poor tests and it seems that this is also non linear but in the opposite way (like a squared root function). Do they probably compensate each other and give me an approximately linear reponse in pwm vs thrust? Aug 16, 2014 at 4:58
• Power absorbed by the propeller is proportional to rpm^3. Thrust is proportional to rpm^2. However motor rpm drops as loading increases, and if the power source is a battery then rpm will drop even more due to battery voltage sag. Therefore the production of thrust from PWM will be somewhere between linear and squared, depending on the particular characteristics of the motor, prop, and battery. Aug 16, 2014 at 9:57
• No, Brushless esc's as described here do not output throttle-dependent fixed PWM, they output PWM to approximate A/C signals, using back-EMF rotor position detection to synchronize (and likely closed loop speed control) them. But you are right that the firmware is often application-customized. Oct 15, 2014 at 3:13