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!
	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.

Graph of captured IGBT switching waveforms

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.

17 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,

    • 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?


  3. Jil Sutaria says:

    Hello Mr Burke,
    Thank you.Sorry for the delay in reply. I have answered the questions you have asked below:
    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,

    • 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?


  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,
    I guess the on time will reduce by 2 us.
    Thanking you,

    • batchloaf says:

      Hi Jil,

      I’ve just published a draft of the updated buck-boost example code as a new post. I haven’t had a chance to compile it yet since I don’t have a compiler installed on this laptop, but I’ll try it when I’m back in the office next week.

      In the meantime, hopefully you’ll be able to get a general idea of how it works. The input voltage (scaled down by a factor of 50 should be connected to AN0.


  5. Mr burke ,
    can you help how to control a converter dc dc with DSPIC30 ?
    thanks 🙂

    • batchloaf says:

      Hi Chedi,

      If you have some specific questions, I might be able to answer some of them, but I can’t just explain the whole thing to you. I would need to go and research it myself and then explain the whole thing clearly, which would take a long time. There are lots of examples of dc-dc converters documented online. If you can show me exactly what type of dc-dc converter you’re building, I might be able to help you get your dsPIC code started.


  6. Hitesh Patel says:

    Hello Mr Bruke,
    Right now i am working on developing IGBT based 1-phase AC Voltage Stabilizer. In this, i am using ATmega32 Controller.
    In this, AC Voltage is stabilized in two stages, in first stage AC is converted into DC using 1-phase Uncontrolled Diode Bridge Rectifer &
    in second stage this converted DC is again converted into AC signal & this AC signal is given to Secondary Winding of Line Series Buck/Boost
    Transformer. In this, Multiple Pulse PWM Theory is used to control H-bridge 1-phase IGBT based Inverter with Proper Dead Time between IGBTs
    of same leg. I am facing problem that the after 50% duty Cycle, IGBTs of same leg is got failed. so how to overcome this problem?

    • batchloaf says:

      Hi Hitesh,

      I can’t be sure about this, but it sounds like you’re getting what I think is referred to as “shoot through”, where both transistors on the same side of the H-bridge are accidentally switched on at the same time, resulting in a large surge of current through that side of the H-bridge which can easily burn out the transistors. Depending on how fast the transistors switch on and off, it is possible that even if you switch one off and the same time as you switch the other on, they may both be on for a split second which can be enough to do the damage. Have you left any dead time between switching one off and the other one on? If not, I would recommend doing so.

      Does that sound like it could be the problem?

      Some microcontrollers (such as the dsPIC) provide a dedicated feature for inserting dead time when generating complementary PWM signals, but I’m not sure whether the ATmega32 provides this or not because I haven’t used it other than for very basic stuff in an Arduino.


      • Hitesh Patel says:

        Hi Ted,
        Thanks for your valuable prompt reply.

        I am getting Dead Timer from ATmega32, but I will use dsPIC micro-controller.
        Kindly suggest me that for this project, which is technology is much better based on performance (AC-AC Coverter or AC-DC-AC Converter)…

      • batchloaf says:

        Hi Hitesh,

        I’m not really qualified to advise on your choice of converter. Of the types you have mentioned, I have personally only worked with AC-DC-AC type converters (well, in the sense of a microcontroller-based converter), but I am not particularly knowledgable in this area. I need to rely on my power expert colleagues for guidance in these matters.

        I can say that the micrcontroller I have used most often for this type of work is the dsPIC30F4011, which I have always been very happy with. I regularly receive comments here from people using the dsPIC30F4011 in power electronics projects, so I get the impression it’s widely used in this area.


  7. Hitesh Patel says:

    Hi Ted,
    Thanks for valuable reply. Also some guidance is required in another project.

    We are developing thyristors besd 3-phase Voltage Stabilizer in Bucking VOlt & Boosting VOlt mode. In this project,secondary windings of three 1-phase transformers having different secondary voltages are connected in series to the incomimg line and 1-phase incoming power supply is given primary widnings through thyrisotrs. In this project, the thyristors are triggered ON using Phase Control Principle. In bucking mode, this model is working perfectly. But in boosting mode, during applied line voltage from zero to full voltage to the primary windings of transformers, the audible humming noise is from these transformers.
    So what could be solution to nullify this audible humming noise?

  8. dessalew says:

    hi it is good way how to suport someone who needs help from expertts

  9. dessalew says:

    sir can U help me on how to write c code on microc for buck-boost (4volt up to 60volt to 12 volt) converter using pic16f877a

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s