Development of Microcontroller based Enhanced Modified Sinewave Inverter

DOI : 10.17577/IJERTV5IS030102

Download Full-Text PDF Cite this Publication

Text Only Version

Development of Microcontroller based Enhanced Modified Sinewave Inverter

Ogunseye Abiodun A.

Department of Electrical/Electronics & Computer Engineering

Bells University of Technology Sango-Otta, Nigeria

Olusanya Olamide O

Department of Electrical/Electronics & Computer Engineering

Bells University of Technology Sango-Otta, Nigeria

Olusesi Ayobami T.

Department of Electrical/Electronics & Computer Engineering

Bells University of Technology Sango-Otta, Nigeria

AbstractA figure of merit of an inverter circuit is its total harmonic distortion (THD). Square waves and modified squarewave inverters have a relatively high distortion figures compared to true sinewave inverter, but they have simpler hardware structures, making them easier and cheaper to build. In this work, an inverter system whose output voltage has a lower distortion figure compared to that of squarewave or modified squarewave inverters was developed. The developed inverter circuit, whose hardware was based on a PIC 16F877A microcontroller, has its firmware developed with MicroC software. The constructed circuit generated a four level waveform that has a repetitive frequency of 50Hz when powered from a 12 Volts battery.

KeywordsMicrocontroller, Modified Sinewave, Inverter,

