By Gianluigi Forte, Andrea Spampinato,
Marcello Palano and Alessandro Corsaro at STMicroelectronics
Field Oriented Commutation (FOC), also called vector control, a method for controlling electric motors, was invented in the early 1970s, and remains the most advanced motor-control technique available to the system designer today.
It operates by controlling the alternating currents that flow into the phases of the motor’s stator, decoupling them into two orthogonal components which rotate in a reference frame synchronous with the rotor’s magnetic flux – the so-called direct or ‘d’ and quadrature ‘q’ axes. In this way, it is possible to independently control both the torque and the magnetic flux, improving the motor’s efficiency and its dynamic response.
By properly controlling these two currents, the system can produce the maximum torque for any given input current. It accomplishes two other goals:
- to achieve the maximum efficiency
- to produce a fast response to speed-control signals, resulting for instance in rapid settling at a new target speed, or robust control of speed after a large change to the applied load
Other advantageous characteristics of FOC include the ability to produce controlled negative torque (enabling active braking), and to weaken the rotor’s magnetic flux (enabling operation at speeds above the nominal value).
STMicroelectronics provides a rich set of resources to help design engineers to implement new motor-control system designs. These include the STM32 FOC Software Development Kit (SDK) for Permanent Magnet Synchronous Motors (PMSM). At the start of any design, however, the first task will often be to get a real motor spinning. This Technical View describes an ST tool, the Motor Profiler, with a PC-based GUI which makes it easy to configure a motor which is controlled by FOC, as shown in Figure 1.
Why a configuration tool is needed
Engineers who have never worked with three-phase permanent-magnet motors might think that starting up a motor is like pushing a button.
Not so. Three-phase motors are synchronous machines, so the position and the speed of the magnetic flux and the rotor are the same. This means that, to drive it correctly, it is necessary to provide an energising force field that is synchronous with the rotor flux. Problems arise when there is no sensor in the system for directly measuring the speed of rotation and the orientation of the rotor flux. When an incorrect force field is applied, the motor simply vibrates at the applied frequency but does not rotate.
With the FOC technique, a robust rotor flux monitor or estimator algorithms are required in order to implement a drive circuit able to spin the motor at a controlled speed.
The catch is that both FOC and the self-sensing technique are based on models of the motor and the inverter. And these models need to be populated with correct values for various parameters, both electrical and mechanical. Moreover, a number of regulators are present in the algorithms and these regulators need to be properly tuned.
To tune these regulators manually would require repetitive empirical testing, after setting up firmware with the many parameters necessary for configuration. This approach is complex, and difficult to perform for engineers with little experience in motor control.
To ease the process, ST provides the Motor Profiler, an automatic measurement system embedded in the motor-control algorithm. It estimates all the parameters required by the FOC algorithm, and performs auto-tuning of all the regulator parameters.
The Motor Profiler allows any user to start a motor in a few seconds. The tool works with various combinations of ST’s control and power boards, so that an engineer can estimate the parameters of their choice of motor with its specific voltage and current requirements.
At the end of the procedure, the tool shows the estimated values, and the system is ready to run the motor.
How to use the Motor Profiler
A Motor Profiler project starts with the choice of evaluation board. ST supplies many boards which are compatible both with the tool and with FOC. One of the most popular is the P-NUCLEO-IHM001 Motor Control Nucleo Pack, as shown in Figure 2. This consists of:
- a NUCLEO-F302R8 control board, which features an STM32F302R8 microcontroller based on an Arm® Cortex®-M4 core. Operating at 72MHz and providing 64kbytes of Flash memory and 16kbytes of SRAM, this device is intended specifically for use in FOC motor-control applications.
- an X-NUCLEO-IHM07M1 power board, connected to the control
board via an ST Morpho extension. It is a three-phase driver board for brushless DC or PMSM motors based on the L6230 three-phase motor driver IC. It has a nominal supply-voltage range of 8V-48V and provides up to 2.8A of peak output current, or 1.4Arms. The board includes three-shunt and one-shunt current-sensing networks configurable by jumpers.
Alongside the boards, pack includes a reference motor: a seven pole-pair motor which has a nominal voltage of 11.1V DC and a maximum DC current of 5A.
The STM32 PMSM FOC SDK may be downloaded directly from the ST website. Users shoul install it before running the Motor Profiler tool. The tool works with various ST boards: the user can select the P-NUCLEO kit from the list include in the tool. Next, set the only mandatory parameter: the number of pole pairs – seven if using the reference motor. Then choose the maximum value for current and voltage to be applied to the motor.
After clicking the Connect button, the Motor Profiler will establish a serial communication with the board. On first use, the board will be automatically programmed with the correct Motor Profiler firmware.
Operation of the tool
The Motor Profiler firmware is able to perform a set of measurements using the inverter and the motor themselves as measurement instruments. No extra hardware or instrumentation are required. The inverter board’s current-sensing network will measure the current flowing into the motor phases and the PWM outputs which energise the motor terminals. These characteristics are sufficient to perform all the procedures required by the Motor Profiler.
The simplest measurement taken by the Motor Profiler is the phase-to- phase resistance: to do this, a voltage is applied to the motor terminals, and the current is measured by the current-sensing network. The resistance is computed by applying Ohm’s law.
From this point, the Motor Profiler’s operation uses an incremental approach: when a measurement has been performed, the value is used to perform the next measurement. For instance, once the stator phase’s resistance has been measured, the value is used to measure the stator phase’s inductance. The incremental measurements and computed values are shown in the GUI.
After the electrical measurements, it is the time for the mechanical parts. The motor is speeded up by increasing the torque in steps in order to measure inertia and friction. The Motor Profiler provides the best results if the tests is are performed in the same conditions as the final application. The Motor Profiler procedure should therefore be performed when imposing on the motor a torque or load that is equivalent to the load that the motor will drive in the final application.
Refining the motor’s operation
At the end of the Motor Profiler procedure, the motor will be stopped. If the procedure has been successful, the system will be tuned for the motor.
The user can then click on the Play button and start the motor spinning again, but this time in a tuned and controlled way. The Motor Profiler includes a slider which lets the user set a target speed, and a bar which represents the motor’s actual speed. By moving the slider, the user can verify that the motor is running at the target speed. It is also possible to set a negative speed, reversing the direction of rotation from clockwise to counter-clockwise.
If a fault condition occurs, it is indicated by a set of LED indicators in the GUI. For instance, if the power supply to the inverter is switched off while maintaining the supply to the microcontroller board, the Bus Under-Voltage LED will turn red, indicating a fault condition, and the motor will stop. As soon as the fault condition ends, the motor will restart automatically at the most recently set speed.
By using the Motor Profiler tool, all of the configuration and control of a real-world motor has been accomplished without writing a single line of code, or even installing a compiler or any kind of development environment.
The engineer can save the results of the configuration in a motor database, and use them in the ST Motor Control Workbench in the ST PMSM FOC SDK, a fully customisable environment for developing motor applications.
Orderable Part Number: P-NUCLEO-IHM001