Simulation and Design of A Single Phase Inverter with Digital PWM Issued by An Arduino Board

The current paper has as major purpose the design of a single-phase inverter for educational purposes. This project has the aim to use Arduino board to ease the Pulse Width Modulation (PWM) implementation on a single-phase inverter, substituting analogical circuitry. To achieve those aims, a first complete theoretical analysis will be made, including the study of the different conventional PWM techniques. The complete design is modeled in Proteus software and its output is verified practically. Keywords— Single-phase inverter, PWM, Arduino; Proteus simulations

INTRODUCTION Inverters are circuits that transfer power from a DC source to an AC load. Inverters are used in applications such as adjustable-speed ac motor drives, uninterruptible power supplies (UPS), active filters, flexible ac transmission systems (FACTS), running ac appliances from an automobile battery...
Inverters can be classified into many types based on output, source, type of load...
Complete classification of inverter circuits is as follows: There are several control techniques for inverters. The most common one is the Pulse Width Modulation (PWM) technique. The main aim of these modulation techniques is to enhance the output of the inverters by obtaining an output voltage or current very close to sine waveform. PWM technique provides a way to push harmonics to higher frequencies, making filtering easier. There are many types of modulation techniques, the most familiar are: - The main objective of this project is the design, simulation and testing of a single-phase inverter for educational purposes. In order to achieve this, the first step is a theoretical reminder about inverters. The most important task in this project is the implementation of the PWM modulation digitally. For this purpose, the way to obtain the PWM signal from the Arduino board is explained. After that, Proteus simulations are carried out in order to have a better idea about the results expected. Once the theoretical simulation is made, the circuit should be built into a protoboard for real testing.
II. THEORETICAL BACKGROUND Inverters are circuits that convert DC to AC. The fullbridge converter of Fig.1 is the basic structure of an inverter. The switches S1, S2, S3, S4 in the full-bridge inverter must be capable of carrying both positive and negative currents. Therefore, a feedback diode is placed in parallel (antiparallel) with each switch.

A. The square-wave inverter
The simplest switching scheme for the full-bridge converter produces a square wave output voltage. The switches connect the load to VDC for first half cycle 0 < t < T/2 when S1 and S3 are closed, or to -VDC for second half cycle T/2 < t < T when S2 and S4 are closed. The periodic switching of the load voltage between VDC and -VDC produces a square wave voltage across the load. The current waveform in the load depends on the load components. For a resistive load, the current has the same shape of the output voltage. An inductive load will have a current closer to a sinusoidal form than the voltage because of the filtering property of the inductance.
In order to have the exact expression of current for a series RL load, the following two equations must be solved: For ∈ [0, 2 ] : S1 and S3 are closed : For ∈ [ 2 , ] : S2 and S4 are closed : (2) It can be shown that: For ∈ [0, 2 ]: For ∈ [ 2 , ]: Since the objective of the inverter is to supply a load with an AC current, it is useful to describe the quality of the ac output voltage and current: a Fourier analysis is necessary. The output voltage u(t) and load current i(t) must be expressed in terms of a Fourier series.
In the case of the square wave u(t), the Fourier series contains the odd harmonics and can be represented as: For the load current i(t), the Fourier series is as follows: The amplitude of each current term is given by: As the harmonic number n increases, the amplitude of the Fourier voltage component decreases and the magnitude of the corresponding impedance increases, both resulting in small currents for higher-order harmonics as shown in Fig The quality of a non-sinusoidal wave can be expressed in terms of total harmonic distortion (THD). The closer the waveform to sinusoidal, the smaller is the THD.
For square wave inverter with (VDC=12V, R=25, L=100mH, f=400Hz), the THD output voltage and the THD load current are respectively: = 48.3% (8) = 12.2% (9) In conclusion, for square wave inverter, the first harmonics are very close to the fundamental which makes filtering difficult. On another hand, the THD level proves that the quality of the output waveforms had to be improved.

B. PWM inverter
Pulse-width modulation (PWM) provides a way to decrease the total harmonic distortion of load current; the harmonics will be at much higher frequencies than for a square wave, making filtering easier.
There are many types of modulation techniques. In this project, two types of PWM will be used: -Sinusoidal Pulse Width Modulation (SPWM) -Specific Harmonic Elimination (SHE)

