## Controlling Small DC Motors

PM motors, stepper motors and brushless DC motors

### Permanent Magnet DC Motors

A DC motor is an electromechanical device that converts electrical energy into mechanical rotational energy when energized by a constant voltage (DC). Mechanically, it consists of a rotor and a stator, and electrically of a field and an armature. In the very common permanent magnet (PM) motor, the stator contains the permanent magnet that provides a constant magnetomotive force and the pole pieces, while the rotor is the armature, through which the motor current flows. There is a complete magnetic circuit through field and armature, with only short air gaps that allow the armature to rotate. Current flowing in the armature experiences a force in the magnetic field that causes the armature to rotate. This force is proportional to the current and to the strength of the magnetic field. When the armature rotates, an electromotive force is induced in the armature windings that would, acting alone, cause a current opposite in direction to the current causing the armature to rotate. This is the back emf that is very important to the operation of the motor. It is proportional to the speed and the strength of the magnetic field. The commutator, a rotating switch consisting of segments connected to the armature windings and the brushes mounted on the stator through which current enters and leaves the motor. The commutator ensures that the direction of current flow in any armature winding is in the direction that gives a force in the direction of rotation.

When the motor is running steadily under load, the armature current is exactly sufficient to provide the necessary torque. Since the armature resistance is low, the speed is such that provides a back emf a little less than the applied voltage, according to V - V' = IR, where Vis the applied voltage, V' the back emf, I the armature current, and R the armature resistance. This signifies that the speed is proportional to the applied voltage, while the torque is proportional to the current. If the required torque is too large, the motor stalls, and its speed can be reduced to zero, when the current is a maximum V/R. This causes large heat dissipation, which may damage the motor. To reverse a PM motor, it is only necessary to reverse the polarity of the applied voltage.

In an ideal motor, the rotation speed is directly proportional to the voltage, or ω = KVV. This V is actually the back emf. The torque is directly proportional to the current, or T = KTI. The work done by the motor is ωT, while the electrical energy input is VI. These two equations give ωT = KVKTVI. By the conservation of energy, ωT = VI, so KVKT = 1. The constant KV is often given in motor specifications. To find KT, it should be expressed as radians per second per volt by multiplying rpm/V by π/30.

The original method of speed control was to connect a rheostat in series with the motor. This is unsatisfactory because the voltage applied to the motor depends on the current, so rheostat settings do not correlate simply with the speed. Also, an expensive power rheostat was required that generated considerable heat. A better solution is the use of a variable-voltage supply, which did give consistent speed settings. Another method of speed control avoids varying the applied voltage by applying it as a series of pulses, whose width varies from zero to continuously on, called pulse width modulation (PWM), at a relatively high frequency, say 10 kHz.

A PWM signal can be created very easily with the circuit shown at the right. The PIC12F675 includes an ADC and an 8-bit timer. The timer runs continuously, and its timeout period is the period of the PWM signal. If it is configured for no prescaler, it counts at the rate of f/4, in this case 2.5MHz. The resulting PWM frequency is 9.77 kHz. Observe the PWM signal with an oscilloscope, noting how it changes when the potentiometer is rotated. If the 8 MHz internal RC oscillator is used, the PWM frequency will be 7.82 kHz, which may be satisfactory.

The program is shown at the left. The basic idea is that a speed command byte read from the ADC and stored in a variable SCOM is added to the instantaneous value of TMR0. If a carry is produced, the PWM output is turned on, while if there is no carry it is turned off. The ADC byte varies from 00 for off to FF for full on. The initialization is also shown in the program. Bit 1 of TRISIO must be cleared for the output on GPIO1, and its ANSEL bit is also cleared for neatness, though not required for digital output. The option register configures the timer, while ADCON0 configures the ADC. Note that we must not trigger the AD converter in the same instruction that turns it on, or the trigger will not be recognized.

The motor power supply is shown at the right. The H bridge supplies current of either polarity. With the MOSFET's shown, it can furnish 5 A, but larger MOSFET's can be used if a higher current is necessary. The MOSFET's are driven by the very useful TC4469 from Microchip. The maximum supply voltage is 18V and the minimum is 5 V. It can supply up to 250 mA by itself, so can be used alone for small motors. The input responds to 5V CMOS logic levels, so it can be driven directly by a PIC. The direction input is simply a logic level. The feedback to the inverting inputs of the AND gate is very useful. The direction input controls which of the two upper MOSFET's is turned on, while the PWM input controls the appropriate lower MOSFET.

