Study and implementation of space vector pulse width modulation inverter on an arduino

. Three-phase two-level inverters using space vector modulation (SVPWM) technology are one of the most popular inverter architectures today. The process of designing and manufacturing inverter systems usually goes through the following stages: simulation, hardware design, software programming on MCU, editing ... In this article, we will focus on problem researching and implementing the SVPWM algorithm on an Arduino in detail. Besides, it is also based on the experimental survey of the inverter's parameters, analyzing and proposing improved solutions for the inverter to operate optimally. SVPWM algorithm is tested on Arduino Mega 2560 board and small power inverter model.


Introduction
Currently, AC controlled drives are widely used in industrial power supply, housing and public services. Asynchronous AC motors consume more than half of the world's produced electricity [1]. Enterprises have largely replaced the electric drive control circuits from electrical devices with inverters to improve productivity, reduce product costs, increase energy efficiency and increase competitiveness. The technique of controlling the power switches in the inverter is used by many different methods such as Hysteresis Current Controller; Sinusoidal Pulse Width Modulation; Discontinuous Pulse Width Modulation and Space Vector Pulse Width Modulation [3]. Space vector modulation (SVPWM) is very different from other PWM techniques. This is a more complicated method to generate a sinusoidal voltage with a higher voltage amplitude across a motor with less total harmonic distortion. Space Vector PWM (SVPWM) is an advanced method. The PWM method is algorithm-intensive and is by far the best used in the inverter's switching control. Implementing an SVPWM is difficult because it requires complex math operations. However, with the development of Microcontroller, DSP or FPGA and neural networks, it allows the implementation of Space Vector PWM control algorithms more easily and is capable of performing many complex drive control applications of 3-phase electric motors [4][5][6][7][8]. On the basis of the SVPWM modulation platform for two-level three-phase inverters (2L3P), engineers and scientists recently developed a series of inverters with the structure and algorithm of multilevel (order > 2) with low harmonics and high power [5,9]. However, SVPWM technology for 2L3P inverters is still the basic structure and is widely used today due to: 1) its simple structure; 2) reliable performance; 3) the modulation algorithm is not too complicated ... Therefore, the study aims to build a three-phase 2-level inverter with open-loop type, controlled by SVPWM algorithm on Aduino microcontroller, 220V single-phase input power source, 380V three-phase output voltage, supplied to the load is motor with a capacity of less than 1KW. To ensure the safety of the inverter operating, it is also designed with a number of protective functions such as overheating, over current, or too low voltage etc. In addition to easy survey of the parameters, an LCD display is used, for displaying the inverter's operating modes, current values, voltage values of input, and output.

Materials and methods
For the purpose of designing and manufacturing testing equipment and analyzing the operation of an inverter, so the hardware must have a structure that is not too complicated, easy to disassemble, capable of expanding necessary functions, ensuring that operational safety. However, must have all the basic properties of inverters commonly used in industry. The basic structure of the inverter includes rectifier, filter, inverter, control circuit, isolator and display circuit [7,10]. The most important part of the inverter is the conversion from direct voltage to frequency adjustable alternating voltage, which is the job of the inverter. The voltage source inverter is structured with 6 fully controlled semiconductor switches which can be MOSFET, IGBT, GTO, IGCT, etc. Today, with the ability to work at high frequencies, relatively large working power and low switching consumption, IGBTs are the most commonly used component for inverter circuits [11]. Using integrated 6 IGBT IRAM136-3063B reverse flow module with 30A maximum current, 600V maximum voltage, over-temperature and over-current protection function is suitable for our model. For easy processing of SVPWM control algorithm, low-cost, easy-to-program Arduino Mega 2560 control module, multiple input/output ports and high performance are selected. Arduino Mega 2560 is based on the 8-bit AVR microcontroller -ATmega2560 clocked at 16 MHz. It includes 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs and 1 SPI interface, and 1 USB port enabled. communicate with PC. The Arduino Due control module is isolated from the highvoltage dynamic circuit by the HCPL 2531 high-speed optical coupling chip. The power circuit of three independent phases IR2130 has been selected as the driver IC. Working voltage up to 600V, with low voltage and overcurrent protection function, the dead time time is about 2.5 s IR2130 to help the power switches work stably, safely and effectively. The hardware also includes a circuit that provides low voltage DC power, logic gates for pulse division and delay generation.
To evaluate the inverter's performance during calibration and testing, it is necessary to determine the waveforms and values of the input and output currents and voltages and control signals. In addition, effective measures must be taken to ensure electromagnetic compatibility in the 0.38 kV network, it is necessary to study the harmonic content of the current consumed by the frequency converter. One of the most effective ways to obtain this kind of information is by experimental research [12]. The measurement results allow us to analyze the spectral composition of the current consumed, after extending them into a Fourier series . Results of the test measurements were obtained using the digital oscilloscope ISDS205B and MultiVirAnalyzer software.

PWM space vector algorithm
2P3L type VSI voltage inverter implemented by SVPWM vector space modulation method has a voltage source reverse circuit structure consisting of 6 large power switches as shown in figure 1 Operation of 6 power switches including eight switching states circuit in which there are six non-zero states (1 to 6) and two zero states (0 and 7). The inverter's eight switching states can be converted into eight space vectors respectively. In each configuration, the vector identification uses logic notation '1' to denote positive phase voltage level (Upper transistor on, lower transistor off) and logic symbol '0' to denote negative phase voltage level ( Upper transistor off, lower transistor on). The relationship between the vector space and the corresponding switching states is shown in Table 1.

