]> rtime.felk.cvut.cz Git - ert_linux_web.git/blob - rpi-pmsm-control/index.html
0ed99273f48217787104549919889146fa96b492
[ert_linux_web.git] / rpi-pmsm-control / index.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2    "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5   <title>[[!meta title="Raspberry Pi Permanent Magnet Synchronous Motor (PMSM) Control"]]</title>
6   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7   <link><style type="text/css">
8     #main_content {max-width: 70em}
9   </style>
10 </head>
11 <body>
12
13 <div id="main_content" style="max-width: 60em;">
14
15 <p>
16 [[!img rpi_pmsm_motor_control-graphs1.png size="300x" align=right alt="Simulink connected to RPi running PMSM control model"]]
17 <a href="http://en.wikipedia.org/wiki/Raspberry_Pi">Raspberry Pi</a> is often
18 used for education and many hobbyists tasks but it is not equipped with hardware
19 peripherals required for a quite complex vector electric motor control task.
20 This project sumplements bare Raspberry Pi board by two other boards to implement
21 complete educational BLDC/PMSM motor control system. One board uses small
22 Microsemi IGL00 FPGA to implement missing peripherals and the second board
23 implements 3-phase power stage with current sensing, ADC and galvanic
24 isolation which can be used in this project or even connected
25 to Altera DE2 education kits.
26 </p>
27
28 <h2 id="psmscontrol">Three-pases PMSM Control Basics</h2>
29 <p>
30 The differences between Voltages connected to the three stator windings
31 terminals cause current flow which forms rotating magnetic field.
32 The direction and magnitude of this field drive permanent magnet
33 rotor which is to align with the direction of the magnetic field vector.
34 North pole is attracted to the south and vice versa. For constant speed
35 and torque, the waveforms of the phase Voltages (the same for currents)
36 are sinusoidal with an equidistant phase shift of 120 deg. The three phases
37 system is in some respect redundant, in the case of Voltages (u<sub>A</sub>,
38 u<sub>B</sub>, u<sub>C</sub>) only differences count, i.e. one can be
39 fixed to zero. A sum of the three currents (i<sub>A</sub>, i<sub>B</sub>,
40 i<sub>C</sub>) has to be zero by the Kirchhoff's current law. As a consequence,
41 only two independent quantities/scalars are needed to describe the currents
42 or Voltages which are in the fact vector in the 2D space.The polar coordinates
43 system can be used but a rectangular system of alpha, beta components is equivalent
44 and easier for transformations computation.
45 [[!img pxmc-pmsm-block.png size="500x" align=right alt="Basic PMSM control setup diagram from PXMC library documentation"]]
46 This transformation of the three phase
47 system to the two orthogonal components vector is named according to its
48 inventor Clark transformation. The waveforms in this 2D system are sine
49 and cosine for steady speed state. Because realization of a controller
50 in this altering components system is not feasible, another transformation
51 was invented which convert the quantities to the coordinates fixed to
52 the revolving rotor. A base formed by direct (D) component aligned to North,
53 South pole direction of the rotor and orthogonal quadrature (Q) has been
54 introduced by Robert H. Park and the transformation is named according to him.
55 The control in the D-Q coordinates is (almost) independent of actual rotor
56 position and (in simplified outlook) separates reactive current (i<sub>D</sub>)
57 from the active current (i<sub>Q</sub>) resulting in torque affecting rotor
58 movement. The simplified diagram of PMSM motor control ins included for ilustration
59 (source <a href="http://www.pxmc.org/">PXMC</a> library documentation).
60 </p>
61
62 <h2 id="hardware">Hardware</h2>
63 <p>
64 The RPi (and its BCM2835 SoC) is equipped with only single accessible
65 PWM output and no peripherals suitable for incremental rotary encoder
66 (IRC) signal processing are found on the board. Analog to digital
67 converters are missing as well. The two extension boards with required
68 peripherals and power stage have been designed and produced at <a href="http://www.pikron.com/" target="_blank">PiKRON</a> company.
69 The first one includes Field Programmable Gate Array (<a href="https://en.wikipedia.org/wiki/Field-programmable_gate_array" target="_blank">FPGA</a>) <a href="http://www.microsemi.com/products/fpga-soc/fpga/igloo-e" target="_blank">IGLOO AGL125-VQ100</a> produced by Microsemi company. The design of logic programmed into FPGA has been implemented by Martin Prudek in a frame of his <a href="https://dspace.cvut.cz/bitstream/handle/10467/62036/F3-BP-2015-Prudek-Martin-Bp_2015_prudek_martin.pdf" target="_blank">bachelor theses</a>. The FPGA design includes:
70 </p>
71 <ul>
72   <li>SPI interface which connect peripherals to RPi board
73   </li>
74   <li>32-bit qudrate encoder (IRC) position counter based on design of Marek Peca's (<a href="https://rtime.felk.cvut.cz/gitweb/fpga/quadcount.git" target="_blank"> quadcount</a>)
75   </li>
76   <li>three PWM outputs with half-bridge enable enable signals
77   </li>
78   <li>finite state automata for acquiring current measuremts from analog to digital converter and filtering/decimation of multiple fast reads for slower RPi processing
79   </li>
80 </ul>
81
82 </div>
83
84 </body>
85
86 </html>