Large DC motors have wound fields, not permanent magnets, to produce the field magnetic flux. In the shunt motor the field and armature circuits are separate, and the field is energized across the line, so the magnetic field is constant and acts much like the PM field. The motor is reversed by reversing the armature current. The field current may be controllable. A strong field results in slower speed and greater torque for the same current, while a weak field results in a faster speed. When starting the motor, armature current must be limited by placing a resistance in series with it. A shunt motor is essentially a constant-speed motor, unless the voltage applied to the armature is variable.

In the series motor the armature and field windings are in series, so that a large armature current implies a strong field and large torque at low speeds. The series motor is a variable-speed, high-torque motor controlled by the voltage applied to it. To reverse the motor, the armature circuit must be independently reversed. As the speed increases, the back emf increases and the current decreases, reducing the field and allowing the motor to speed up. The field winding may be shunted to reduce the field further, allowing a further increase in speed. On starting, the current must also be limited. A compound motor has both shunt and series field windings, proportioned to give a desired torque-speed relation.

The commutator brushes are placed so that there is a minimum voltage induced in the windings connecting adjacent segments so that sparking is avoided. when the armature is carrying a current, the neutral position tends to rotate proportionally to the current so that the brushes are not properly placed. This is counteracted by additional field windings between the main poles called commutating poles that carry the armature current and produce a field that keeps the neutral position unchanged.

### Stepper Motors

The purpose of stepper motors is to move to definite positions, not to create rotary motion. They can be made to rotate continuously, but are distinctly inferior to motors designed for rotary motion in this case, with much lower efficiency and torque, and significant vibration. As positioners, they can be operated in an open-loop mode that makes them much simpler and cheaper than servo motors.

Stepper motors have a wound stator with salient poles and a rotor of soft iron or permanent magnets. There are three main types: variable reluctance, permanent magnet or hybrid. A variable reluctance stepper has three or more field windings that produce a rotating magnetic field and a rotor that snaps into positions of minimum reluctance with respect to the field poles. A permanent magnet stepper often has two sets of windings and a permanent magnet rotor that is attracted by the field poles. The hybrid stepper operates much like the permanent magnet stepper, but has a more complex construction that allows a small angular step. The rotor and stator have teeth, and the rotor is magnetized by permanent magnets so that the two ends are of opposite polarity.

Let us now concentrate on an easily available form of stepper motor, a small permanent magnet motor with 15° or 7.5° steps and 5 or 6 field leads. Such a motor is called unipolar when the two field windings are in pairs, with a common lead and two windings that produce a magnetic flux in opposite directions. The common lead is usually connected to the positive supply, and one or the other of the two windings is activated, perhaps by a BJT switch that connects the ends to ground. The two halves of the winding are never activated at the same time. Such motors have 6 leads, or 5 if the common leads are connected together. How the connections are arranged can easily be determined by measuring resistance between the leads, first separating the two windings, and then determining which is the common lead. The motor I used gives 15° steps, and each winding is 22Ω, so with a 5V supply, the current is 227 mA.

I put a cardboard disc on the motor shaft that passes through an interrupter module. The 24 positions of the motor are marked on the disc, with one segment cut out so that the interrupter module can detect this position. This will allow the program controlling the motor to determine this position as a reference. Each winding end is connected to on of the drivers in a TC4469, which can supply the required current without the need for a separate H-bridge of MOSFET's.

The General Electric H22A1 interrupter module is no longer produced. An alternative is the Siemens IRLA075, whose pinout is shown at the right. It is the same as the H22A1's pinout, but the pin numbers are not marked. This also appears to be an old part, and a data sheet is not available from any source. The IRED has a maximum continuous current of 60 mA. With a 5V suopply and a 100Ω resistor, the current is 35 mA, which is ample. A 4.7kΩ collector resistor is sufficient for a logic output, which goes from near the positive supply to about 100 mV. The maximum collector voltage is 30V, and collector current 50 mA.

Note how the stepper behaves when one winding at a time is energized. If 1 represents energized and 0 unenergized, the sequence 1000 0010 0100 0001 should give successive steps of 15°, and if repeated the motions continues. If two windings are energized at one time, the torque is √2 times the torque with one winding. Try the sequence 1010 1001 0101 0110. The stepper will again step in 15° increments, but the positions will be halfway between those for one winding energized. If we combine the two sequences we can step in half intervals. Explicitly, the sequence is 1010 1000 1001 0001 0101 0100 0110 0010.

