microcontroller based spwm generator: a conventional

7
Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232. ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 226 Microcontroller Based SPWM Generator: A Conventional Design Perspective Through Graphical Oriented Approach AHMAD SHUKRI FAZIL RAHMAN 1 MUZAIDI OTHMAN@MARZUKI 2 ABDUL RAHIM ABDUL RAZAK 3 SYAFRUDDIN HASAN 4 BAHARUDDIN ISMAIL 5 SYED IDRIS SYED HASSAN 6 Pusat Pengajian Kejuruteraan Sistem Elektrik,d/a Kompleks Pusat Pengajian Kejuruteraan Mikroelektronik Universiti Malaysia Perlis (UniMAP),Kampus UniMAP Pauh Putra , 02600 Arau, Perlis, Malaysia. Abstract- In this paper, a comprehensive design strategy was proposed and implemented for the design of a single phase sinusoidal pulse width modulation (SPWM) waveform. Excel software was used to generate the timing sequence, and then fed to a microcontroller unit (PIC16F877A). Through Excel, complex programming effort could be avoided and the whole data arrays can be presented graphically. The effectiveness of the timing sequence was validated by using PROTEUS software. The simulation result shows that the SPWM waveform achieved the desired goals. Keywords-SPWM, PWM, sinusoidal, triangular, modulation, carrier, excel, Proteus, inverter. I. INTRODUCTION Commonly used in inverter system, the SPWM or sinusoidal pulse width modulation is a part of control algorithm which rises’ from the many variety of pulse width modulation (PWM) control technologies. Its application has widened that include motor control, induction heating, welding power source, electronic converters [1, 2], wind power generation [3], flexible transmission system (FACTS) controllers [4] and etc. As the name implies, SPWM is a comparison between a reference modulation (sinusoidal) waveform and a carrier (triangular) waveform which resulted in PWM (gate) signals for switching devices. The width of each respective PWM signal is proportional to the amplitude of a sine wave. Fig. 1 shows a typical SPWM generation theory and its resultant PWM signal. Fig. 1. SPWM comparison Signals (top) and PWM signal output (bottom) There are several ways of producing SPWM signal, the method mainly consists of modulation or with the introduction of dedicated microcontroller [1, 3, 5-8]; which is producing greater accuracy than analogue circuits [7]. Other known methods emphasized the use of matlab simulink [7-9] and Labview [10] at design stage to performed SPWM process. With the rapid advancement of SPWM technology [11-15], complex circuitry could be integrated in a single chip thus reducing the complexity and increasing its capability [16]. Even though common method of loading complex programming SPWM algorithm to a single chip may compromise the chip performance [6]. Thus, the entire process could be avoided by performing the required task (SPWM comparison signal) through excel, this may reduce the degree of programming complexity and the chip performance can be fully optimize. It is the intentions of this paper to investigate the graphical approach by using excel 2007 to generate the PWM signal. These signals will be compared (sinusoidal and triangular) and then the output from the comparison will be used to generate the PWM signal. Thus, the required signal will be generated without affecting the performance of the microcontroller. Proteus Isis version 7.7 was used to simulate the PWM signal through PIC16F877A microcontroller. II. SPWM DESIGN PERSPECTIVE Presently, SPWM can be generated through symmetric regular sampling method and asymmetric regular sampling method [5] as per fig 2 [5] and fig 3 [17]. The excel SPWM generation

Upload: others

Post on 14-May-2022

27 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Microcontroller Based SPWM Generator: A Conventional

Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND

RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232.

ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 226

Microcontroller Based SPWM Generator: AConventional Design Perspective Through

Graphical Oriented ApproachAHMAD SHUKRI FAZIL RAHMAN1 MUZAIDI OTHMAN@MARZUKI2 ABDUL RAHIM ABDUL RAZAK3

SYAFRUDDIN HASAN4 BAHARUDDIN ISMAIL5 SYED IDRIS SYED HASSAN6

Pusat Pengajian Kejuruteraan Sistem Elektrik,d/a Kompleks Pusat Pengajian Kejuruteraan MikroelektronikUniversiti Malaysia Perlis (UniMAP),Kampus UniMAP Pauh Putra ,

02600 Arau, Perlis, Malaysia.

