Trade-offs between programmable SoCs vs. dedicated MCUs in motor control
Editor's note: This article explains the basics of motor controller design and then uses two case studies to evaluate the use of a programmable SoC versus a dedicated controller solution.
Control systems are important in today’s embedded and industrial applications ranging from small hand held devices to bulky mechanical machines. Most automatic control systems use negative feedback for controlling a physical parameter such as position, velocity, torque, voltage, current, intensity, etc.
The parameter to be controlled is sensed by transducers and fed back to the input for comparison with a reference value. Subtraction of the sampled output signal from that of the reference input is called negative feedback. The difference signal , called the 'error', is then amplified to drive the system (referred to as 'actuation' ) in such a manner that the output approaches the reference value.
In other words, the system is designed to minimize the error signal and so is a closed-loop control system. Electro-mechanical systems form the broadest sector among traditional control systems where motor control is a commonly-used application.
In general, a motor control system is classified into sub-systems such as speed, position, or direction control. Let us begin with a simple speed control system where we are applying a constant voltage (V) to the motor. Any motor, by default, rotates at a particular speed (x) for a particular supply voltage (V). If a load is applied to the motor for the same voltage (V), the motor may slow down to speed (y). Thus, we cannot control the motor’s speed or make the motor rotate at a constant speed irrespective of any external factors. This is an open loop system. Hence, we need a feedback mechanism that can sense the speed of the motor and compensate for those factors.
Click on image to enlarge.
Figure 1 shows a closed-loop motor control system. Here, the motion controller compares the signal obtained from the feedback system with the actual input given to obtain an error signal that is then amplified and applied to the motor. In this system, the Motion Controller and Amplifier blocks to feed the correction factor to the motor can be implemented by a mixed-signal controller and optical rotary encoders can be used as sensors, since the output signal from this component can be easily decoded through controllers. Further explanation on each of these system blocks is offered below.
DC and stepper motors
An electric motor converts electrical energy into mechanical energy. Some common motors used in various industries include:
DC Motor: The simplest DC motors use a coil winding on a shaft, with fixed permanent magnets (Figure 2). When a voltage (V) is applied to the coil, current (i) flows through it. Since there is an existing magnetic field (B), a force (F) acts on the coil (by Flemings Right Hand rule), which makes it rotate. As soon as the coil reaches one of the permanent magnet's poles, it experiences a repulsive force and moves toward the other pole. This involves continuous rotation whose speed is determined by the applied DC voltage.
Stepper motor: A permanent magnet stepper motor consists of a permanent magnet rotor, coil windings, and magnetically conductive stators.
Energizing a coil winding creates an electromagnetic field with a north and south pole. The stator carries the magnetic field. The magnetic field can be altered by sequentially energizing or "stepping" the stator coils, and this generates rotary motion.
The working of a two-phase motor is illustrated in Figure 2. In step 1, phase A of a two-phase stator is energized. This magnetically locks the rotor in the position shown, since unlike poles attract. In step 2, phase A is turned off and phase B is turned on, causing the rotor to rotate 90° clockwise. In step 3, phase B is turned on but with the polarity reversed from Step 1, causing another 90° rotation. In Step 4, phase A is turned off and phase B is turned on, with polarity reversed from Step2. Repeating this sequence causes the rotor to rotate clockwise in 90° steps.
In stepper motors, the speed at which the motor rotates is determined by the speed at which steps 1 to 4 are executed.
The next part of the motor control system is a feedback sensor that can sense the status of a motor and feed it back to a controller. A rotary encoder is a simple electro-mechanical device that can produce suitable pulses for each step of rotation on its shaft. It can be classified into two types: absolute and incremental encoders.
Absolute Encoders: Absolute encoders give a fixed output for each position of the motor shaft. For example, if the encoder can detect the position of the shaft at angles 0°(fixed), 45°, 90°, 135°, 180°, 225°, 270°, 315° (total 8 positions - 45° resolution), a 3-bit value is assigned to each position, say from 000 to 111.
Incremental Encoders: With an incremental encoder, only the relative position of the motor can be determined (i.e., only the direction and angle of rotation relative to the previous position). An incremental encoder gives out two signals, A and B, both which will have a default value when no rotation is made, say logic 0 or logic 1. When a small angle rotation on the shaft is made, both signals A and B transit to the other logic for a short duration and come back to the default value. For every such rotation, transitions occur in both the A and B signals. Depending on the direction of rotation, a transition in A leads to a transition in B or vice versa. Figure 4 shows A and B signals for both clockwise and counter-clockwise rotation.
Rotary encoders can also be further classified depending on the operating principle used. They are:
Mechanical Encoders: Transitions in signals A and B occur as they come into contact with metallic ground (logic 0), one after the other.
Magnetic Encoders: The rotor turns with the shaft and contains alternating and evenly spaced north and south poles around its circumference. A sensor detects these small shifts in the position and the direction of rotation, depending on the direction of flux lines.
Optical Encoders: The rays from a light-emitting diode pass through a disk that has transparent and opaque sections attached to the shaft. The rays are detected by two photo-detectors (sensors A and B) which then generate quad-phase pulses A and B.
Figure 5 shows a sample mechanical encoder.