Try executing the sequence for two windings, but disconnect the common leads from the positive supply. The stepper will still step, just as before! The reason for this is that we are now using the two windings of a pair in series, and reversing the current direction through them, since the TC4469 will source as well as sink current. This is an example of bipolar operation. Some steppers may be intended to be operated in this manner, and will have only 4 leads. Note that if we use the same supply voltage, the current is halved, but since we have two windings, the ampere-turns are the same. It is not a good idea to increase the number of ampere-turns, since we may saturate the magnetic circuit.

The circuit for computer control is shown at the right. The two logic switches marked "on-off" and "dir" may be used for any purpose. They could be pushbuttons for steps in either direction, for example. The LED was used to indicate when the position was the one detected by the interrupter module, and is not essential.

Routines for performing one step in either direction are shown at the left. The routine for an anticlockwise step is the same as the one shown for a clockwise step, except that it calls the "antic" table. There are several ways to do this, but I thought the easiest was this table lookup of the next state. The variable COM holds the current output state, which can be only 5, 6, 9 or A. COM - 5 is a pointer into the table for the next state, which is returned in W and stored as the new value. Since the windings are connected to bits 4-7 of PORTB, the proper value to output at PORTB is COM swapped. These routines do not contain anything for maintaining the position of the motor, which must be added if desired.

### Brushless DC Motors

Brushless DC motors use electronic switching instead of a mechanical commutator. The stator has salient poles and windings, often as in a three-phase motor with multiples of six poles, in which a rotating magnetic field is produced. The rotor may have permanent magnets, as in a stepping motor, and may be inside or outside the stator poles. The rotor may be made of soft iron with salient poles in a reluctance motor, in which the reluctance of the magnet circuit varies with rotor position. Back emf is produced with a permanent magnet rotor in the usual way by variations in the magnetic flux generated by the rotor magnets. In the reluctance motor, the flux changes due to the variable reluctance and this creates the back emf. It is always necessary to conttrol the voltagees applied to the windings to be in phase with the back emf for greatest efficiency. The instantaneous position of the rotor can be detected by the controller by looking at the back emf on a winding that is not energized at the moment, or by sensors which may be Hall effect switches or optical encoders. Some motors run simply as synchronous motors with the controller supplying a three-phase excitation of a chosen frequency that determines the rotational speed. If rotor position is detected, the motor can be run with PWM voltages so that its speed is proportional to the average voltage applied.

Low-cost brushless motors are very popular in radio controlled (RC) aircraft, cars, helicopters and boats. These motors have three leads, probably for wye-connected three-phase stator windings. They are controlled through an electronic speed control (ESC) module that receives commands from the radio and controls the battery power, often lithium polymer cells. It is not clear from the advertising if the motor control is sensorless, using the back emf, or whether the motors run synchronously. Another field of application is small blowers and ducted fans. These motors have solid state control included, and are probably switched reluctance motors, but may have permanent magnet rotors.

The small brushless motor available from All Electronics (DCM-270) is marked "Igloo Products Corp.", which is an insulated chest manufacturer. This motor is probably a fan motor made in China, and is unknown on the Igloo website. It has a permanent magnet outrunner rotor and an integrated solid state drive taking its 12V DC supply from two wires. It is not easy to diassemble, but stator windings can be seen in the gap below the rotor. Its speed does not depend significantly on the applied voltage between 5 and 18 V, and it can be stopped by retarding the rotor, with only a small torque tending to rotation. It is apparently a 3-phase synchronous motor.

Industrial quality motors are much more expensive and generally considerably larger than the hobby motors. They may have three Hall sensors and eight leads in all, three for the wye-connected stator windings, three for the sensors, positive sensor supply, and ground. Other designs have an optical encoder on the shaft, which probably functions much like the Hall sensors. Control with sensors is straightforward and fairly simple, but sensorless control using the back emf is much more complex. The Microsoft AN857 gives a very good description of control, including software for the sensored and sensorless cases. The trapezoidal voltages applied to the stator windings are very similar to three-phase sinusoidal excitation. Six MOSFET's allow each of the three coil ends to be connectyed to the positive supply or to ground.

The Pittman N2311 motor has six stator poles and four rotor poles, with a permanent magnet rotor and Hall sensors. It is mentioned in AN857, and would be a good motor for experiments. However, it seems to be expensive, \$250 or so, and is not easily available. Similar motors do not appear to be available as surplus at low cost.

### References

An excellent review of stepper motors is Jones on Stepper Motors

Brushless hobby motors and controllers can be found at HobbyKing

Many types of motors are explained in Motor Guide

The Wikipedia articles on motors are not particularly good, but should be read.

Return to Electronics Index

Composed by J. B. Calvert
Created 3 September 2010
Last revised 29 September 2010