Abstract- In this paper, a comprehensive design strategy was proposed and implemented for the design of a singlephase sinusoidal pulse width modulation (SPWM) waveform. Excel software was used to generate the timingsequence, and then fed to a microcontroller unit (PIC16F877A). Through Excel, complex programming effort couldbe avoided and the whole data arrays can be presented graphically. The effectiveness of the timing sequence wasvalidated by using PROTEUS software. The simulation result shows that the SPWM waveform achieved the desiredgoals.

Keywords-SPWM, PWM, sinusoidal, triangular, modulation, carrier, excel, Proteus, inverter.

I. INTRODUCTION

Commonly used in inverter system, the SPWM orsinusoidal pulse width modulation is a part ofcontrol algorithm which rises’ from the manyvariety of pulse width modulation (PWM) controltechnologies.

Its application has widened that include motorcontrol, induction heating, welding power source,electronic converters [1, 2], wind power generation[3], flexible transmission system (FACTS)controllers [4] and etc. As the name implies,SPWM is a comparison between a referencemodulation (sinusoidal) waveform and a carrier(triangular) waveform which resulted in PWM(gate) signals for switching devices. The width ofeach respective PWM signal is proportional to theamplitude of a sine wave. Fig. 1 shows a typicalSPWM generation theory and its resultant PWMsignal.

Fig. 1. SPWM comparison Signals (top) and PWMsignal output (bottom)

There are several ways of producing SPWM signal,the method mainly consists of modulation or withthe introduction of dedicated microcontroller [1, 3,5-8]; which is producing greater accuracy thananalogue circuits [7]. Other known methodsemphasized the use of matlab simulink [7-9] andLabview [10] at design stage to performed SPWMprocess. With the rapid advancement of SPWMtechnology [11-15], complex circuitry could beintegrated in a single chip thus reducing thecomplexity and increasing its capability [16]. Eventhough common method of loading complexprogramming SPWM algorithm to a single chipmay compromise the chip performance [6]. Thus,the entire process could be avoided by performingthe required task (SPWM comparison signal)through excel, this may reduce the degree ofprogramming complexity and the chip performancecan be fully optimize.

It is the intentions of this paper to investigate thegraphical approach by using excel 2007 to generatethe PWM signal. These signals will be compared(sinusoidal and triangular) and then the output fromthe comparison will be used to generate the PWMsignal. Thus, the required signal will be generatedwithout affecting the performance of themicrocontroller. Proteus Isis version 7.7 was usedto simulate the PWM signal through PIC16F877Amicrocontroller.

II. SPWM DESIGN PERSPECTIVE

Presently, SPWM can be generated throughsymmetric regular sampling method andasymmetric regular sampling method [5] as per fig2 [5] and fig 3 [17]. The excel SPWM generation

Page 2: Microcontroller Based SPWM Generator: A Conventional

Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND

RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232.

ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 227

principle was based on asymmetric methodwhereby discrete value of sinusoidal signal wassampled at nth steps (step size) per fc (carrierfrequency). At each step, the carrier andmodulation signal will be compared and theintersection between the modulation waveform,

Vm(t) and the carrier signal, Vc(t) [17] willproduced a PWM signal, Tpwm with its periodproportional to the amplitude of the modulationwaveform. Larger step size or high carrierfrequency [17] would produce higher degree of thePWM signal accuracy.

III. THE GRAPHICAL APPROACH- EXCELDESIGN

Three data columns were created to represent themodulation, carrier and the PWM waveform plusone column for timer or as a counter. Themodulation waveform was created first with 1001steps or map size by using function as shown inEquation (1), [18]. The frequency of the sinusoidalwaveform was set to 50Hz or 20ms with respectivestep size of 20s.

(1)

Where MAPSIZE is the total array size, DEGMAX isthe maximum angle value at 360, DEGMIN wouldbe the minimum angle value at 0, DEGRES is theresolution for each step size and KMAP is themapping scaler.The degree’s values were converted to radianthrough Equation (2):

(2)

Using built in excel’s sine function (Equation 3);the pre-calculated angle was transformed to sinewaveform.

Sinusoidal=5.4*SIN(number) (3)

Whereby, 5.4 would be the maximum amplitude ofthe waveform and (number) is the specific value inthe respective row array.

For the triangular or the carrier signal, thefrequency was set to fc = 1kHz or 1ms while theamplitude was set to 5.4V. Since excel did notprovided any function to generate triangularwaveform; a simple linear equation was improvised(Equation 4) as an alternative [19].

y=mx+c (4)

