# Introduction

In this article I’ll go through a few DC motor (and as a matter of fact complete mechanical system) models of various complexity. Most of the discussion is centered around coming up with equivalent electrical circuits, because – well, because I’m an electrical engineer.

The article will go into quite a bit of detail, but don’t feel obligated to read through the whole thing. You can gain quite a bit from reading the first chapter alone.

# Electrical model

If all you care about is a simple motor model that works well for sizing H-Bridges, this is the only chapter you need to read. The model introduced here doesn’t account for the effects of mechanical components. It treats shaft speed as a constant. This model will not be useable for control applications, where you try to electrically compensate for the effects of mechanical components. The main assumption in the model introduced here is that the mechanical time-constants in your system are much higher than the electrical ones. That’s true in almost all cases, but you would need to read through the rest to understand why. With that, let’s jump right in!

A DC motor is an energy conversion device: it takes electrical energy and turns it into mechanical energy. When operated as a generator, it does the opposite: converts mechanical energy into electrical.

In the simple motor model we start off with, the mechanical parameters are completely ignored. On the electrical side, the motor basically contains a number of inductors, that move in a magnetic field. The inductors themselves of course have an inductance, and some internal resistance. Their movement in the field will generate a voltage across the inductors. From this description, the following model can be drawn:

In fact in many cases, the internal resistance of the inductors can be disregarded, and the even simpler model, an ideal inductor in series with a voltage source can be used:

In both cases, all the elements are in series, so the share the same current. We’ll denote it with ‘I’.

# Mechanical model

The picture however is more complicated, if we consider the mechanical elements as well. The motor in the mechanical domain can be approximated by a rotating disc:

In this simplistic model, the moving part of the motor (the rotor) has some moment of inertia (J_{m}) and some friction (f_{m}). The remaining letters on the image are: ‘T’ for the torque on the motor and ‘s’ which is the rotational velocity or speed. An ideal motor has no losses, so f_{m} is 0. Normally introductory texts use viscous friction to model mechanical losses in the motor, due to its linear behavior. However that model is way too simplistic to be practically useful at least in my experience. So while the model I’m using is very similar to the one introduced here for example: http://www2.ece.ohio-state.edu/~passino/lab2_rotary_dynamics.pdf, we will have to take some non-linear behavior into consideration.

In many cases, you can use this model for the whole mechanical portion of your design: it basically describes a motor driving a mass with some loss. This is a good enough model for example for the drive-train of a wheeled platform (an R/C car or a mobile robot), as you will see later. The model gets more complicated of course if you need to consider springs or spring-like elements. For belt-drive mechanics for example, this model cannot be accurately used.

If you start considering highly non-linear effects in the mechanical (or electrical for that matter) domain – effects of wind-resistance for example – things get even more complicated but I will not consider those problems here.

# The gateway between the two worlds

We said that a motor is an energy conversion device. We need to describe this conversion, and this description will connect the electrical and the mechanical world together. We know that the voltage induced on the motor windings (V_{g}) is proportional to the rotational speed (s) of the motor. We also know that the motor torque (T_{m}) exerted by the motor is proportional to the current (I) flowing through it. Note that T_{m} is not the torque that’s measurable outside of the motor. This is the torque that was converted from the electrical current. Some of that torque will be used up on internal losses in the motor and only the remaining portion is available for external use. We can describe these relationships with two constants in the following way:

T_{m} = K_{T}*I

and

V_{g} = K_{E}*s

In an ideal motor, the conversion has a 100% efficiency, which means that the power on the electrical side must be equal to the power on the mechanical side. In other words:

I*V_{g} = T*s

Using the previous conversion equations, we get:

I*K_{E}*s = K_{T}*I*s or K_{E} = K_{T}

So, in the ideal case, the two conversion constants are identical.

# Electrical equivalent

Next, we will come up with an electrical circuit that – if you examine it from the outside on the electrical domain – would be indistinguishable from our motor. First, however we have to modify a little-bit our electrical model. We know now that the generator voltage depends on the speed (s) in the mechanical world, so we need to replace the constant voltage source with a controlled one:

Now, on the mechanical side, we have a rotating mass and friction to consider. These ‘elements’ are on the same rotating shaft, so their rotational velocity – speed – must be identical. Each of them will exert a torque on the shaft as they are moving, but the relationship between the speed and the torque is different for each of the components.

## Friction

For friction, the torque it constant, only its direction changes, depending on the rotation direction of the shaft. The torque introduced by friction is in the opposite direction to the rotation of the shaft: it acts against the motion, draining energy out of the system. In the following however we’re going to look at the components from the systems’ perspective. In that view, we need to ‘feed’ some torque into the component to compensate for its internal torque. The relationship between the speed and the torque (called the characteristic equation) can be described by the following equation:

