Controlling a Motor rather than just Commutating a Rotor
Motor control is, as its name implies, the task of controlling one or more aspects of a motor. Speed control is the goal in many motor control applications. Controlling a motor’s speed requires at least two steps:
- Calculating the motor's current speed.
- Running a control algorithm based upon the speed of the motor to determine what adjustments need to be made in order to achieve or maintain the desired speed.
Determining a motor’s speed is achieved by identifying when a rotor reaches a particular location, then determining how much time it takes for the rotor to return to the same position on the next rotation.
There are two methods of determining the location of a motor:
When sensored feedback is used, a sensor is attached to the motor which then asserts digital signals as the rotor reaches a predetermined location. The MCU observes the sensor's output and calculates the motor's speed.
Hall Effect sensors are frequently used on motors with magnetic rotors. Attached to the stator, the Hall Effect sensors signal the MCU when the rotors magnetic field is detected. Once asserted, the signal from a Hall-Effect sensor stays high for 180 electrical-degrees. Using three Hall-Effect sensors attached at 60 electrical-degree intervals provides the MCU with the ability to track the motor as it commutates through the electrical rotation (see the graph). Knowing the speed and relative position in the electrical rotation allows the MCU to more be more responsive to changes in motor speed.
Some motors offer a quadrature encoder sensor. These sensors assert two signals which can be used to calculate both the location and the direction of the motor. Many dsPIC®s have a quadrature encoder input (QEI) peripheral which can perform the speed and direction calculations of QEI signals without using the CPU resources. When using the QEI peripheral the speed of the motor is retrieved by reading an MCU register.
Sensored feedback require the additional cost of sensor and cabling.
According to Faraday’s law of induction electric motors act as both generators and motors. As the rotor moves through the magnetic stator field, a voltage is induced across the coils. This voltage opposes the original applied voltage and is called back Electromotive Force or simply “back-EMF”. The value of a motor’s back-EMF is dependent upon the speed of the rotor and its location within the field. The phenomena of back-EMF allows you to determine the location of the rotor by simply using the MCU’s ADC peripheral to measure the voltage of a winding which is not activated.
Filtering and reading the back-emf allows the MCU to determine the location of the rotor.
The back-EMF voltage can also be connected to a comparator to trigger a digital input at a certain voltage (i.e. motor location)
Compare to using a sensor sensorless feedback costs less but uses more CPU resources.
In closed loop control applications, there are several algorithms which can be used to implement control. Among the most commonly used algorithms are the Proportional Integral (PI) and the Proportional Integral Differential (PID). Control algorithms and the parameters passed to them are used to model the expected behavior of the system being controlled.
Selection of the control algorithms and their parameters is typically under the purview of the mechanical engineering team and is the subject of much discussion in the motor control community. A considerable amount of time and effort is spent on fine tuning the control algorithms and selecting the parameters. Microchip's motorBenchTM Development Suite supports the most common motor control algorithms and also provides an easy to use interface to allow fine-tuning of the algorithmic parameters.
Motor control has an additional concern not found in all control applications: the load dynamics. Depending upon the material the motor is moving, the force exerted on the rotor by the load will change with the speed of the motor. This variation is not always a linear function of the speed. Fans and pumps typically experience loads with non-linear load variations. Fine tuning the parameters for an application, especially those with a variable load, is a not a trivial task.