Fig. 2. Symmetric regular sampling principle

Fig. 3. Asymmetric regular sampling principle

Tpwm

A B

Vc(t)

Vm(t)

tVdc(t)

A B

Tpwm

Vc(t)Vm(t)

tVdc(t)

Page 3: Microcontroller Based SPWM Generator: A Conventional

Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND

RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232.

ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 228

With m is the line slope and c would be the point ofy-axis intersection. The carrier signal was createdwith 50 step size with carrier frequency, fc at 1kHzand each respective step is at 20Hz or 50ms. These

data’s were tabulated inside excel’s data array andthe final outcome is a graph contain both the carriersignal and the modulated signal shown in fig 4.

Fig. 4. SPWM comparison signals

The PWM signal was created by building Equation5:

PWM=IF(((ROWCARRIER)<(ROWSINUSOIDAL)),1,0)(5)

Equation 5 compares data, i.e. modulation andcarrier and if the condition is true the output will be‘1’. Fig. 5 shows the PWM results for carrierfrequency, fc = 1kHz and modulation frequency, fm= 50Hz.

Fig. 5. PWM output

The timing sequence for PWM period from fig 5was obtained by measuring the length of eachrespective PWM period in number of step sizesmultiply by 20s per step. There are 40 data’scalculated from SPWM comparison process whichcontain both positive and negative cycle. There are20 data’s of positive and negative cycle

respectively, that is equivalent to the carrier-to-modulation frequency ratio, fc/fm = 20, [17].

The PWM period is represented as in fig 6. Thegraph shows that the timing period is between960ms and 20ms. The graph also indicates averagetime occurs at the beginning, middle and end of themodulation signal.

Page 4: Microcontroller Based SPWM Generator: A Conventional

Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND

RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232.

ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 229

Fig. 6. PWM period graphical representation

IV. THE SIMULATION ASPECT

The data’s from excel transformation wasdownloaded to a microcontroller unit throughProteus simulation. The data was created based onsection 3, i.e. carrier frequency, fc = 1kHz andmodulation frequency, fm = 50Hz. The timingprogram was written by using delay code underMPLAB environment with HI-TECH C as thecompiler. The Proteus experimental set

up was based on fig 7, with PORD0 as the PWMoutput and the clock frequency was set to 20MHz.A virtual digital oscilloscope was connected toPORTD0 to record the PWM output. Thesimulation was conducted from a DELL laptopwith Intel® Core(TM)2 Duo CPU at 2.00GHz andMicrosoft Windows XP version 2002 SP2.

Fig. 7. Proteus SPWM experimental setup

V. EXPERIMENTAL RESULTS

Fig. 8 shows the simulation outcome for theproposed method. The result indicate a series ofpulse wave signal with fc/fm = 20 at 19.75ms which

is 1.25% lower than the calculated total modulationperiod. The measured amplitude is at 2.77V. Thedisplay outcome exhibit close resemblance with thetheoretical result.

Page 5: Microcontroller Based SPWM Generator: A Conventional

Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND

RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232.

ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 230

Fig. 8. Simulation result with fc=1kHz and fm=50Hz

Fig. 9 shows the simulation outcome for positivecycle. The result indicate a series of pulse wavesignal with fc/fm half from the actual is at 10 andthe half cycle is at 9.73ms which is 2.7% lower

than the calculated total modulation period. Themeasured amplitude is at 2.77V. The displaywaveform also contains similar resemblance withtheoretical result.

Fig. 9. Half positive cycle simulation result

Fig. 10 shows the simulation outcome for negativecycle. The result indicate a series of pulse wavesignal with fc/fm half from the actual is at 10 andthe half cycle is at 10.05ms which is 0.5% more

than the calculated total modulation period. Themeasured amplitude is at 2.77V. The displaywaveform also produce similar pattern withtheoretical result.

Page 6: Microcontroller Based SPWM Generator: A Conventional

Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND

RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232.

ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 231

Fig. 10. Half negative cycle simulation result

A graphical comparison was conducted betweensimulation values and calculated values. Graph infig 11 and 12 show the comparative presentationfor positive and negative cycles respectively. Graphin fig 11 shows the percentage error output for

positive cycle and it can be seen that significanterror occurs at the beginning of the modulationprocess and high error rate occurs during thebeginning of transition period from positive tonegative cycle.

Fig. 11. Percentage of error for positive cycle

