Implementation of SPWM Technique For 3 - VSI Using STM32F4 Discovery Board Interfaced With MATLAB

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

t

1s IEEE International Conference on Power Electronics. Intelligent Control and Energy Systems (ICPEICES-2016)

Implementation of SPWM Technique for 3-<1> VSI


using STM32F4 Discovery Board Interfaced
with MATLAB

Krunal Raol; Divyesh J. Vaghela2 and Mayur V. Gojiya3


1,2,3Department of Electrical Engg.; Institute of Technology; Nirma University; Ahmedabad; India
E-mail: [email protected]; [email protected]; [email protected]

Abstract-In this paperj Design and development of 11. BASIC CONCEPT OF PWM SCHEME
control circuit algorithm of 3-4» Voltage Source Inverter
(VSI) using Unipolar Sinusoidal Pulse Width Modulation The efficient method of output voltage control of
(SPWM) techniques is proposed using STM32F407VGTx inverter is to incorporate pulse width modulation control
discovery board interfaced with MA TLAB Simulink within the inverter. A fixed DC input voltage is supplied
Environment. For implementing 3-$ VSIj this method is to the inverter and a controlIed AC output voltage is
most useful as it will eliminate complexity of control circuit
obtained by controlling on-off period of the power
algorithm occurred due to analog circuitj reduces costj size
of filter required and improved overall inverter efficiency.
semiconductor devices used in inverter. The PWM method
Pulse width modulated voltage source inverter is preferred has many advantages such as; i.e. output voltage control
for high performance AC drives. The proposed control can be obtained without any additional components; with
scheme and the result obtained by embedded simulations this type of control; lower order harmonics can be
interfaced with STM32F4 microcontroller are presented and eliminated so that cost and time required for design of
discussed. A simple hardware implementation is proposed
filter circuit and size of filter is reduced. There are many
and experimental results of SPWM based VSI are also
methods to achieved PWM pulses; out of that SPWM
shown. The Simulation results of the proposed scheme have
excellent performance and compared with hardware results. method is illustrated in this paper. For SPWM techniques;
Keywords-SPWM-Sinusoidal Pulse Width Modulation; two signal are compared and based on comparison; gating
VSI-Voltage Source Inverter; STM32f4 Discovery Board; signal is generated to control on-off period of power
PWM-pulse Width Modulation; THD-Total Harmonie
semiconductor switches of inverter. For generation of
Distortion
gating signal using SPWM techniques; reference wave
I. INTRODUCTION having frequency of fr (sine wave) is compared with
carrier wave having frequency of fc (triangular wave);
The Voltage source inverter has a direct control over
when reference wave amplitude Ar is greater than carrier
output voltage. The output voltage waveform depends wave amplitude Ac; positive switch (upper switch) of
upon the type of inverter topologies used; i.e. voltage inverter is switch ON and when reference wave amplitude
source inverter and current source inverter. Output voltage
Ar is less than carrier wave amplitude Ac; negative (lower
of an inverter can be adjusted by internal control of switch) switch is ON and upper switch is switch is OFF.
inverter parameters. Most efficient method for internal
control of inverter parameters is Pulse Width Modulation �on, when
(PWM) techniques. In PWM techniques; input to the Ar>Ac
SI

inverter is constant stiff DC voltage and by changing on­
off period of the power semiconductor switches; variable
output voltage can be obtained. PWM techniques are
characterized by constant amplitude pulses and width of Load
these pulses is modulated to obtain inverter output voltage
control and to reduce its harmonic content. The main
objective of this paper is to design three phase voltage
S4 6 2
source inverter using sinusoidal Pulse Width Modulation
� on,when
Ar <Ac
(SPWM) techniques to reduce cost and losses occur in
control circuit by implementing the whole control
algorithm in STM32F4 discovery board using embedded
Fig. I: Three Phase Voltage Source Inverter
MATLAB simulation.

978-1-4673-8587-9/16/$31.00 ©2016 IEEE [1]


t
1s IEEE International Conference on Power Electronics. Intelligent Control and Energy Systems (ICPEICES-2016)

Figure 1 basic configuration of three phase voItage Another method is unipolar SPWM technique. In unipolar
source inverter with fixed DC input voltage source. SPWM; two triangular wave with given offset is
TABLE 1: SWITCHlNG compared with sine wave and based on comparison;
Ar> Ac SI or S3 or S5 is ON gating signal is generated for internal control of inverter.
Ar< Ac S4 or S6 or S2 is ON Fig. 3 shows unipolar SPWM techniques waveforms with
gating signals.
When triangular carrier wave has its maximum value
. fc
" dent wlth zero 0f the sme
comcl ' wave; there are N
2fr
= -

