Motor Control
There are two main types of control system, open loop and closed loop. An open loop system is essentially manually controlled or involves operating a load under fixed conditions. For example, a cooling fan will usually not need precise speed control, and might simply be switched on and off from a fixed voltage supply. A closed loop system uses sensors to monitor the system outputs and control them automatically, so, in a motor, the output speed or position is more precisely controlled. The dynamic response (i.e. when there is a change in speed or position) should then be more predictable, particularly when starting or stopping. Position control in a robot arm (Figure 11.1) is a good example of a motor application using digital feedback in a closed loop system.
The block diagram in Figure 11.1(b) shows the operation of one axis. The motor is controlled via a PWM drive (see Chapter 8), and its position and speed are monitored via an incremental encoder, which produces a pulse train as the motor rotates. A sequence of positions is specified in the robot program, and the main controller sends the next position required to the axis controller as a certain number of steps from the current position. The axis is moved accordingly, with the axis controller accelerating and decelerating the motor to provide mooth motion and accurate end position, using the feedback provided by the encoder.
A small, inexpensive, brushed (having a conventional commutator) dc motor will be used to demonstrate the use of the PICĀ® microcontroller (MCU) in a such a control application, allowing simple open and closed loop operation to be investigated. More sophisticated systems
these days tend to use brushless motors, as they are more efficient and reliable, but are more complicated to drive, as they need electronic commutation. This entails the microcontroller switching the windings on and off in sequence, and monitoring the current to provide precise control.
Motor output is measured as the shaft speed or position. Open loop control of a motor would consist of simply switching it on and off for a fixed period to position it, or varying the speed, under manual control. There are obvious limitations to open loop control. A dc motor will not start from stationary until there is a significant current, owing to inertia, stiction and its electromagnetic characteristics. This makes its response non-linear, at least at low speeds,
which means that the speed is not directly proportional to the current or voltage applied. In addition, the speed cannot be accurately predicted for any given current, because it will vary with the load on the shaft. The final position of the shaft when the motor stops cannot be precisely controlled either. Therefore, if the speed or position of a dc motor is to be controlled accurately, we need sensors to measure the output, and a control system for the motor drive.
A simple analogue potentiometer can measure position, by converting it to a voltage, or speed can be measured using a tachometer (essentially a small dc generator), which produces a voltage that is proportional to the motor speed. These transducers have traditionally been used in analogue motor control systems, where all the signals are continuously variable currents and voltages. With the development of digital control systems, feedback is usually
derived from switching sensors (optical or magnetic) and the microcontroller provides a programmable device in which the program can be designed to handle the motor
characteristics and load requirements, and the dynamic response can be adjusted in software.
The speed of a dc motor is controlled by the current in the armature, which interacts with the magnetic field produced by the field windings (or permanent magnets in small motors) to produce torque. An analogue control system gives continuous control over the motor current, and a digital to analogue drive converter can be used at the output if the feedback and control are digital. However, the control interface can be simplified if pulse width modulation (PWM) is used. PWM is a simple and efficient method of converting a digital signal to a proportional drive current. Many microcontrollers now provide dedicated PWM outputs, but we are going to generate the control signal in software here for simplicity.
Digital feedback can be obtained from a sensor, which detects the shaft rotation, as in the robot axis above. One way of doing this is to use a perforated or sectored disk attached to the shaft and an optical sensor to detect the slots or holes in the disk. The shaft position can be detected by counting pulses, and the speed by measuring their frequency. This signal can be fed directly to a microcontroller, which monitors the pulse input, and varies the output to control the speed and/or position of the motor.