1) Sinusoidal Pulse Width Modulation (SPWM)
In the sinusoidal pulse width modulation (SPWM), the gate control signals are generated by comparing a sinusoidal reference voltage signal (vsine) with a high-frequency triangular carrier voltage signal (vtri). The intersection points of the sinusoidal reference voltage signal and the triangular carrier voltage signal determine the turn on and turn off instants of the switching devices.
When > : 1 and 3 are closed then: = When < : 2 and 4 are closed then: = − This version of PWM is bipolar because the output alternates between + and − . Fig.4 illustrates the principle of sinusoidal bipolar pulsewidth modulation.
Simulation with PSIM for the following values: gives the following waveforms for output voltage and current: The output voltage and current spectrum are given in Fig.6: Fig.6: output voltage and current spectrum for SPWM Fig.6 shows that thanks to SPWM technique, the first considerable harmonic is at 350Hz which corresponds to × . On another hand, the THD load current is: = 28.3% (12) The unfiltered PWM output current has a relatively high THD, but the harmonics are at much higher frequencies than for a square wave, making filtering easier.

2) Specific Harmonic Elimination (SHE)
The specific harmonic elimination modulation consists in determining a set of switching angles in order to eliminate certain harmonics in the PWM inverter output.
The output voltage for bipolar PWM has the following form: (13) With four angles ( 1 , 2 , 3 and 4 ), four harmonics can be eliminated. Logically, harmonics 3, 5, 7 and 9 must be eliminated. To find the adequate angles the following system of equations must be solved: The code gives the following result: The load is an R-L series circuit with = 25Ω and = 100 .

B. Arduino board:
For this project an Arduino UNO will be selected. Widely employed in basic programming projects, it contains a 16MHz clock, 14 digital input/output pins, 6 analog inputs and 6 PWM outputs. It is based on Atmega 328P microcontroller and can be powered via USB connection or by an external power supply. -Wide range of tutorials and information available. Thus, it seems to be the perfect choice for educational purposes, allowing students to take their first steps in programming.
The Arduino UNO board is used to produce the PWM pulse. This PWM pulse oscillates between 0 and 5 Volts. In order to have the appropriate voltage level on MOSFET gates, the pulse obtained from Arduino board must be given to the driver circuit.

C. Driver circuit module:
Generally micro controllers generate PWM signals of very low range which is not sufficient for the switches to turn on so a gate driver circuit is designed for that purpose. In this paper, IR2110 is used for this purpose.
As explained on its datasheet, it is a high voltage, high speed MOSFET and IGBT driver with independent high and low side output channels. The list of components used is given in the following

A. Square wave inverter:
PIN7 of the Arduino board deliver a pulse that oscillates between 0 and 5V. The following code must be written with the Arduino Software (IDE). Simulation results for the square-wave inverter are given in Fig.15. The frequency is = 400 , the load values are = 25Ω and = 100 . The red and yellow waveforms represent respectively the load current and the output voltage.

B. SPWM inverter:
As explained previously, for the SPWM inverter, the turn on and turn off instants of the switching devices are determined from the intersection points of a sinusoidal reference voltage signal and a triangular carrier voltage signal. These intersection points are determined by MATLAB. As a first step, a MATLAB code (Fig.16, Fig.17  Simulation results for SPWM inverter are given in Fig.19. The red and yellow waveforms represent respectively the load current and the output voltage. Fig.20 shows output voltage (green) and current (red) spectrum.  Fig.20 shows that the first considerable harmonic is at 350Hz which corresponds to × .

C. Specific Harmonic Elimination modulation (SHE):
As explained previously, the specific harmonic elimination modulation consists in determining a set of switching angles in order to eliminate certain harmonics in the PWM inverter output. These angles are obtained from Matlab by resolving the system (14). The switching angles (shown in Fig.9) are injected in the arduino code in order to generate the SHE modulation signal. The following code must be written with the Arduino Software (IDE). The red and yellow waveforms represent respectively the load current and the output voltage. Fig.23 shows output voltage (green) and current (red) spectrum (FFT).  Fig.26 and Fig.27 show practical results respectively for square wave inverter, SPWM inverter and specific Harmonic Elimination modulation inverter. Yellow waveform represents the load current. The blue waveform represents the output voltage.  Practical measurements confirm Proteus simulation for all the studied cases. VI. CONCLUSION In this project, a single phase inverter is designed. For this inverter, the pulses needed for switching semiconductor devices are generated using the Arduino Uno board and the IR2110 driver.
The most important task in this project is the implementation of the PWM modulation on the Arduino board. Two types of PWM modulation are studied: sinusoidal Pulse Width Modulation (SPWM) and Specific Harmonic Elimination (SHE).
Before performing experimental measurements, simulations with the Proteus software are carried out for the square wave and the PWM inverters (SPWM+SHE). The simulations results obtained are in accordance with measurements.
Through this project, the most important conclusion is that Arduino offers a simple and efficient programming environment suitable for PWM converters.