pulses per half cycle [1]. The ratio of vr is known as


Vc
amplitude modulation index. The magnitude of output
fundamental voItage is proportional to amplitude
modulation index and modulation index never be more
than unity. So output voltage can be varied by controlling
f
modulation index. The ratio of..E. frequency modulation
f
0.005 0.01 0.015 0.02 O.(]25

r
T i me {s)

Bipolar Sinusoidal pulse width modulation index and it controls the harmonie content of the output
voItage waveform. For modulation index < 1; highest
Fig. 2: Generation of Gating Signal using Bipolar SPWM Technique for
value of harmonic in output voItage waveform is
One Lag of Three Phase Inverter

.
oe
e

�::
.. - ..
- ------ ------
. ..
... .. ..
-----
. ..
------ -
;
: -- ------ ------ ------ ------ -- ; - - ------ ------ ------ ------ -- :-- ---- - -
. .. .. .. .. . .. .. ... . . ... .:. ... ... .. .. .. .. .. . . ; .. ... .. . . .. .. ..
------ ------ ---
.. ..
associated with harmonics of order t±1
where N is the number of pulses per half cycle. So by
or 2N±1;

. mI[�r�·-�··�9+mm
increasing the number of pulses per half cycle; the order
of dominant harmonie frequency can be raised; which can
; ....

I
0.1 •• •• ••• • •••• • ••• ••• i
·· ·································· ·· · ... .. . � . .
.... . . . ... . .. .......... ....................
be then filtered out easily. For modulation index > 1;
:� � + ••••••••.• •••• •••• • lower order harmonic appear; since modulation index> 1;
pulse width is no longer a sinusoidal function of the
angular position of pulse. The output frequency of inverter
is decided by reference wave frequency. Generation of
gating signal using analog circuit is too much costly and
Unipolar Sinusiodal Pulse width modulation losses as it required separate dc power supply for IC 741
Fig. 3: Generation of Gating Signal using Unipolar SPWM Technique for as weIl as it will increase bulkiness of control structure. So
One Lag of Three Phase Inverter to avoid this problem; this paper demonstrate design of
whole control circuit algorithm in digital domain using
STM32F4 microcontroller; so that complexity of control
circuit as weIl as size and cost of circuit is reduced. Also it
PWIIo1I l1Iree I'ttase will improve reliability of the circuit. Fig. 4 shows basic
1151 ..g Opfo
Drit�C"wit
gene-:r,atlon n� ... I ..g
block diagram of practical setup of voltage source inverter
C�plt!'l"!125
.,.,.. 011 .....1.
willl belp ,of IRf53lO
OiRaiils
STM12F4 MOSFiET' using STM32F4 discovery kit board.
disooY"Y1IJt

III. MATLAB SIMULATION OF 3- <I> VSI


AND ITS ANALYSIS

Figure 5 shows MATLAB simulation model of 3-<1>


VSI with resistive load. In simulation three phase shifted
reference wave is compared with one triangular wave to
generate gating signal for controlling output voItage of
inverter. Frequency of output voItage of inverter is
decided by frequency of reference wave which is to be
Fig. 4: Block Diagram of Three Phase Voltage Source Inverter using
STM32F4 Discovery kit fixed 50 Hz. By varying frequency of carrier wave; output
voItage of inverter is to be changed and also it will
SPWM can be classified in to two types: bipolar and
reduced all lower order harmonics depending upon
unipolar SPWM techniques. Fig. 2 shows bipolar SPWM
switching frequency. Fig. 6 and Fig. 7 shows output line
technique waveforms with gating signal. In bipolar
voItage of inverter with different switching frequency.
SPWM techniques; sine wave is compared with triangular
wave and based on comparison; gating signal is generated. Fig. 8 and Fig. 9 shows THD analysis of output line

[2]
t
1s IEEE International Conference on Power Electronics. Intelligent Control and Energy Systems (ICPEICES-2016)

voltage with different switching frequency. From Fig. 8


and Fig. 9; it is c1ear that by increasing carrier frequency
of triangular wave; lower order harmonic is reduced and
output voItage profile is improved.
r;;;::;::']

1I-t==:t===+== IThree
�-wv-�I
-Phase
:n-:b- Fig. 9: THD Analysis of Line Voltage (fr = 50 Hz and f e =2 kHz)
Series RLC Branch - (Without Filter)

IV. INTRODUCTION TO STM32F DISCOVERY BOARD


The ST Microelectronics STM32F407VGTx arm
cortex micro controller is world's highest performance
Fig. 5: MATLAB Simulation for Three Phase VSI using SPWM cortex M series micro controller. The following main
VP 1
specification of STM32 Discovery kit:
• Discovery board fitted with STM32F407VGT6
microcontroller running at 168MHz.
• Power supply with transformer and mains cable.
• Evaluation version of the keil MDK-ARM
development kit which includes a cross complier;
assembler; debugger.
STM32F407VGT6 micro controller in an LQFP100
package running at 168MHz(max) providing peak through
_____ -' ________ � ________•________ � ________ L _______
,
,
I
I
,
,
I
I
,
,
out of 210 MIPs; hardware level debugging is done by on
0.02 0.04 0.06 board ST-LINK !V2 debugger (SWD connector for
Time{s)
programming and debugging).There are various on chip
Fig. 6: Output Line Voltage of Three Phase Inverter with R Load (fi= peripherals are available such as ADC; DAC; GPIOs;
50Hz and f e = 1 kHz) Timers; USART.

&
VP1

100
A. Interfacing between MATLAB STM32F4 Discovery
Board
By using embedded coder target for STM32F4 and
-50
other functioning tools together with the Keil; real time
implementation of developed Simulink model can be
-100
developed and easily loaded into controller.
------- . -------- ,--------- --------
r -. ,..,
-150
, , , To run model file user need two hardware:
0.02 0.04 0.06
TiITlE-(S)
• ST Microelectronics STM32F4 discovery board.
• USB type A to mini B cable.
Fig. 7: Output Line Voltage of Three Phase Inverter with R Load
(fi= 50Hz and f e = 2 kHz)
Design a Simulink model comprises an embedded
target blocks as per requirements of application and
, ,
VP l
availability. The main directory path is located properly in
- ----------- ;- ------------:------------�------------� ------------
,
60
command window of MATLAB before building any
· ,
,, ,,
,, ,,
------- - :- --- - -- : - - - - - - - - - - - �- - - - - - - - - - - - � - --- -------
· ,
Simulink model file. The Support package for
------ - - -:- - - - -- - - - - - - -: - - - - - - -- - - - - -,: - - - - - - - - - - - - �, - - - ------ -
500 - -- - -- ---- -
· ,
· ,

,, ,,
· ,
- - - - STMicroelectronics STM32F4 discovery board enables
,
40

- ----------:- ------------:- - - - - - - - - - - - �- - - - - - - - - - - - � - -----------


, ,
· ,

30
· , ,
user to create and run Simulink models on a discovery kit.
----------- - ----------- ; ----------- :------------ :, ------------
.,
· . . .
· . .
, ,
Support package includes a library of Simulink blocks for
,,
20

-------- -:- ---------- : - - - - - - - - - �- - - - - - - - - - - �, - -----------


: , , ,
configuring and accessing board peripherals.
, ,
, ,

,, ,
1f) -

