# Modeling the torque of a real motor

I am trying to control a real inverted pendulum by means of a DC motor, for this I must model the torque of the motor, the work I've done in this direction is the following (which I believe is right): Something I don't get is, both the motor back-emf constant ($$k_e$$) and the torque constant ($$k_t$$) are supposed to be the same, at least as far as I've read on several places. Is it safe to assume both are the same ($$k_e = k_t = K$$), in which case, I can obtain the constant by measuring the angular speed and the voltage applied to the motor, and dividing both, right?

• Kt=Ke only in the case where SI units are being used. There can also be differences in how they are defined between motor manufacturers.
– welf
Mar 31 '20 at 22:15

Your general model for an electric motor could be for example, as follows.

$$J \phi ''(t)=\text{I} \tau -R \phi '(t)$$

with J as your [kg m^2] inertia, I in [A] amps, and R your friction...at the moment, I can't remember the unit is, and $$\tau$$ your torque constant [Nm/A]

This is a simple linear ODE and is solved also fairly easily. With initial conditions:

$$\phi (0)=0,\phi '(0)=\phi _0$$ $$\phi (t)\to \frac{J e^{-\frac{R t}{J}} \left(\text{I} \tau -R \phi _0\right)-\text{I} J \tau +\text{I} R t \tau +J R \phi _0}{R^2}$$

This is of course your angle dependant on time, but we want the change, or namely the velocity.

So we take the derivative, $$\frac{d\phi}{dt}$$

$$\omega(t)=\frac{i R \tau -R \left(\text{i\tau }-R \phi _0\right) e^{-\frac{R t}{J}}}{R^2}$$

If we take some a data trace we have from playing the motor at different amperages, we can calculate or fit R and J if they're unknown, like for example: With the values being {R -> 0.0000186966, J -> 0.000138553} for that particular example.

Or in your case, you can find your torque constant if you know the rest. However, generally you can find that in a motor data sheet...as it appears your don't have one, you can go about it this way. Are you using some kind of software to be able to read such things, matlab, mathematica, or scripted something yourself?

I would highly suggest trying to get a data trace and fit the data to $$\omega(t)$$ rather than messing around with the maths.