## IGBT control in a buck-boost DC-DC converter

Reader Jil Sutaria wrote in a with a query about controlling four IGBTs in a buck-boost DC-DC converter. Some of the main features of this application are:

• Two pairs of IGBTs need to be controlled.
• Each pair of IGBTs share one “leg” of what looks like a H-bridge. Each pair is driven in complementary mode (i.e. one IGBT is off whenever the other is on). I’m guessing there should probably be some dead time at the point where the two devices swap over, but for the time being I’m ignoring this.
• Both pairs of IGBTs have the same duty cycle – 73% in boost mode and 27% in buck mode.
• The two pairs are driven 180 degrees output phase.
• The switching frequency is 20kHz.

I’ve sketched out an example program. It’s really still a work in progress, since the waveforms don’t change at all – they just constantly repeat the same pattern. However, they’re at least coming out about the right shape (see waveform graph below).

//
// igbt_dcdc_converter.c
// dsPIC30F4011 program for IGBT DC-DC converter
//
// Written by Ted Burke
// Last updated 4-1-2013
//

#include <xc.h>
#include <libpic30.h>

// Configuration settings
_FOSC(CSW_FSCM_OFF & FRC_PLL16); // Fosc=16x7.5MHz, Fcy=30MHz
_FWDT(WDT_OFF);                  // Watchdog timer off
_FBORPOR(MCLR_DIS);              // Disable reset pin

int main()
{
// Make all port D pins outputs
TRISD = 0;

// Configure timers 2 and 3 for 20kHz,
// but 180 degrees out of phase
PR2 = 1500; TMR2 = 0;
PR3 = 1500; TMR3 = 750;

// Configure output compare channels 1 & 2
// to control one pair of IGBTs (using Timer 2)
OC1CONbits.OCM = 0b101; OC1CONbits.OCTSEL = 0;
OC2CONbits.OCM = 0b101; OC2CONbits.OCTSEL = 0;
OC1R = 0; OC1RS = 0.73 * PR2;
OC2R = 0.73*PR2; OC2RS = PR2;

// Configure output compare channels 3 & 4
// to control the other pair of IGBTs (using Timer 3)
OC3CONbits.OCM = 0b101; OC3CONbits.OCTSEL = 1;
OC4CONbits.OCM = 0b101; OC4CONbits.OCTSEL = 1;
OC3R = 0; OC3RS = 0.73 * PR3;
OC4R = 0.73 * PR3; OC4RS = PR3;

// Enable both timers to start waveforms
T2CONbits.TON = 1;	// Enable timer 2
T3CONbits.TON = 1;	// Enable timer 3

// Now just hang around here and let the
// output compare pins do all the work!
while(1);

return 0;
}


Here’s a quick graph I captured from the pins using my makeshift logic analyser (see next post). The waveforms are at least roughly the right shape and the desired 180 degree phase shift seems to be working correctly.

The x-axis values are sample numbers. My makeshift logic analyser is sampling four channels in parallel at a sampling frequency of approximately 1MHz. I say approximately because I’ve actually just done it roughly with a 1us delay function (specified as 30 instruction cycles – the dsPIC is running at 30 MIPS) rather than using an interrupt. The real sampling period is probably slightly longer than the intended value and there’s probably a slightly longer inter-sample period every fourth sample due to the way the sampling is done in a loop. Also, I’m using the internal fast RC oscillator to drive my dsPIC, so that’s probably introducing some additional timing variability.

The y-axis values are basically meaningless – I just added an offset to each channel to spread them out on the graph. Each output compare channel is actually switching between 0V and 5V. The channels are displayed in the following order from bottom to top on the graph: OC1, OC2, OC3, OC4.

This entry was posted in PIC and tagged , , , , , , , , , , , . Bookmark the permalink.

### 7 Responses to IGBT control in a buck-boost DC-DC converter

1. Jil Sutaria says:

Hello Mr Burke,
Thank you so much for sketching the rough code. I compiled it with a few changes in library files defined. However i am not getting the phase shifted output.
The period you have used for timer 3 seems to be half that given for timer2. I think the value of
PR3 should be PR3 = 2250; TMR3 = 750. Also the period of the output waveforms achieved is 44 US instead of 50US. I tried to increase the period but it didnt work out properly.
The link below will give you the idea of the kind of waveforms i need:
These are the gating pulses required. I have simulated the following topology in MATLAB and theese waveforms are from it. The first two waveforms are the gating pulses for leg 1 and the last two are the gating pulses for leg 2, which are phase shited. The waveforms would remain same in Boost and Buck mode as only the lower two IGBTs would work in Boost mode and Only the upper two IGBTs would work in Buck mode.
I hope the waveforms give you a clear idea.
Thanking you,
jil sutaria

2. Jil Sutaria says:

Dear Mr Burke,
Happy new year.
Thank you so much. Even i got the same waveforms as you have, and they are right. Thank you again. I was just wondering if i could change the pulse width by using an external analog DC signal. Also could dead band be added to it?
Thanking you,
jil

• batchloaf says:

Hi Jil,
Yes, it shouldn’t be too hard to control the pulse width using an analog input voltage. Also, it will be easy to add dead time. If you can provide more details, I’ll update the example to add this functionality. The kind of things I’ll need to know are:

• What is the desired duration of the dead time?
• Over what range of values do you need to vary the duty cycle?
• What will the input analog voltage range be for controlling the duty cycle?
• Do you want a linear relationship between analog input voltage and duty cycle?
• Will the same duty cycle still apply to all channels?

Ted

3. Jil Sutaria says:

Hello Mr Burke,
1) The dead time required is of 1 us.
2) The duty cycle is to be varied from 69% to 77%.
3) The input voltage will range from 108 V to 130 V. it can be scaled down according to ADC requirement.
4)the relationship between the voltage and the duty cycle will change according to the formula:
Duty cycle = 1 – (Vin/Vout). Here the output voltage is taken as 450 V aand it can vary from 445 V to 455 V.
5) yes the duty cycle will be applied the same way.
Thanking you,
jil

• batchloaf says:

Hi Jil,

Sorry, one more question: Should the duty cycle be applied before or after the dead time is subtracted?

For example,

Since the frequency is 20kHz, the period of each wavefore is 50us.
Within each period, the dead time will occur twice (2 x 1us = 2us), which is already 4% of the period.

Let’s say the current duty cycle is 75% – I have several options:

Option 1:
$T = T_{on} + T_{dead} + T_{off} + T_{dead} = 50\mu s$
$T_{on} = (0.75 \times 50)\mu s = 37.5\mu s$
$T_{off} = ((0.25 \times 50)-2)\mu s = 10.5\mu s$

Option 2:
$T = T_{on} + T_{dead} + T_{off} + T_{dead} = 50 \mu s$
$T_{on} = (0.75 \times (50-2))\mu s = 36\mu s$
$T_{off} = (0.25 \times (50-2))\mu s = 12\mu s$

Option 2:
$T = T_{on} + T_{dead} + T_{off} + T_{dead} = 50 \mu s$
$T_{on} = ((0.75 \times 50)-1)\mu s = 36.5 \mu s$
$T_{off} = ((0.25 \times 50)-1)\mu s = 11.5 \mu s$

Which of the above (if any) is preferred?

Ted

4. Jil Sutaria says:

Hello Mr Burke,
In the options above u seem to be delaying the falling edge of the pulse, whereas i am delaying the rising edge of the pulse by 1 us. That is,