�'-'�'--"-,''-I
· ,
· ,

V. EMBEDDED SIMULATION WITH INTERNAL SINE


1 f)f)f) 2000 3(100 4000 5000
Frequenty (Hz) TRIANGLE WAVEFORM FOR PWM GENERATION

Fig. 8: THD Analysis of Line Voltage (fr = 50 Hz and F e =1 kHz) Figure 10 shows the embedded simulated model file
(Without Filter) of internal comparison of sine of 50 Hz and triangle wave

[3]
t
1s IEEE International Conference on Power Electronics. Intelligent Control and Energy Systems (ICPEICES-2016)

of 1000 Hz for PWM generation. In which three sine wave VI. WAIJUNG BLOCK SET FOR STM32F4 DISCOVERY K1T
is of 1200 phase displacement is compared with the
Waijung is a third party interface for STM32F4
triangular wave. The output of comparator is given to
blocks along with MATLAB. In order to complete
GPIO E pin 8 and with using NOT 10gic signal is given to
GPIO E pin 9; similarly for others pins. User have to waijung block installation process user have to install
select model configuration parameters. Set solver type as STM link utility driver. Select parameter setting for target
fixed type and solver as discrete mode (no continuous setup as per requirement.
state). Periodic sampIe time constraint as unconstrained
and tasking mode for periodic sampIe times as single
tasking. After selecting solver setting set target as STM
discovery board and select target loader complier file as Mljung:l •. 12.1
-,
erUIc; So as a resuIt of that when user build model file Compiler. GNU ARM
MCU: S1M32F.11IC
Auto Complle OOwn�d: ON SirwW.....'
PElO
sp..a (MH:): 100
1Y� (PfI'JOD): P!.IU! PuU
Chip En .. "1··c): .."05
through matlab simulation environment that embedded Full
AUlOrun.app:ON
: OFF

Exec:lnkln Protiler: Non.

model will directly build C code and load into the micro 8ase '" (..c): 0.01

controller of STM32F4 discovery kit. For each blocks


such as ADC; DAC; GPIO & Timers block parameter
setting as per requirements. Fig. 11 shows the
complimentary switching pulse pattern on GPIO E pin 8 &
pin 9. Fig. 12: Embedded Simulated Model for Three Phase SPWM Technique
in STM32F4 Discovery Kit in Waijung Software

As shown in Fig. 12 for testing of three phase voItage


source inverter the PWM signals are generated by
embedded simulation with the help of internal three
sinusoidal wave of 50 Hz with each of 1200 phase
displacement is compared with triangular wave of 1000
Hz. The comparison output will be given to the digital
output as per the pin selected by user. The signal
generated from digital output pins are applied to dead
band circuit; the dead band circuit is applied as an input to
the opto coupler circuit and opto coupler output which
provided gating signals for three phase voItage source
inverter. The output voItage waveform for different
modulation index with sine wave of amplitude 0.8V &
amplitude of 0.6V line to line waveforms are shown
respectively.

Fig. 10: Embedded Simulated Model for Three Phase SPWM Technique
in STM32F4 Discovery kit

Tek .JL • Stop M Pos: O.OOOs AUTOSET


+

JJlJLJL1LJLJU �
/

JU1Jlfl � �
CH2
i

Undo
Pk-Pk 3.04V Mean 2.47V
Autoset
Period �m.o)Js? Freq 1.008kHz?

CH1 2.00V CH2 2.00V M 1.00ms CH2 f 1.54V


27-Feb-15 13:53 854.204Hz
Fig. 13: Flow Chart Flowchart of C Code Generation with STM 32F4
Fig. 11: Gating Signal at GPIO Pin 8 and 9 Discovery Board

[4]
t
1s IEEE International Conference on Power Electronics. Intelligent Control and Energy Systems (ICPEICES-2016)

VII. HARDWARE SET UP ANDREsULTS VIII. CONCLUSION

The paper consist of simulation study of SPWM


based three phase voItage source inverter with R load.
Complete simulation of three phase voltage source
inverter is successfully done in MATLAB Simulink
environment. For hardware implementation; embedded
MATLAB simulation of SPWM technique for three phase
voItage source inverter is carried out and interfacing of
embedded MATLAB Simulink model with ARM cortex
processor is done through waijung third party interface
software. Three phase voItage source inverter are tested
using SPWM signal generated using STM32F4 discovery
kit and hardware result is compare and it is match with
Fig. 14: Hardware set up for Three Phase Inverter using STM32F4
simulation resuIts. Using MATLAB and ARM cortex one
Discovery Kit
can reduce control circuit complexity as weil as cost.
Tek ii Trig'd M Pos: -4,500JJS SAVE/REC
+
Action REFERENCES
lIIIIiBI!Iil
[I] R. Ramchand; K. Sivakumar; A. Das; C. Patel and K. Gopakumar;
Save To
-
"Improved switching frequency variation control of hysteresis
l' controlled voltage source inverter fed IM drives using current error
Setup space vector; " JET Power Electron; 2010; Vol 3; Iss. 2; pp. 219-231.
iI [2] Marian P. Kazmierkowski; Luigi Malesani; "Current Control
2. Techniques for Three-Phase Voltage-Source PWM Converters: A
Survey," IEEE Transactions on Industrial Electronics; vol 45; NO.
5; October 1998.
Save [3] Jose Rodriguez; Patricio Cortes; Luna Vattuone; "A comparative
study of predictive Current Control for Three-Phase Voltage Source
CH1 5,00V CH2 5,00V M 2.50.u' CH2 f 3,20V Inverters based on Swtiching frequency and current error.
15-Apr-1513:24 812.710H,
[4] Miss.Sangita R Nandurkar; Mrs.Mini rajeev; "Design and
Fig. 15: Dead Band between Two Switches of Same Lag oflnverter simulation of three phase inverter for grid connected photovoltic
systems; Proceedings of third Biennial national Conference;
NCNTE-2012; Feb 24 25.
[5] Muhammad H. Rashid; "Power Electronics Handbook," Academic
Press book.
[6] Bong-Hwan Kwon; Tae-Woo Kim and Jang-Hyoun Youm; "A
Novel SVMBased Hysteresis Current Controller," IEEE
Transactions on Power Electronics; Vol. 13; No. 2; March 1998.
[7] Dr. Rami A. Mahir; Dr. Amjad J.H. and Mr. Ayad Q. Hussien;
"Adapative Hysteresis Band Current Controller of a Three Phase
Induction Machine," Journal 0/ Enginnering and devlopement;
Vol. 14; No. 2; June 2010.

Fig. 16: Output Voltage Waveform with fr = 532.07 Hz

[5]

You might also like