Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SPWM Inverter using IGBT's and PIC18F4520

Status
Not open for further replies.

dgs117

Member level 1
Joined
Sep 12, 2007
Messages
32
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Lithuania
Activity points
1,526
Hello,

I am building an inverter for 220V. I have constructed the output stage with IGBT transistors (IRG4PH50KDPbF), drivers for each transistor (HCPL-3120) each having their own separate power supply. At the output is LC filter which filters the undesired harmonics.

The problem is generating a sinusoidal PWM signal from PIC18F4520 which lies in EasyPIC4 development board. I decided to go with the instructions in PIC18F4520 datasheet for generating bidirectional Full-bridge output PWM signal (https://ww1.microchip.com/downloads/en/DeviceDoc/39631E.pdf, pages 153-155). I have a problem during the direction change of PWM signal. As shown in Figure 16-8 in datasheet there is a time interval between the direction really changes. I can observe this phenomenon in the oscilloscope as the signal swithes at zero between the half periods of the sinusoidal signal.

So I ask you how could I avoid this zero switching distortion? Is there a solution?

The PWM carrier frequency is 7.8 kHz, and the look-up table of sinusoidal signal consists of 32 entries. The CCPR1L register is updated during during interrupt which occurs at a freq for 50 Hz output.

The schematic and waveforms are attached below. The osc used is Tektronix TPS2024 with current clamp A622. The problem is indicated in red circles in the waveforms.

The ISR of the PIC firmware is as follows:
Code:
// Half period 32 points sinewave lookup table
const unsigned short int sinewave[32]=
{
0,25,49,73,96,118,137,159,177,193,208,220,231,239,
245,249,250,249,245,239,231,220,208,193,177,159,137,
118,96,73,49,25
};

unsigned short int i=0;

void interrupt()
{
     if(TMR0IF_bit)               // TIMER0 interrupt
     {
      TMR0IF_bit   = 0;           // clear TMR0 overflow interrupt flag bit

      if(i==32)
       {
        i=0;
        P1M1_bit = ~P1M1_bit;   // Full-bridge change output direction
       }                      

      CCPR1L = sinewave[i];     // put a new value for PWM duty cycle
      TMR0L  = 109;             // interrupt for 50Hz output

      i++;                      // increment table counter

     }
}
 

Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

Doesn't anyone have any ideas at all?
 

PIC18F4520 SPWM - Full-Bridge Output Direction Change

Hi,
Maybe you could try playing with the values of your inductor and capacitor.
I had made one with mikroBASIC, 32 points/half, 16kHz carrier frequency, 50Hz frequency, but it used a different method than yours. I can't remember the L-C values I used, though.
 
Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

In my oinion, the observed behaviour reveals a principle limitation of the Microchip suggested PWM scheme, it
allows only 2-quadrant operation and isn't suited for reactive loads. In this case, the reactive current of the filter causes
the (rather small) problem.

When direction changes, the inductor current is non-zero. It causes a single positive direction commutation pulse
and a respective current step, when the highside "direction" switch is released. It can be best seen in the bottom waveform.

You can possibly reduce the effect in output by modifying the PWM timing. But if you connect a load with higher reactive
current, e.g. a motor, the waveform distortion will be worse. A principle solution would be provided by a 4-quadrant PWM
scheme, that is modulating at least 2 switches simultaneously. Standard motor inverters (VFD) are modulating all
4 switches and mostly using an unipolar PWM scheme.
 

    dgs117

    Points: 2
    Helpful Answer Positive Rating
Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

FvM, thanks for a very insightful observation. Indeed, I played with the load and it showed the reduction or the increase of the pulse. And yes, the modulation suggested by Microchip scheme is not very suitable for the inverter design I am building because I need to test various filter configurations at the output of the inverter.

Anyway, I am going to test new modulation method using two PWM outputs and modulating two switches simultaneously.

Take a look below at the scheme.
 

PIC18F4520 SPWM - Full-Bridge Output Direction Change

The problem is, that you must have the switches of one (or both) half bridge switching in a double through style to
allow bidirectional energy flow with reactive loads. Of course dead-times must be provided to prevent from shoot-through.

Using Half-Bridge Output Driving a Full-Bridge Circuit as above with programmed deadtime, you can achieve 4Q bipolar
operation. The mostly preferred unipolar PWM scheme isn't provided by PIC45F20, as far as I understand.

P.S.: You also get some waveform distortion due to programmed deadtime at current zero crossing. It could be either
corrected by a duty cycle bias or an ADC voltage feedback.
 

    dgs117

    Points: 2
    Helpful Answer Positive Rating
Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

Yes, indeed, I had done half-bridge circuit some time before and it worked very good without any significant distortions (check oscs below). But I have a task to make an unipolar switching scheme and test it.

I have seen PIC18s (PIC18F452, PIC18F6520 etc.) in various commercially available inverters ranging from 1kW to 5kW for consumer use. I think they would surely use an unipolar swithing schemes, don't you?
 

PIC18F4520 SPWM - Full-Bridge Output Direction Change

Yes, it looks very good. Unipolar is preferred, because it achieves doubled PWM frequency in output voltage and lower
ripple current. I also expect it to be used with most commercial inverters.

But a PIC45F20 doesn't have the resources to implement it in hardware.
 

Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

Well, I have some results. I changed the scheme according to the pic below. I used two PWM outputs (simple CCP1 and CCP2). The carrier frequency is 19.531 kHz. Changed the interrupt service routine as shown below. The LC filter's and load's parameters did not change.

Take a look at some oscilograms and tell me what else can I do to improve the sinusoidal output signal?

Code:
// Half period 32 points sinewave lookup table
const unsigned short int sinewave[32]=
{
0,25,49,73,96,118,137,159,177,193,208,220,231,239,
245,249,250,249,245,239,231,220,208,193,177,159,137,
118,96,73,49,25
};

unsigned short int i=0;

void interrupt()
{
     if(TMR0IF_bit)               // TIMER0 interrupt
     {
      TMR0IF_bit   = 0;           // clear TMR0 overflow interrupt flag bit

      if(i==32)
       {
        CCP1M3_bit = ~CCP1M3_bit;       // CCP1 PWM mode togle
        CCP1M2_bit = ~CCP1M2_bit;       // ...
        i=0;
        CCP2M3_bit = ~CCP2M3_bit;       // CCP2 PWM mode togle
        CCP2M2_bit = ~CCP2M2_bit;       // ...
       }

      CCPR1L = sinewave[i];     // put a new value for PWM1 duty cycle
      CCPR2L = sinewave[i];     // put a new value for PWM2 duty cycle

      TMR0L  = 66;              // inter. for 50Hz output @ 20 MHz, prescaler 8

      i++;                      // increment table counter
     }
}
 

Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

I made measurements using different sinewave tables: 32 points, 64 points and 128 points. The PWM frequency (19 kHz), load, filter parameters are constant. As you can see there is no effect on the zero transition between the half periods of the sine wave.

What is the cause of these distortions? Is it the same as in the first inverter design?
 

PIC18F4520 SPWM - Full-Bridge Output Direction Change

Did you measure the THD? It looks O.K. for a usual inverter, I think. Waverforms from the supply network are often worse. The reason is different from previous PWM scheme, I think. Also deadtimes are causing a zero crossing distortion.
 

Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

Well, I just measured the THD using KYORITSU KEW 6310 power quality analyzer. I don't know if the results are adequately correct because the analyzer is not suited for low voltages. Voltage THD is very high, around 30-40%, but current THD is only between 6-7%.

I am going to repeat the measurements under higher voltage and appropriate resistive load.

Update: Observe the voltage and current waveforms seen by the analyzer.
 

Re: PIC18F4520 SPWM - Full-Bridge Output Direction Change

Well, I have some results. Today I made measurements at 220VAC for 75W load. Take a look at the results.

The question is where do the current spikes come from? Is it related to the filter? And the resistor Rprotection got very hot during the measurements, it almost fried out.
 

You need to set your interrupt on fast response. There's a bit for that. It's a software delay most likely.
 

Doesn't look like regular switching operation. You showed quite different waveforms before, so what has changed now?

It's not clear how you are probing the bridge output voltage.

As another point, refering to the previously discussed PWM schemes. How are you generating deadtimes between high- and
low-side switches? Microchip has suggested a different circuit that utilizes a programmable deadtime.

If you don't have deadtime, simultaneous on-state of both transistors (shoot-through) must be feared.
 

Dead-times are generated in hardware. Take a look at the attached detailed wiring diagram. Capacitor and collector's resistor at the anode of the HCPL-3120 driver are used to implement different IGBT's gate turn-on and turn-off times. The working principle is essentially this: the anode voltage does not reach 5V as long as the capacitor is not charged, so we have a delay before the diode of the driver turns on; on the opposite side when npn transistor turns on the capacitor is quickly discharged, so we get a faster IGBT gate turn off time. Exact values are selected according to the required dead-time.

The inverter is supplied from a 1kW safety transformer's rectified and filtered 320V DC voltage.

The MCU parameters are the same as in this post: #1225353

Strangely, the current spikes occur only when CCP1 is active. Maybe something is wrong with hardware or the wiring. I will double check it.

And the resistor Rprotection gets really really hot, I mean it would have burned out if I would not turned off the inverter power supply.

For now, maybe you have some ideas how could I improve my inverter design? Maybe I should replace the npn transistor with buffers?
 

the light blue current is being measured on the load resistor. that ramp rate means the current is NOT going through your load inductor. so it must be sourced from your protection capacitor.

looks to me like your protection cap is being charged & discharged.

Mr.Cool
 

So what are you suggesting? Maybe I should try changing the value of the filter capacitor? Then observe the waveforms and compare them.
 

- You should be able to see, if the IGBTs are switching regularly. This can be determined from the presented waveforms.

- Generally the output filter is a lowpass. Even if the inverter would switch irregularly, it shouldn't cause considerable
higher current in the filter cap. So it must be suspected, that the filter dimensioning is unsuitable.
 

Today I made measurements at different capacitor values of the output filter. The load was about 500W. The capacitor values tested were 2.2uF, 3.3uF, 4.7uF, 6.8uF, 10uF and 22uF. The Rprotection value was constant 2.7ohm. The inductor L was constant too at 0.6mH with internal resistance of 0.15ohm.

Yellow - output voltage on the load;
Blue - output current on the load;
Purple - CCP1 output signal of the mcu;
Green - CCP2 output signal of the mcu.

I didn't notice any significant changes in the output current waveform.

What should I test next? Maybe increasing the value of the inductance?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top