Total Harmonic Distortion


    Power inverters are crucial part of d.c to a.c power conversion schemes. They convert the available d.c energy stored in batteries (or generated from renewable energy sources, such as wind and solar power) into the desired a.c voltage. Ideal power inverters, which do not exist, produce a purely sinusoidal output voltage at 100% efficiency, i.e they have a total harmonic distortion of 0% and 100% power conversion efficiency. Thus, a benchmark for comparing real inverter systems is their total harmonic distortion figure and their power conversion efficiency relative to the ideal inverter.

    To maximise power conversion efficiencies, real inverters approximate a sinusoid with waveforms that have square edges, which are more efficiently produced by switching operation. Such waveforms include squarewaves, modified squarewave which are variants of the squarewave, and true sine waveforms which are synthesized using pulse width modulation (pwm) techniques. Unfortunately, these approximations to a pure sinewave inverter yield inverter systems that have a non-negligible harmonic content i.e a non- zero THD figure.

    True sinewave inverters produce low distortion sinewaves with pulse width modulation techniques which involve switching at a frequency that is a multiple of the desired output frequency to achieve low distortion. This leads to a relatively high switching loss compared to squarewave and modified squarewave. Its more of a compromise: sinusoidal pulse width modulated inverters have low waveform distortion but lower efficiciency while squarewave and modified sinewave inverters have high efficiency and high output distortion figures.

    This work attempts to modify the waveforms produced by the modified sinewave inverter for lower distortion figures. The traditional two level waveform produced by modified squarewave inverters was modified by stacking one more levels in each direction, thus forming a 4 level modified square waveform. The resulting waveform has a lower minimum distortion figure in comparison to squarewave and modified square waveforms. A PIC16F877A microcontroller- based circuit was designed and developed to generate the resulting waveform. The developed circuit, powered from a 12Volts battery, produces a four level output waveform with a frequency of 50Hz.


    The earliest inverters developed produces squarewave outputs because squarewaves are easily generated in hardware. A simple relaxation oscillator, a step-up transformer and a number of transistors are all that are required to build a simple inverter system [1-3]. Though easily generated, square waves have a high level of odd order harmonics that interfere with the operation of loads such as electric motors [4, 5]. Also, to maintain an equivalent r.m.s voltage with a sinewave, squarewave forms must have a peak value that is equal to the

    r.m.s value of the sinwave. This means that a squarewave inverter will have an output voltage whose magnitude is reduced by a factor of 1.4142 in comparison to the output voltage produced by a pure sinewave inverter delivering the same amount of power. This can potentially affect the operation of loads such as microwave ovens that are sensitive to the peak value of the inverter output voltage [11].

    A variant of squarewaves that is also easily generated is the modified square waveform. This waveform has the same peak value as an equivalent sinewave with the same r.m.s voltage, but with reduced duty cycle. Modified squarewaves potentially have a reduced harmonic content compared to squarewave inverters, but their THD is still high for low distortion applications [5, 9].

    Pure sinewave inverters produce waveforms that have low distortion figures using pulse width modulation techniques. To achieve low waveform distortion and small-sized output filter components, the sampling frequency must be high compared to the frequency of the output waveform. However, high sampling frequency causes substantial switching losses in the output stage switching devices, reducing efficiency. Pure sinewave inverters are much more complex to design and manufacture, as a result, they are more expensive than square wave or modified square wave inverters [6,7].

    Hann (2006) proposed an inverter system whose waveform has about 6% total harmonic distortion and switches at just three times the fundamental frequency[5]. The relatively low switching frequency means that switching losses of the output devices will be reduced when compared to a true sinewave inverter of equivalent power ratings. The proposed waveform is shown in Fig. 1.

    There are a number of ways of implementing an inverter that can generate this waveform. One of such ways is to generate d.c voltages whose amplitudes corresponds to the values of A and B (fig. 1) from a battery, and then use electronic switches to connect the load to the generated d.c sources at the appropriate time interval [8]. This approach produces a compact design because no line frequency magnetic components are required. Another approach which is used by [4] and employed in this work, uses a 50Hz step-up transformer to generate the required output waveform.


    1. Waveform Analysis

      The waveform in Fig. 1. has both odd half wave and quarter wave symmetry, therefore it contains only odd sinusoidal harmonic waves. If we represent the signal by x(t), and express it as a fourier sum, we have

      And, for this waveform, it is given as

      From (5), it is obvious that the THD figure depends on the values of a and ß; there should be some values of a and ß that yields the lowest THD figure.

      A simple MATLAB program, outlined in Fig. 2, was used to find the values of a and ß that result in the lowest distortion figure; the program does this up to the 2001th harmonic. The lowest THD figure of 16.38% occurs when a= 0.27p and ß = 0.43p. In comparison, a pure squarewave signal and a modified

      Fig. 1: Enhanced modified square waveform [5]

      squarewave signal have the lowest THD figure of 24.15% and 28.91% respectively for the same number of harmonic content.

      If we limit the analysis to the 9th harmonic, as done by Hann [5], the distortion figures are lower and the proposed waveform has a total distortion f only 6.51% when = 0.42 and = 0.248. With these values, the spectrum of the proposed waveform is shown in Fig. 3.

      The developed inverter circuit was designed to generate this waveform with = 0.248 and = 0.42.

      () = (2+1 )(2 + 1)


      Where bn, the fourier coefficient terms is




      (2+1) = 4

      [ (2 + 1) +

      ( )(2 + 1)] (2)

      If we let B = 2A, then (2) reduces to

      (2+1) = 4 [[(2 + 1) +] (3)

      (2+1) (2 + 1)

      The total harmonic distortion (THD) is defined as

      Fig. 2: MATLAB program to find the parameters for

      minimum THD

    2. Circuit

      Fig. 3: The frequency spectrum of the proposed waveform up to the ninth harmonic.

      ratios. The inverter generates a four level waveform by using

      The developed circuit is based on a modification of the output stage of a standard push-pull inverter. The circuit, shown in Fig. 4, consists of a PIC16F877A microcontroller, four sets of driver circuit and four sets of switching mosfets that drive a multi-tap output transformer which performs voltage step-up function.

      The output stage is based on a modification of the standard push-pull output stage. The step-up transformer is a simple multi-tap transformer that has two voltage transformation

      the output switches to drive the taps of the transformer at the appropriate times. The overall hardware design is similar to that discussed in [10].

      Fig. 4: The developed inverter circuit

      The amplitude of the output pulses produced by the microcontroller is increased from 5 volts to 12 volts by the driver stage circuits. This is necessary to reduce power losses in the output mosfets. The driver circuit, consisting of a number of transistors, resistors and diodes, uses overall positive feedback (hysteresis) to achieve fast switching times. The circuit diagram of one of the driver circuit is shown in Fig. 5

      The microcontroller is programmed to generate sequences of pulses that are required to control the switching of the output transistors. To achieve this, an internal timer peripheral (timer0) was configured to generate interrupts periodically. A software finite state machine, running in the tmr0 interrupt service routine, generates the required pulses and switches the port pins at the appropriate time.

      A pushbutton switch is used to control the operation of the inverter. The inverter switches on or off when the pushbutton switch is pressed.

      The circuit was modelled using proteus software and its firmware was developed with MicroC software which is published by Mikroelectronika. A prototype of the circuit was constructed using Veroboard. The hex file, generated by the MicroC software was transferred to the memory of the microcontroller with a pickit 2 programmer.

    3. Software

    The sequence of pulses generated by the microcontroller is controlled by a time-triggered finite state machine (fsm). This fsm runs every time a timer0 interrupt occurs and has eight distinct states, with each state corresponding to a subdivision of the period of the output waveform. In each state, the finite state machine waits for the timer (timer0) to reach a predetermined count before changing the states of the output pins. In this way, the output pulses are generated as the fsm cycles through all its states.Another finite state machine which runs every 5ms performs the debouncing of the input pushbutton switch with 20 ms debounce period.

    Fig. 5: The Driver circuit


    The four output pulse waveforms generated by the proteus model of the inverter circuit is shown in Fig. 6. The waveform traces labelled A, B, C and D, after amplification and buffering, are applied to the gates of mosfets Q1, Q2, Q4 and Q3 in Fig. 4 respectively.

    Fig. 7 shows a sample of the unfiltered output waveform produced by this inverter. The unfiltered waveform looks like it has more than four level but that is not true; the extra level is due to the fact that the inverter does not clamp its output to zero volts when the output waveform is meant to be at zero volts. The collaping magnetic energy stored in the core of the transformer induces voltage at the output of the inverter, creating the apparent additional level.

    Fig. 6: Mosfet drive waveforms generated by the


    Fig. 8 shows the output waveform when a 2uF filtering capacitor was connected to the output of the inverter. Some of the rough edges in the unfiltered waveform were removed by this simple filtering; a higher order filter will result in an output waveform that is better approximation to a sinusoid.

    Fig. 9 shows the constructed circuit, with the PIC16F877A microcontroller clearly visible.

    Fig. 7: The unfiltered output waveform of the Inverter


    Fig. 8: the output waveform after filtering with a 2uF capacitor.


Fig. 9: The constructed circuit.

Efficiency and Energy Related Materials (ENEFM2014) . Springer International Publishing., 2015. 357-367.

[5] Hann, James H. Modified Sine-Wave Inverter Enhanced. Power

An inverter circuit that generates a four level waveform was developed and tested. The circuit, built around a PIC 16F877A microcontroller, was designed with MicroC and Proteus software and then constructed on a general pupose printed circuit board. The constructed was tested by using it to power a range of loads, including a 60 W filament lamp.

The circuit can be further refined by adding two more levels to the generated waveform to achieve very low total harmonic distortion. This will require a redesign of the output stage of the inverter circuit and a little change in the firmware of the microcontroller.


  1. Gottlieb, Irving. Power Supplies: Switching Regulators Inverters and Converters. first. New Delhi: BPB Publications, 1985.

  2. Funso, Alade Olusope Micheal and Akande Stephen. On Various Oscillators and Power Amplifier Design Methods Employed for the Development of Power Inverters. (IJRRAS) 5, no. 3 (2010).

  3. Gana, Joshua Aboluwarin and Paul. Design and Development of Inverter with AVR Using Switch mode Square Wave Switching Scheme. AUJT, 2010, 249-257.

  4. Abdelati, M., & Frey, G. A Method for Building a Simple and Applicable Power Inverter. In 2nd International Congress on Energy

Electronics Technology, 2006.

  1. Meraj Hassan, Junaid Maqsood, Mirza Qutab Baig, Syed Murtaza Ali Shah Bukhari and Salman Ahmed. Design and Implementation of Single Phase Pure Sine Wave Inverter Using Multivibrator IC. 17th UKSIMM-AMSS International Conference on Modelling and Simulation. IEEE, 2015. 451-455.

  2. Mohamed A Ghalib, Yasser S Abdallah and R. M. Mostafa. Design and Implementation of a Pure Sine Wave Single Phase Inverter for Photovoltaic Applications.

  3. Nishit Kapadia, Amit Patel and Dinesh Kapadia. Simulation and Design of low Cost Single Phase Solar Inverter. International Journal of Emerging Technology and Advanced Engineering 2, no. 1 (2012): 158-163.

  4. Olusola A Komolafe and Olufemi I. Gapped Alternate Phased Opposite Disposition Pulse Width Modulation Control for Multilevel Inverters. (ARPN Journal of Engineering and Applied Sciences) 9, no. 4 (April 2014).

  5. Abiodun Alani Ogunseye and Ogunseye Titus. Development of a Microcontroller Based 12/24 Volts Push Pull Inverter System. IOSR Journal of Electrical and Electronics Engineering, Nov-Dec 2015: 16-21.

  6. Ample Power Company. "Microwave Ovens and Quasi-Sine Wave


Leave a Reply