T_{f} = sign(s) * f_{m}, where f_{m} is a constant describing the amount of friction.

Now, if we assume that the motor shaft is rotating in the positive direction only, we can use the following simplified form:

T_{f} = f_{m}

Keep in mind though, that friction is a non-linear element, so as soon as we consider direction-changes, the first, more complex equation needs to be used.

## Mass

The rotating mass of the motor introduces a torque that’s proportional to angular acceleration, or the derivative of the speed. The mass accts against change: it’s torque will try to counteract acceleration, but just as above, I’ll leave the negative sign out because we’re investigating from the systems’ perspective.

T_{J}= J_{m} * (ds/dt), where J_{m} is the moment of inertia of the mass

## Electrical Conversion

Our goal is to find electrical components (resistors, capacitors, inductors etc.) that – from the electrical side – look just like these mechanical parts do. We have to answer two questions: what those components should be and how to connect them together?

Let’s tackle topology first: as I said before, the two mechanical components share the same speed, and speed is related to voltage. From the conversion equations we know that torque is proportional to current and speed is proportional to voltage. So our mystery electrical components share a common voltage, but have their own independent current (the torque on the mechanical components is different). This means that the components must be connected in parallel:

Now, let’s move on to the components themselves! Using again the conversion equations and putting them into the characteristic equations for the friction we get the following:

K_{T}*I_{f} = f_{m} or solving for I_{f}: I_{f} = f_{m} / K_{T}

Doing the same for the mass, we get this:

K_{T}*I_{J} = J_{m} * (dV_{g}/dt) * 1/K_{E} and, again solving for I_{J}: I_{J} = (J_{m}/(K_{E}*K_{T})) * (dV_{g}/d_{t})

For friction, we need an electrical component, that has the property that current through it is constant independent of the voltage applied to it. That component is a current source. Friction consequently can be represented by a current source, with a current of:

I_{f} = f_{m} / K_{T}

Moving on to the mass, we need a component where the current is proportional to the derivative (or rate of change) of the voltage across it. That component is a capacitor: I = C * (dV/dt). So the inertia of the disc can be represented by a capacitor with a capacitance of:

C = J_{m}/(K_{E}*K_{T})

Our final equivalent electrical circuit is capacitor in parallel with a current source:

This is the sub-circuit that we previously represented by a controlled voltage source. In fact, the source of that voltage is the energy stored in the rotating disc, which we represented here by a capacitor. If left alone, that energy is drained by friction, just as it is drained by the current source in the equivalent circuit: the motor would eventually stop, and the generator voltage would go down to 0. The complete equivalent motor model is this:

# A Practical Example: the R/C Car

But just how useful this model is? To be honest not terribly, as you rarely use a motor without anything connected to it. Modeling the mechanical properties of just the motor is not that practical. Luckily, the same model can be used for a wide range of applications, for example for moving platforms.

In this example, I’ll dust of my old Tumbleweed robot. It is based on a Stampede R/C car. A first-level mechanical model is fairly simple for this kind of platform: the motor through a number of gears, drives a wheel, which than moves the whole body.

From the motors perspective, it looks as if it moves the whole weigh of the car as if it was spread around the circumference of the wheel. The gears can be simplified into a single gear-box with a ratio on ‘1:N’, and we can further assume that the inertia of the gears are negligible compared to the inertia of the other components. With this, we get to the following model:

Here, the motor is represented by our usual model of a lossy rotating disc (parameters with the ‘m’ suffix), and our load is represented by another lossy rotating disc of the same kind (parameters with the ‘w’ suffix).

The new component is the gear-box, so let’s talk about it first! Gears work as torque-speed-converters. They multiply the torque by ‘N’ and reduce the speed by a factor of ‘N’:

T_{w} = T_{m}*N

s_{w} = s_{m}/N

We have our previous equations for the torques ‘consumed’ by a disc and the draw from before:

T_{dw}= f_{w} and T_{Jw}= J_{w} * (ds_{w}/dt)

Putting s_{m} into these equations we get:

T_{dw}= f_{w} and T_{Jw}= J_{w}/N * (ds_{m}/dt)

Now, from the motors’ perspective, it only sees 1/N-th of this torque through the gear-box (remember, gear-boxes convert torque). So the torque of these components expressed on the motor-end of the gear-box are:

T_{dm}= 1/N *f_{w} and T_{Jm}= 1/N^{2} * J_{w} * (ds_{m}/dt)

It looks like our components kept their properties, but their effect shrunk. So, now that we’ve eliminated the gear-box, we ended up with the following model:

This can be further simplified, by combining the two discs and the two frictions into one of each:

