# Stiffness control of DC motor using PWM

Is it possible to control the output torque of a brushed DC motor using PWM?

From my understanding the speed is directly proportional to voltage applied and torque is proportional to current drawn. So if the load of the motor increases it will just simply draw more current (if the load is within its torque limit). Since I do not have any current controller in my motor driver board there is no way I can control the output torque of the motor. How can I solve this problem? I read that a hardware feedback loop using an operational amplifier can be used to keep the current proportional to the reference voltage. Is this correct? And is it possible to make such a circuit for a 90W, 24V DC motor?

• Are you in fact trying to keep output speed constant under varying load conditions? Oct 3 '16 at 12:08
• No, I need to control the torque of the motor. But unfortunately the motor driver that I have can only control the voltage using H-bridge. Oct 7 '16 at 11:43

I get the impression that this question is partially about speed control of a DC motor rather than just trying to keep the torque constant to a demand setting.

From my understanding the speed is directly proportional to voltage applied

This is only true if torque isn't changing. With increasing torque at a constant voltage supply, speed will drop. This effect is caused by the finite DC motor armature resistance. If this resistance were zero then speed is proportional to voltage.

So if the load of the motor increases it will just simply draw more current

And, unfortunately slow down a bit.

I read that a hardware feedback loop using an operational amplifier can be used to keep the current proportional to the reference voltage. Is this correct?

You can use a series resistor (monitoring motor current) and op-amp to create a near-constant speed characteristic across a decent range of load torques. It's not great but it does significantly improve speed regulation compared to not having it.

Try looking up a document by Texas (Burr Brown) entitled DC MOTOR SPEED CONTROLLER: Control a DC Motor without Tachometer Feedback. This explains how it is achieved.

• The method that you linked to in that document ... is that basically just an IR compensation circuit?
– Eric
Oct 3 '16 at 16:31
• @Eric yes I believe it is. Oct 3 '16 at 16:32
• I'm not concerned about the speed drop, I want to convert my PWM controller to a current controller. After reading a lot about amplifier i learnt that to make an amplifier circuit for 90W motor i'll need huge heat sink as the extra power coming from source needs to be dissipated. I will need an amplifier with minimum twice the voltage ratting (With back EMF) and current limit of at least stall torque. Oct 7 '16 at 11:51

"Is it possible to control the output torque of a brushed DC motor using PWM?" Yes - torque is proportional to current.

If the PWM source is a micro-controller then you need to measure the current (consider ACS712 or similar which will output a voltage: V=Voffset + k*Imotor), capture with an ADC and then write a PI control loop to adjust the PWM duty cycle.

Here is a example control loop that might be called in an interrupt (of course removing the while(1) then)

while(1) {
Ierr = Idesired - Imeasured;
err_sum += Ierr;
PWMcommand = Kp * Ierr + Ki * err_sum;
}


You'll need need to scale the variables, work out units, and signs, etc - but that is the basic structure.

For tuning, set Ki to near zero, lock the rotor and apply a step in Idesired and look at the response. The step current needs to be similar to that which you'll drive the motor. I'll assume its 1amp. Increase Kp until the step response has overshoot then back off a bit. With Kp alone, there will always be an error in Imeasured - esp once the motor starts during. To correct this you need the integral term.

With the rotor locked, continue your ~1amp current step and increase Ki. Again you want Ki large - but not so large as to cause oscillation. If Ki is too small the PWM response will be slow when the motor speed changes - and thus the torque will change.

The PWM frequency also effects the control loop coefficients (Esp the Ki) So use a constant PWM frequency. The frequency is typical at least 20Khz to not be audible, but ultimately it more about the motor inductance, current ripple and the rotor inertia.

There are countless university classes dedicated to the topic of control theory. These are needed to make a surgical robot - but what I said will get your first torque controller working!

You can control the torque of a brushed DC motor by controlling the current through the rotor respectively by controlling the voltage over the rotor.

You won't be able to control the motor current if you don't have a current sensor, but you will be able to control the speed of the motor if you have a speed sensor. Your target is to command a speed of zero rpm and the controller will adjust the rotor voltage in order to achieve this target; it will control the "stiffness" of the motor.