I need help with my first flyback converter

Discussion in 'General Electronics Chat' started by bonedoc, Dec 21, 2011.

  1. bonedoc

    Thread Starter New Member

    Dec 21, 2011
    Hey guys, I am new here. Im used to writing assembly for pic microchips, but have more recently started to learn about other things....more specifically DC to DC conversion. I have a situation where I need to convert 6V DC into 300V DC. Originally, I was going to use the LT3750 capacitor charger, but when I ordered them, I realized they were microscopic. Not a chance I am soldering that.

    SO....I figured I would learn how to do this without the LT3750 device. Also, I have a transformer winder, but I hate using it. So, I ordered a few coilcraft transformers, which were actually designed for that LT3750 cap charger. Just so you know, that cap charger allows for a 3v-24v DC input and does 300V out. Here is a link to the transformer I am using, the da2032:


    The primary windings are soldered in parallel. The turn ratio is 1:10 and the inductance is .013 on the primary, and 1.6 on the secondary.

    I attached a picture of the circuit I am trying to build. Instead of the switch, I am pulsing the transistor with a pic ccp module at 4000Hz. I verified that this is accurate with my scope.

    Here are my problems, and excuse me if they are stupid.

    -On hand, I have some 2sd965 NPN, and some IRF530 N channel power mosfets:



    These are both massively overheating. I dont understand why if I am simply pulsing 6V through them. I have a 1k resistor to the base / gate from the pic. I have 6V going to the primary winding an then to the NPNs I am testing. In the case of the 2sd965, the output of the transformer primary goes to the collector and the emitter goes to the ground. In the case of the IRF530, the output of the transformer goes to the drain, and the source goes to the ground.

    Am I just trying the wrong transistors? If so, what is a good selection?

    -My last question is this, regarding the secondary side. If I have everything running on the primary side, and I dont have a load on the secondary side, should I not be able to measure an AC voltage across the windings? When I test, do I need to measure from secondary end to secondary end, or from one secondary end to ground? Also, if I have no load but have a high speed diode on the secondary, should I not see a large DC voltage from the anode to ground?

    Sorry for all the stupid questions...Im going crazy and new to this! I think I have read everything I can, but dont get something.
    • fly.gif
      File size:
      1.6 KB
  2. SgtWookie


    Jul 17, 2007
    Both the IRF530 and the 2SD965 are woefully inadequate for the task at hand. The IRF530 needs 10v on the gate before it is considered fully ON; you won't reach half of that.

    The 2SD965 might sink up to 8A in a pinch (that's quite a stretch, actually), but the practical limit is 4A; and that is only if you can manage to feed the base 0.4A/400mA. You're just not going to get that much current out of a PIC, even if you have a tailwind while going downhill.

    Have a look at the attached simplified schematic and the waveform plots below.

    On the bottom left, I have a rough simulation of your PIC CCP output module @ 4kHz; 1/4kHz = 250uS per pulse. (By the way, the LT3750 operates at between 100kHz to 300kHz; you being at 4kHz means it will take 25 to 75 times as long to finish charging to the terminal voltage.) I'm using 10% duty cycle, or 25uS. I've set the internal resistance somewhat arbitrarily to 50 Ohms.

    Note the cyan V(uC) waveform in the upper frame of the plots. It's a pretty nice square wave that goes from 0v to 5v. Your real output most probably does not look that nice.

    The pink V(gate) is much more like what you'd see on the gate of the MOSFET referenced by the source terminal. It has a pretty long rise time before it gets to where it needs to be. Don't worry about the ringing; I'll explain that below.

    The item of real concern here is the power dissipation in the MOSFET, shown by "V(Drain)*Ix(U1: D)+V(Gate)*Ix(U1:G)"; the brownish-gold trace. "What the heck is THAT?" you might ask. That is the way the power dissipation in a component is calculated in the simulator; voltage on the drain * the drain current, plus voltage on the gate times gate current.

    Look at the plot itself. Note that the top of the scale is 50 Watts! :eek: And I'm only running this thing at 10%! (I'll bet you're running much closer to 50%). But why does the power get to a peak, and then start to drop off when the gate voltage is still "up there"? I'm glad you asked that question. MOSFETs have a positive temperature coefficient; the hotter they get, the greater their internal resistance. This MOSFET was getting so hot internally, that it became resistive enough to reduced the current flow; thus dropping the power expended in the MOSFET itself. Among semiconductors, this positive tempco is not typical; most have a negative tempco.

    Let's look at the traces on the bottom, starting with the red I(L1). Note that current in L1 builds up at a fairly constant rate - but why does it start so long after the gate voltage goes high? Good question - MOSFETs have a turn-on and a turn-off time specified in the datasheet; you will find that the turn-off time is always less than the turn-on time.

    Anyway, the current builds until it gets close to 5A, and the rate of increase of current flow slows down - that's a result of the MOSFET's internal resistance rapidly increasing due to temperature. Notice that the coil current falls off drastically even before the MOSFET has turned off! We absolutely don't want that to happen; we want a very sharp cutoff of the MOSFET so that you get a large energy transfer to the secondary winding, but that's just not happening. Even before the MOSFET is told to turn off, it's gotten so hot that the current through the coil primary has been nearly choked off.

    So what's the deal with the green V(Drain) trace "ringing" like that? And the pink V(gate) trace ringing? That is due to the MOSFET drain capacitance being in series with the inductive primary; and capacitive coupling from the drain to the gate. The drain and inductor will ring on for a bit when there is no load; I don't have a secondary or a load on it yet. Also, the voltage on the MOSFET drain doesn't rise high enough for it to act as a snubber.
    Last edited: Dec 22, 2011
  3. SgtWookie


    Jul 17, 2007
    Here's the exact same simulation, with the exception that I changed the MOSFET being used. Some basic specifications for this MOSFET are Vdss=60, Rds(on)=28, Qg=23nC. We went down a bit in Vdss, dropped WAY down in Rds(on), but the Qg went up from the IRF530. Compare those numbers in the datasheet. Qg=Total Gate Charge. You will find that increases in Vdss cause Qg to go up, and decreases in Rds(on) cause Qg to increase. At really low frequencies, Qg is not that important - but when you want to switch something on and off several thousand times a second, it gets to be pretty significant.

    Look at that gate voltage now! It looks like a shark's fin! That's because the total gate charge increased, and it's taking much longer for the wimpy output to charge and discharge the gate. This is causing the MOSFET to turn on slowly, which isn't much of a problem - it's the turn-off time that is causing a very big problem. Look at that power dissipation! It peaks out at ~400W!

    Look at the red trace; L1's current. It looks like a nice, linear ramp-up now - which is what you want. However, you want the current to drop off like a rock to get a sharp transfer of energy to the secondary winding.

    Look at that peak current through L1 - it's over 16A now; far too much for that primary; as it's only rated for 6A. This being only a simple simulation, the inductor won't show how your real primary will react when it's maximum current is exceeded and the core saturates. When saturation occurs, the core cannot absorb any more energy, and the inductor basically turns into a straight wire - and current soars very quickly.

    Note that the drain voltage build-up is slow, too - matching the decrease of current in the inductor.
  4. SgtWookie


    Jul 17, 2007
    Here's another revision. I swapped that MOSFET out for one that has basic specs of Vdss=60, Rds(on)=22, Qg=7nC (!) That's pretty remarkable when they decrease Rds(on), and at the same time cut Qg by more than 2/3!

    This improved the performance so much that I had to reduce the ON time to just 9uS, or a 3.6% duty cycle, to keep the peak current through the primary from exceeding 6A. Look at the current through L1 now! Average power dissipation in the MOSFET is now under 600mW. It has a very high peak, but that's in the nanosecond range. Improving the MOSFET gate drive would be necessary to get the peak power dissipation down to a reasonable level. You're not going to get there just using a PIC I/O pin.

    But, there is something wrong with the MOSFET selection; the body diode is not avalanche rated (like a Zener diode) - so we can't use that to clamp the peak drain voltage. You would need to use a snubber or other peak voltage limiter, or would kill the MOSFET pretty quickly.

    You could increase the PWM frequency to 20kHz, or 20uS - if the PIC you are using could have fine enough control of the PWM% to do that. I don't know which one you are using.