And now, we’re back to the previous model: a single disc and a single friction. We just have more complex equations for calculating the values. Of course this also means that the equivalent circuit will be identical as well, except that the values of the current-source and the capacitance are now a little more complex:

I_{f} = (f_{m}+f_{w}/N)/K_{r}

and

C = (J_{m}+J_{w}/N^{2})/(K_{E}*K_{T})

A further simplification can be made as well: we can say that the inertia of the motor is negligible compared to the inertia of the whole body (even after the gear-conversion). That results in a further simplified capacitor model:

C = (J_{w}/N^{2})/(K_{E}*K_{T})

## Getting to the numbers

Models of course are only useful if you can actually model something with them. And in order to do so, we have to be able to come up with actual numbers of these letters. So let’s see how we can do that!

My robot weighs about 2.3kg and it has a roughly 8cm wheel diameter. If we ignore the fact that some of the weigh comes from rotating components themselves, from the motors perspective, the robot looks like a 2.3kg mass distributed evenly around the circumference of this wheel. The inertia for such an object (a hoop) is m*r^{2}. From that:

Jw = 2.3kg*(4cm)^{2} = 36.8 kg*cm^{2}

The total gear-ratio between the motor and the wheel is around 19:1. I have a Mabuchi RS-550PF motor in this robot, which according to it’s datasheet has a K_{T} of 4.418 mNm/A. With a little math (for details see the article on how to read motor datasheets) we get K_{E} = 4.726 mV/rad/s. Using these numbers, the equivalent capacitance is:

**C = 0.49F**

That’s a lot of capacitance!

As for the current source, I did a little experiment. From the electrical equivalent we know that if we don’t connect anything to the wires of the motor, the only thing that drains energy out of the system is the current source that represents friction. So, if I start moving my little robot with the motor open, than let it free, its speed should decrease linearly until it comes to a halt. By measuring how long it took it to stop and how far it went I can calculate the friction that was in action.

In my experiment, the robot travelled about 1m before it stopped, and it took about 1.5s to do so. The mass of the robot is 2.3kg. The total kinetic energy stored in the system in the beginning was:

E(0) = 2.3kg * v(0), where v is for velocity

Let’s figure out the initial speed (v(0)) first: we know that the speed decreases linearly (the friction acts as a constant speed-independent force) to 0, and it took 1.5s (t_{t}) to do so. During that time the car travelled 1m (l):

The area of the triangle is the total distance travelled (l) while the height of it is v(0) and the base is the total time travelled (t_{t}). From this:

l = 1/2*t_{t}*v(0)

solving it for v(0):

v(0) = 2*l / t_{t} = 2*1m/1.5s = 1.33m/s

Putting v(0) back into the energy equation, we can figure out the initial kinetic energy, and from that we can calculate the force (the frictional force) that drains this energy in 1.5s:

F_{friction} = E(0) / t_{t} = 2.3kg * 1.33m/s / 1.5s = 2.044 kg*m/s^{2} = 2.044 N

From the motors perspective, this friction acts at the radius of the wheel (4cm) so the corresponding frictional torque is:

f_{w} = 2.044 N * 4 cm = 81.78 mNm.

If we ignore the friction in the motor, we can now calculate the equivalent current in the current source:

I_{f} = (f_{w}/N)/K_{r} = (81.78mNm / 19) / 4.418 mNm/A

Finally we get:

**I _{f} = 0.97A**

I’ve also taken an impedance meter and measured the internal resistance and inductance of the motor:

**L _{m} = 170 µH**

**R _{m} = 2.8 Ω**

## Conclusions

At this point we finally have a complete model of the R/C car with values for each of the elements. Once again, to summarize, here’s the equivalent circuit for the whole car and the values for each component:

C = 0.49F

I_{f} = 0.97A

L_{m} = 170 µH

R_{m} = 2.8 Ω

and if you want to go back and forth between the mechanical and electrical domain:

K_{T} = 4.418 mNm/A

K_{E} = 4.726 mV/rad/s

Let’s see now, what we can learn from these numbers!

First of all, the I_{f} current tells us that we need to pump ~0.5A into the motor just to keep the car running at a constant speed (on this particular flat surface anyway – friction is highly dependent on the surface and slope introduces another type of mechanical element we haven’t talked about).

We can also start examining the circuit in the frequency domain. Keep in mind that in the frequency domain the current source has no effect. For starters let’s plot the current over the capacitor as a function of frequency, when the circuit is driven by a constant (amplitude) voltage:

Being a simple-enough circuit, it’s easy to calculate the parameters of this curve. The center-frequency (resonance) is at 1/(2π*sqrt(L_{m}*C)) = 17.5Hz, but the Q of the circuit (sqrt(L_{m}/C)/R_{m} is low, only 0.006. That’s why you see such a flat response around the resonance frequency. The lower cut-off frequency is determined by C and R and is at 0.11Hz, the higher cut-off frequency is determined by L_{m} and R and comes out at 2.6kHz.

If you plot the voltage across the capacitor over frequency as well, you get the following plot:

Not surprisingly, you get a low-pass characteristics, with the slope of the attenuation starting out at 20db/decade and increasing to 40db/decade after the 2.6Khz mark.

Now, remember that current is related to torque and voltage across the capacitor (V_{g}) is related to speed. What these plots tell us is that beyond 0.11Hz we don’t have too much hope to influence the speed of the motor. Two decades above that, at around 10Hz we might as well as forget about it: the speed will not budge. This is important when you try to design a speed control loop. It tells you what you’ve probably already known before: mechanical systems are slow to respond. What might be a little surprising is that the cut-off frequency is not entirely determined by the mechanical elements: it is a function of the inertia of the rotating mass (the capacitor) but also of the motors internal resistance (R_{m}). But if you think about it a little more, it’s not that hard to understand: a lower internal resistance motor will be able to influence the speed of load quicker.

Another thing that these charts tell you is (and this might sound counter-intuitive) that at DC you won’t be able to put any torque on the motor. At first that doesn’t seem right, is it? You definitely can load down a motor and get some torque out of it! Well, in fact you can do that, but we’re talking about something else here: can you change the torque of the motor **without **changing the load on it? It turns out you can’t, and if you think about it you’ll see why. Let’s say you try increasing the voltage applied to the motor in hopes that it will increase the current, thus the torque on the shaft. What will happen is that for a short while in deed the current will spike up, but the extra torque will be used to **speed up **the shaft. That speed-up in turn will increase the generator voltage and lower the current. By the time the transient is over, your current is back to where it used to be, only the speed of the shaft got higher. Of course there’s some DC current going into the motor as well to compensate the frictional losses – we’ve modeled that with the current source – but that’s not torque you can get out of the system.

Internal loss is also the reason why you can put a DC current through a motor, when the shaft isn’t turning at all. In that case our kinetic friction gets replaced by another type of friction – static friction – that is consuming some torque. Its that static friction (or it’s electrical equivalent) that your can push some DC current through in a stationary motor. Static friction however is highly non-linear and in general nasty enough to model, that I left it out from this discussion.

Let’s now move on and consider the upper end of the frequency spectrum. One thing immediately should be obvious: beyond a 10Hz or so, the capacitor voltage (shaft speed) has so much attenuation that you can consider it constant. Since almost all PWM drivers operate beyond this frequency, they should not be concerned by the voltage (speed) fluctuations during a cycle. This is the explanation why we started off our motor model with a constant voltage source and this is why that’s a good-enough approximation for H-bridge design – not for speed-controller design though!

If we increase the PWM frequency beyond the second corner-frequency – 2.6kHz – the current will not be able to keep up with the voltage changes anymore. As you move into this region with the switching frequency, your current wave-form will look more and more like a triangle wave and the current amplitude (called ripple-current) will start decreasing dramatically.

If you look at what determines the second corner-frequency (R_{m} and L_{m}), you’ll see that it’s only determined by the motor parameters and is unaffected by the load. It is usually a good idea to set the PWM frequency beyond this cut-off frequency to reduce ripple-current – which translates into extra loss on the internal resistance. It’s good news that you can set this frequency without looking at the loading and the mechanical environment the motor is in.

Finally, let’s talk a little bit about another interesting – but at first unexpected – observation. At first sight it might seem that the internal resistance of the motor is a nuisance, that we have to live with: the lower the better, since it only creates loss, and heat. But if you look back to our circuit (a series RLC), you’ll see that if you reduce R too much, you will create a resonance. As an example, if I replace my resistor with a 10mΩ one, my frequency response curves change quite a bit:

and

What does that mean? It means that at our resonance frequency (17.5Hz) the motor inductor and the rotating mass will start resonating. If we have input into the system at or around that frequency, the energy will hang around in the system for a long time, creating unwanted vibrations. Those vibrations can affect mechanical accuracy, shorten component live or even threaten the integrity of the system.

### Links

Here are some useful links for more information on certain topics you might find interesting:

http://robots.freehostia.com/Motors/Motors.html

http://www.gearseds.com/files/Lesson3_Mathematical%20Models%20of%20Motors.pdf

I’m also planning on another article to dig even deeper into motor modeling, so if you’re interested check back soon for more!

Thanks, really interesting.

Typo: nuance instead of nuisance

Hi thanks for this article, interesting I will test to do some calculation

Br Conny