Graph in fig 12 shows the percentage error outputfor negative cycle, it can be seen that significanterror occurs at the beginning of the modulation

process and maintain a stable errorless valuecirculating around peak modulation beforeplunging at the end.

Page 7: Microcontroller Based SPWM Generator: A Conventional

Ahmad Shukri Fazil Rahman* et al. / (IJITR) INTERNATIONAL JOURNAL OF INNOVATIVE TECHNOLOGY AND

RESEARCH Volume No. 1, Issue No. 3, April - May 2013, 226 – 232.

ISSN 2320 –5547 @ 2013 http://www.ijitr.com All rights Reserved. Page | 232

Fig. 12. Percentage of error for negative cycle

VI. CONCLUSION

The proposed method presented in this paper showsthat the graphical method could provide analternative solution toward SPWM generation.PWM signal generated by excel method wassimulated through Proteus environment. Resultsfrom calculation and simulation obtained validatethe process effectiveness with acceptable errorvalues.

VII. REFERENCES

[1] L. H. Walker, “10-MW GTO converter for batterypeaking service,” Industry Applications, IEEETransactions on, vol. 26, no. 1, pp. 63-72, 1990.

[2] M. H. Ohsato, G. Kimura, and M. Shioya, “Five-stepped PWM inverter used in photovoltaicsystems,” Industrial Electronics, IEEE Transactionson, vol. 38, no. 5, pp. 393-397, 1991.

[3] Y. Lu, P.-p. Jiao, and B. Zhang, "The principle andrealization of single-phase SPWM wave based on thecounter method." pp. 10-13.

[4] J. Segundo-Ramirez, and A. Medina, “Modeling ofFACTS Devices Based on SPWM VSCs,” PowerDelivery, IEEE Transactions on, vol. 24, no. 4, pp.1815-1823, 2009.

[5] Y. Zhou, Q. Yang, Q. Zhang et al., "The GeneratingMethod of SPWM with Double-Interruption Basedon DSP." pp. 617-620.

[6] B. K. Chaudhari, S. S. Wekhande, S. S. Dhamse etal., "A low cost high performance SPWM inverter."pp. 1033-1036 vol.2.

[7] G. Shuangxi, C. Shufu, and Z. Ying, "SinusoidalPulse Width Modulation Design Based DDS." pp. 1-4.

[8] Y. Wei, W. Kai, L. Zhengyu et al., "Digital SPWMinverter design and implementation." pp. 5847-5850.

[9] Z. Chongqing, and C. Jianli, "A new method ofsolving SPWM switch point based on naturalsampling." pp. 325-329.

[10] L. Fan, L. Kun, and L. Yang, "A design andimplementation of edge controller for SPWMwaves." pp. 764-767.

[11] B. Mwinyiwiwa, Z. Wolanski, and O. Boon-Teck,“Current equalization in SPWM FACTS controllersat lowest switching rates,” Power Electronics, IEEETransactions on, vol. 14, no. 5, pp. 900-905, 1999.

[12] Y. Zhaoyang, Z. Kun, L. Jianxia et al., “A NovelAbsolute Value Logic SPWM Control StrategyBased on De-Re-Coupling Idea for High FrequencyLink Matrix Rectifier,” Industrial Informatics, IEEETransactions on, vol. 9, no. 2, pp. 1188-1198, 2013.

[13] L. Gang, Z. Hao, C. Hui et al., "A novel gang SPWMcontrol method for six-phase induction motor." pp. 1-4.

[14] H. Patangia, and D. Gregory, "A Novel MultilevelStrategy in SPWM Design." pp. 515-520.

[15] G. Milan, M. Mohamadian, S. M. Dehghan et al., "Anovel SPWM strategy for single- to three-phasematrix converter." pp. 495-500.

[16] Y. Yang, Y. Gao, and L. Chen, "Design and Test ofNovel Programmable Digital Three Phases SPWMChip." pp. 1-3.

[17] B. Mwinyiwiwa, Z. Wolanski, and O. Boon-Teck,“Microprocessor-implemented SPWM formulticonverters with phase-shifted triangle carriers,”Industry Applications, IEEE Transactions on, vol.34, no. 3, pp. 487-494, 1998.

[18] J. Yan, M. Ryan, and J. Power, Using fuzzy logic:towards intelligent systems: Prentice Hall, 1994.

[19] "Linear equation," http://en.wikipedia.org/wiki/Linear_equation.