Recently we were asked to help troubleshoot a problem a customer was having driving a DC motor. Needing more throughput, they changed to a more powerful motor but then began having problems with the controller board. Since they were driving the motor with a PWM output to control the speed it seemed like the system would be amenable to simulation using LTSpice. Brushed DC motors are rather simple beasts, they have a fairly linear transfer function (input current to output torque) over a moderate range of operation, and there aren’t too many nasty parasitics to deal with. The file archive of the LTSpice mailing list has a model of a DC motor but it did not allow for applying arbitrary loads to the motor. A model for LTSpice is described here at the University of Colorado which allows us to load the motor model with various amounts of torque to gauge the motor’s performance. Spend some time looking over that presentation then come back here where I take a look at a real world example.
Deriving parameters of the motor needed for simulation can be a bit tricky. We need to measure the winding resistance and inductance and the current through the motor at a couple different operating points. Measuring the DC resistance accurately is probably the most critical of these. Motor speed can be accurately measured with an oscilloscope. Winding inductance can be measured with an LCR meter or a bridge or even an oscilloscope. Taking a look in the junk box to see what we might be able to use for a victim we found an old window lift motor still in pretty good shape. This type of motor is operated with a heavy overload and is designed for short intermittent operation so we have to be quick when making measurements, particularly at full speed. It’s also likely to not be very efficient. Prepare to make the measurements by putting a little power to the motor and let it spin up a bit to seat the brushes and clean off the commutator so we can make accurate measurements.
Step 1: Measure DC winding resistance.
The method I chose actually gets us two things we need to know, the winding resistance, and the ‘Tloss‘ parameter needed to model the motor’s mechanical side. The process is simply to connect the power supply to the motor with an accurate current meter in line, and make Kelvin voltage connections to the motor leads with a voltmeter. Start off with the power supply output at 0V and slowly increase the voltage until the motor starts to turn. Adjust the voltage up and down to find the point at which the motor just stops turning, and a very slight increase in current will cause it to begin moving again. Fine tune this as best you can, since the value of the current is critical for computing Tloss. Take readings of the current and voltage at this point and simply apply Ohm’s law to compute the DC winding resistance:
`Rm = (Vm)/(Im)` or `Rm = 0.714/1.741`
which works out to about 0.410 ohms.
Step 2: Compute motor K constant.
The next parameter to measure is how effectively the motor converts current into useful work measured as output shaft speed and torque. We applied 6V to the motor and measured the input current and shaft speed. To measure the shaft speed we just took the scope probe and touched it to the worm gear. Once every revolution the gear would bump the tip of the probe and allowed us to make an accurate measurement of the shaft’s speed. The measured frequency of the pulses displayed was 44.25Hz. Shaft speed `omega` is given in terms of radians per second so simply multiply 44.25 by 2`pi`. A second set of measurements was made at full rated voltage of 13.8V. So now we have:
At 6.0V: input current 2.318A, `omega` = 278
At 13.8V: input current 2.68A, `omega` = 690.5
We also need to find the back EMF at each operating point in order to compute motor constant K. The general formula for current through the motor is given by
`Vapplied-Vemf = Lm*((d(I1))/dt)+Rm*I1`
In this case since we are measuring things at steady state the inductance term drops out and we are left with Ohm’s law to find our back EMF of 12.7V for the 13.8V operating point. Since the motor constant K, back EMF and shaft rotational speed are related by
`Vemf = Komega`
we now can find our motor constant K to be approximately 0.0184. For our other measuring point at 6.0V K works out to about 0.0182, noting that at lower input voltages fixed internal losses will have a greater effect (consume more of the useful work) so this seems to make sense. Our internal torque loss Tloss can now be computed using the formula
`Tloss = K*I`
where I is the current we measured when finding the winding resistance with the motor shaft not turning.
Step 3: Measure winding inductance.
We’ll admit we punted here and simply used our trusty HP LCR meter to simply measure the winding inductance. Note: it helps to jog the shaft slightly to ensure the motor brushes are only making contact with a single rotor winding circuit, as evidenced by the readings on the LCR meter.
Step 4: Load parameters and fiddle the model.
There are two parameters for the mechanical side of the model, the moment of inertia and coefficient of friction, that may need slight adjustments in order to achieve correlation with measured motor performance. The default output from the ENC pin on the model is the shaft speed in radians per second remember, so the first order is to see how the motor behaves on startup. The input current should exhibit a slightly over damped response. Adjust the value of the J parameter until the input current and shaft speed curves exhibit reasonable behaviour. Without an external load the motor should spin up pretty quickly. Adjust the unloaded output shaft speed by making slight tweaks to the B parameter so the no load shaft speed matches the measurements on the bench. And that’s it! We can now apply varying loads (in Newton-meters) to the motor to see what happens to its shaft speed and input current. The motor model can be used in a circuit with PWM drive but note that all inputs and outputs to the motor model will have to be referenced to its ground terminal for things to work properly. There are some optional things in the motor model. For example if you want to simulate the output of a shaft encoder you will need to tweak things to get the right number of pulses per second and plumb up the arbitrary voltage source B2 to get pulses out instead of the shaft speed in radians per second. But once again LTSpice proves its great utility at doing simulations of all kinds, not just purely electrical circuit simulations.