[[!rpi_pmsm_motor_control-graphs1.png size="300x" align=right alt="Simulink connected to RPi running PMSM control model"]] Raspberry Pi is often used for education and many hobbyists tasks but it is not equipped with hardware peripherals required for a quite complex vector electric motor control task. This project sumplements bare Raspberry Pi board by two other boards to implement complete educational BLDC/PMSM motor control system. One board uses small Microsemi IGL00 FPGA to implement missing peripherals and the second board implements 3-phase power stage with current sensing, ADC and galvanic isolation which can be used in this project or even connected to Altera DE2 education kits.

Three-pases PMSM Control Basics

The differences between Voltages connected to the three stator windings terminals cause current flow which forms rotating magnetic field. The direction and magnitude of this field drive permanent magnet rotor which is to align with the direction of the magnetic field vector. North pole is attracted to the south and vice versa. For constant speed and torque, the waveforms of the phase Voltages (the same for currents) are sinusoidal with an equidistant phase shift of 120 deg. The three phases system is in some respect redundant, in the case of Voltages (uA, uB, uC) only differences count, i.e. one can be fixed to zero. A sum of the three currents (iA, iB, iC) has to be zero by the Kirchhoff's current law. As a consequence, only two independent quantities/scalars are needed to describe the currents or Voltages which are in the fact vector in the 2D space. The polar coordinates system can be used but a rectangular system of alpha, beta components is equivalent and easier for transformations computation. This transformation of the three phase system to the two orthogonal components vector is named according to its inventor Clark transformation. The waveforms in this 2D system are sine and cosine for steady speed state. Because realization of a controller in this altering components system is not feasible, another transformation was invented which convert the quantities to the coordinates fixed to the revolving rotor. A base formed by direct (D) component aligned to North, South pole direction of the rotor and orthogonal quadrature (Q) has been introduced by Robert H. Park and the transformation is named according to him. The control in the D-Q coordinates is (almost) independent of actual rotor position and (in simplified outlook) separates reactive current (iD) from the active current (iQ) resulting in torque affecting rotor movement.

[[!img pxmc-pmsm-block.png size="300x" align=right alt="Basic PMSM control setup diagram from PXMC library documentation"]]