Three-phase load
Six nonzero voltage vectors are represented on graph space forming hexagonal orbits, of equal magnitude, out of phase by 60 degrees. It can be seen that when the space vector moves from one corner to another of the hexagon, only the state of one inverter pin changes. Zero space vectors are at the origin of the coordinate system. The space vector diagram is depicted in Figure 3.
Where T1, T2 are the lead times of the vectors V1, V2 and Ts is the sampling period (period of PWM). Since ̅ 1, ̅ 2, ̅ ref are constants and V0 = 0, the expression (1) becomes as follows: On the other hand, we have ̅ 1 = ̅ 2 = Vdc then expression (2) is rewritten.
Similar to the above, it is easy to determine the parameters when the reference vector is in the remaining sectors. If the sector in question is sector n then we get the following general formula: Based on the waveform, we can determine the working time of the switches in each Ts sampling cycle of 6 sectors as shown in Table 2.

Arduino Mega 2560
Control the inverter's switches To adjust motor speed, a potentiometer produces an Analog voltage that can be varied from 0 to 5V. This voltage is fed to pin A0 of the Arduino, which is the input of the 10 bit ADC converter. For the motor speed to be zero when the variable resistor value is at zero, as well as the maximum speed when the potentiometer value becomes maximum before ADC conversion, it is necessary to use the proportional conversion algorithm. . With the voltage value set by the potentiometer, we obtain the corresponding switching angle of the reference voltage vector in the vector space plane. The result changes the number of switching times of the reference voltage vector as it spins one revolution in the space plane, so the frequency of the voltage at the output changes. Additionally, the value of the ADC voltage also determines the magnitude of the reference voltage vector. For simplicity in this paper, we choose the constant modulation method Volts/Hertz (CVH). In this paper, the author chooses the maximum number of switching times of the reference voltage vector in a sector is 180 times corresponding to the minimum switching angle of 1/3 degrees. With the switching frequency of the reference voltage vector of 20Khz, the minimum output frequency for the motor is 20000/180/6 ≈ 19Hz. In a nutshell, the implementation of the modulation index m and rotation angle alteration algorithm changes the magnitude and speed of motion of the vector in the space plane to change the motor speed. All of the above is done in a timer interrupt channel of the Atmega 2560.
Modulation algorithm SVPWM is implemented based on a 16-bit timer interrupt with a fixed frequency of 20 Khz. In this paper, we use Timer 1 to implement the SVPWM algorithm. Timer operating in SVPWM mode is essentially a counter with a comparison. The counter is set to form symmetrical triangle pulses so when the counter value increases to the comparative threshold, the comparison stage performs the function of flipping the bit-flags and output pins on the MCU, copper. when it counts down and when the counter is equal to the lower comparative threshold, it flips the bitflags and output pins on the MCU back to their original state. In the symmetric method, the switching frequency is equal to twice the sampling frequency, which limits the number of active switching and therefore reduces switching losses. In addition, the symmetrical pulse pattern also reduces the high harmonics of the output voltage of the inverter. The timer operation to generate the SVPWM pulse is shown in figure 6. In the interrupt service program, it is necessary to calculate the time parameter values of the voltage vectors such as Ta, Tb, T0 and update the comparator register value to change the output pulse width as required. T0 minimize the calculation of the control algorithm here we use the table of lookup parameter Tb with 180 different phase angles of the voltage vector. The value of Ta is taken from Tb because its phase angle is always an inverse mapping of Tb. Finally, based on the timer comparison as described above allows us to determine the lead times of the power switches in each sector.

Results and Discussion
To test the proposed approaches and demonstrate the feasibility of implementation in practice, a research and test of a prototype in the lab of three-phase inverters have been completely developed as shown in figure 8. The test is carried out under the following conditions: Input is powered by a 220 V single-phase AC power supply to the inverter, switching frequency fPWM = 20 kHz, modulation index m = 0.85, applicable for 3-phase 0.75KW open-loop asynchronous motor speed control. After safety testing and test run show that the engine speed responds very well to the change of the set speed, the speed change over time is about 110ms, absolutely no overshoot. Test results were measured on the oscilloscope as shown in figures 8 and 9.  The waveform in Figure 10 shows that the output voltage of the inverter fed to the motor at frequencies of 10 Hz, and 35Hz has a similar shape. To the naked eye, however, it can be seen that at low frequencies the waveforms at more even cycles, this indirectly indicates that the total harmonic content of the inverter's output voltage (THD) is small. when in low frequency. This value increases as the frequency of the inverter's output voltage increases. For a more detailed analysis of the measured oscillation plots of the instantaneous current values, their spectral composition is obtained using Fourier series extensions. Considering the FFT spectrum in figure 10 c, d, we see the lower the frequency, the smaller and larger the percentage of THD harmonics is when we increase the frequency.

Conclusion
In the article, from theory to practice, a methodological basis for the development of a vector inverter with pulse width modulation controlled by a cheap Arduino module is built. At the same time, the decisions made in terms of the circuit make the research installation as versatile as possible and suitable for controlling asynchronous and synchronous permanent magnet motors. The versatility and flexibility of the motor control algorithm implemented in the microprocessor allow for various control principles.