Microcontroller Based Sinusoidal PWM Inverter for Photovoltaic Application S. M. Mohaiminul Islam, Gazi Mohammad Sharif School of Engineering and Computer Science, Independent University, Bangladesh. e-mail: [email protected]
Abstract: This paper represents the microcontroller based sinusoidal PWM inverter for photovoltaic application. The advantage of this inverter is the use of a low cost microcontroller that has built in PWM modules. Microcontroller PIC 18F4431 is able to store the required commands to generate the necessary PWM waveforms. The required dead time has been implemented low cost. The application of this inverter is to be either for stand-alone or for grid connected from a direct supply of photovoltaic (PV) Cells. In this paper how SPWM signal is generated by microcontroller and what are the features of described microcontroller is reviewed. Subsequently hardware configuration of the microcontroller, algorithm, flowchart, gate driver and isolation system are discussed. Finally the experimental results are shown in this paper.
1. Introduction Sinusoidal pulse width modulation (SPWM) is widely used in power electronics to digitize the power so that a sequence of voltage pulses can be generated by the on and off of the power switches. The pulse width modulation inverter has been the main choice in power electronic for decades, because of its circuit simplicity and rugged control scheme. SPWM switching technique is commonly used in industrial applications or solar electric vehicle applications . SPWM techniques are characterized by constant amplitude pulses with different duty cycle for each period. The width of this pulses are modulated to obtain inverter output voltage control and to reduce its harmonic content. Sinusoidal pulse width modulation is the mostly used method in motor control and inverter application [1, 2, 4]. To generate this signal, triangular wave is used as a carrier signal is compared with sinusoidal wave, whose frequency is the desired frequency. The proposed alternative approach is to replace the conventional method with the use of microcontroller. The use of PIC18F4431 microcontroller brings the flexibility to change the real-time control algorithms without further changes in hardware. It is also low cost and has a small size of control circuit for the single phase full bridge inverter. The microcontroller has the built in dead time control circuit .
2. System overview The basic schematic diagram of the photovoltaic inverter is shown in Fig. 1. It consists of many blocks, emphasis is
given only on Sinusoidal PWM generation.
Fig. 1 Block diagram of the inverter 
The single phase full bridge inverter circuit is shown in Fig. 2.
Fig. 2 Single phase full bridge inverter circuit 
The heart of the system is a PIC Microcontroller. This microcontroller is specially developed for the generation of Sinusoidal PWM (SPWM) with dead time controller. The dead time controller circuit is useful to make the design simpler, more reliable and the most important thing is to reduce the cost and components. The Microcontroller: PIC18F4431generates four Sinusoidal PWM signals. Fig. 3 shows the pin diagram of PIC18F4431 connected with external oscillator. RB0 to RB3 pins are output for Sinusoidal PWM signals. RB0 and RB2 pins are independent which go to gate driver ICs. The name of the IC is IR2110. RB1 and RB3 pins are complementary which go to another same gate driver IC. The output voltage of the gate driver IC is 10V - 20V. The output
voltage may be used for gate of the IGBT or MOSFET. For operating the microcontroller we used 20MHz oscillator and two 15pF capacitor. Also for operate Gate drive circuit IC needs some capacitors.
Fig. 3 PIC18F4431 for the generation of the SPWM single phase inverter
3. Hardware Configuration Fig. 4 presents Power Control PWM Modules Block Diagram.
register and comparator. PDC (PWM duty cycle) register is defined by PDCx (PDCxL and PDCxH). There are a total of 4 PWM Duty Cycle registers for 4 pairs of PWM channels but only 2 PWM Duty Cycle registers are used for this project. The Duty Cycle registers have 14-bit resolution by combining 6 LSbs of PDCxH with the 8 bits of PDCxL. PDCx is a double-buffered register used to set the counting period for the PWM time base. The comparator compares with PDC register and PTMR register. PTMER register has 12-bit and PDC has 14-bit register. So, extra 2-bits are using for Q-Clocks. Then output will go in Dead Time generator and override Logic. Dead Time generator register generates the specific time delay for the switching components. And Override control register (OVDCOND) can override the output but that was not needed in this project. Special Event register (SEVTCMP) is used for any interrupt but in this work was not use. Only dead time generator module is needed. Then the output will come in PWM0, PWM1, PWM2, PWM3, PWM4, PWM5, PWM6, PWM7 but PWM0, PWM1, PWM2, PWM3 are utilized. PWM0, PWM2 are in independent mode and PWM1, PWM3 are in complementary mode for single phase that means the pin numbers are from 33 to 36 (RB0 to RB3) of microcontroller.
Fig. 4 Power Control PWM Module Block Diagram 
Here PTMR Register is PWM Time base register. It can be controlled by PTCON0 (PWM Timer Control register 0) and PTCON1(PWM Timer Control Register 1). And it is 12 bit timer. The highest of the PTMR Register is implemented by using of PTPER register. PTPER register has 12-bit register by combining 4 LSBs of PTPERH and 8-bits of PTPERL. PTMR register and PTPER register are compared by comparator and this output signal will go in PWM Generator 0, PWM Generator 1, PWM Generator 2 and PWM Generator 3. But PWM Generator 0 and PWM Generator1 are used here. PWM Generator has PDC
Fig. 5 Flow chart for Single phase Sinusoidal PWM Signal 
Fig. 5 shows the flow chart of single phase sinusoidal PWM signal. In this flow chart “initialize variables” means initialize the user defined memory cell, “initialize port” initializes the ports in software by which the ports work as output ports. After that “Initialize PCPWM” initializes the modules which are used to generate PWM.
Then “set all interrupts” initializes all interrupts which are associated with all kinds of desired interrupts. Then “Initialize Sine Look up Table” stores the sampling value of sine wave. Those sampling value will go in PDC register. And the PTMR register will generate the Triangular wave. Then the signal becomes Sinusoidal PWM signal with dead time. The microcontroller checks whether the generation is completed or not, if yes, take another sampling of the sine wave table, if not, it waits until completion.
result. Fig. 9 shows PWM signal with dead time in single microcontroller. In Fig. 10 shows two signals of PWM in different phase.
5. Gate Driver Basically, there are two fundamentals categories for gate drivers. These are high side and low side drivers. High side means the source of MOSFET of the power element can float between ground and high voltage power rail. Low side means the source of the MOSFET is always connected to ground. The Gate driver circuit is shown in fig. 6. For the gate drivers, to operate as a bootstrap circuit, the Vbs voltage is used to provide the supply to the
Fig. 7 Sinusoidal PWM Signals are shown in Digital Oscilloscope
high side driver circuitry of the gate driver. Vbs is the voltage difference between the Vb and VS pins on the gate driver IC.
Fig. 6 Gate driver circuit
This voltage supply is needed to be in the range of 10V to 20V to ensure that the gate of the MOSFET gets sufficient power so that the gate driver will be fully enhanced. The Vbs supply is the floating supply that sits
Fig. 8 The output is PWM0 - PWM2
on the top of the VS Voltage. There are various methods to generate Vbs supply [1, 6].
6. Isolation Circuit The isolation circuit is used to isolate signals for protection and safety between a safe and a potentially circuit between digital signals needs to designed correctly for proper protection. The maximum applied voltage for single phase inverter is 380V, since the microcontroller operates at 5V level it is desired to isolate the control board from higher voltage of the inverter circuit. This can be done by using transformer.
7. Experimental Results Fig. 7 shows our experimental board where we have tested. Fig. 8 shows PWM0 – PWM2 is output from accordingly port RB0 - RB2 microcontroller. And PWM1 and PWM3 is in complementary mode. Ez Digital Oscilloscope DS-1100 100MHz, two channel digital storage oscilloscope was used to measure the experimental
Fig. 9 PWM signal with dead time
Fig. 10 Two signals of PWM in different phase
8. Conclusions In this work, a single phase PWM signal has been implemented in PIC18F4431 microcontroller and gate driver’s IC IR2110 was used. Several outstanding features of the developed Sinusoidal PWM signal are highlighted as follows: By generating the Sinusoidal single phase PWM signal have less harmonic; both PWM signal and Dead time control circuits can be implemented in a single board microcontroller, which makes the system reliable, compact and low cost; IR2110 IC can take two signals; one is used for independent signal and another is used for inverting signal. That means IC can also reduce the cost, compact and system reliable.
References  B. Ismail, S. T. (November 28-29, 2006). Development of a Single Phase SPWM Microcontroller-Based Inverter. First International Power and Energy Conference PEC (p. 437). Putrajaya, Malaysia: IEEE.  MICROCHIP. (2003). PIC18F2331/2431/4331/4431 Data Sheet. Michrochip Techonology Inc.  Mohaiminul Islam, S. M. (2009). Generation of 3 Phase Sinusoidal PWM Signal with Variable Frequency By using Low Cost Microcontroller. Senior Project Report Published by Independent University, Bangladesh.  (n.d.). Retrieved from http://www.tech-faq.com/pulse-widthmodulation.shtml  Salim, K. M. (June, 1999). Development of Power Conditioner Unit (PCU) For Fuel Cell. Master's Thesis.  Rectifier, I. IR2110(-1-2)(S)PbF/IR2113(-1-2)(S)PbF HIGH AND LOW SIDE DRIVER Data Sheet. Data Sheet No. PD60147 rev.U.