Experimenting with Buck Converters

If you’re like me, the first thing you do when wiring up a new circuit is to connect the power and ground rails (with the power source initially turned off… maybe).  And you’ve probably got at least one power supply that’ll do the job.  But what if you didn’t have the supply you needed?  Perhaps all you’ve got is a 12V battery, and you’re in need of a 3.3V source.  Well, if you’ve finished your chores, I hear Tosche Station will sell you some power converters.  Failing that, you could always build your own.  A simple buck converter will likely do the trick:

The Standard Buck Converter (via Microchip)

The buck converter takes a DC input voltage and reduces it by a controllable amount, much like a resistive voltage divider.  But unlike your average voltage divider, the buck converter can efficiently supply a substantial output current.  In fact, this circuit’s output current should be greater than its input current (on average).  And no, that doesn’t violate any laws of physics; the converter’s output power will still be less than its average input power because its output voltage is lower than the voltage at its input.  In mathematical terms, (PIN = VINIIN) > (POUT = VOUTIOUT), where IOUT = ILOAD above.  Make sense?

Now clearly this isn’t your typical linear regulator.  Not with that inductor sitting there anyways.  So just how does it work then?  Well, the key is in the switching action of the p-channel MOSFET – a fact that leads us to call such circuits switching regulators.

Think of the FET as a simple switch.  When this switch is on (conducting), the current through the inductor (L1) will  ramp up (since VIN > VOUT), as will the voltage at the output capacitor.  But we don’t want the output voltage to go as high as the input voltage.  So, after a very brief on-time, we turn the switch off again.  But once the FET stops conducting, the inductor’s current has to go somewhere.  Well fortunately we have diode D1 available – it provides a path for current to continue to circulate (out to the load, back to ground, up through the diode and back to the inductor).

Here’s the trick though: this on-off switching cycle happens over and over again, many thousands of times per second.  In fact, the more frequently we switch, the smoother our output voltage will become.  This is because we have an output capacitor picking up the slack (so to speak).  During the switch-off periods, as the inductor’s current drops, COUT supplies the bulk of the output current (ILOAD).  Once the FET is switched on again, the inductor’s current ramps back up and recharges the output capacitor.  Thus, we maintain a constant ILOAD while the capacitor absorbs the ripple current (IRIPPLE).

Now as you may have already guessed, the ratio of the input to the output voltage is determined based on the relative lengths of the switch’s on and off periods.  This is a method known as pulse-width modulation (and it’s used in tons of other circuits):

Typical PWM Waveforms

If the switch were turned on 100% of the time, the output voltage would eventually equal the input voltage.  On the other hand, if the switch were on 0% of the time, the output voltage would be zero.  So it makes sense then that the output voltage is equal to our duty cycle (the percent on-time) times our input voltage.  In other words, if the switch is on for 50% of a cycle, in theory VOUT = (50%)(VIN).  Now in practice, non-ideal components will cause the required duty cycle to be higher than expected, but we’ll get to that later.

By the way, if you’re wondering how to go about picking component values for your own buck converter, there are equations for that.  But instead of going into all of the details here, I’m going to refer you to this excellent guide (and video) from Microchip.  It’ll walk you through an example design for a 12V to 5V, 2A buck converter.

The Experiments

So this past Sunday I was in my “lab” (aka the table in my basement) and decided to see how efficiently I could build myself a buck converter with the parts I had on hand:

yay for protoboards!

I’ve laid out my circuit almost exactly as shown in the schematic above (ignoring the four ceramic filtering capacitors connected across the four parallel supply rails).  On the left is my p-channel MOSFET, followed by diode D1.  The large green and black thing is, you guessed it, the inductor (which I scavenged from a broken battery charger).  To the right of the inductor are three capacitors in parallel (I’ve done this to get better output filtering characteristics at high frequencies).  The white and black wires you see leaving the right side of the board are connected to my resistive load.  The circuit is configured like so:

  • VIN = 10V
  • PFET = IRF9540
  • D1 = 1N4004
  • L1 = 100uH
  • COUT = 270uF (effective)
  • FSWITCHING = 52kHz
  • D = 62%
  • VOUT = 5V

I should also note that these component values were chosen based on an expected load current of 1A and a ripple current of 0.3A.  I only had the one good inductor to play with, so I computed my switching frequency based on its value.

Experiment #1 (Bad Diode)

For this first test, utilizing the 1N4004 general purpose diode, I measured the following:

  • PIN = 8.7W
  • POUT = 5.1W
  • Efficiency = 59%
  • TPFET = 120°F
  • TDIODE = 149°F
  • TINDUCTOR = 82°F

Alright, so while an efficiency of 59% isn’t terrible (particularly by comparison to the 50% you’d achieve using a linear regulator), it’s not great either.  Simple buck converters are typically 80-90% efficient.  So unless my measurements are way off, clearly something’s not right here.  Based on the temperatures I measured using my Kintrex IR thermometer, I suspect the diode may be our efficiency bottleneck (since it’s the warmest component).  To find out, let’s measure a few voltage waveforms while the circuit operates:

Buck Converter Test #1 Scope Trace

The top waveform, in pink, is our measured 5V output, shown at 5V/div.  Below that, in green, is the voltage measured at the connection between D1, L1, and the FET, shown at 10V/div.  At the very bottom, in yellow, is our gate drive signal.  When this signal hits 10V, the p-channel FET will be off; when it’s at 0V, the FET will be conducting.  Note that because of this inverse relationship, the duty cycle calculated by the scope (~38%) is incorrect; we need to subtract this value from 100% to get our true duty cycle (~62%).

So as I suspected, the diode is clearly having some issues.  See that big (~25V) negative voltage spike across the diode each time the FET turns off?  Yea, that’s not so good.  It means our diode isn’t turning on as quickly as it should.  This puts additional stress on the FET.  But when the diode finally does turn on, it’s showing a voltage drop of just over 0.9V.  During the switch-off period of a cycle, the diode has to conduct, on average, the full load current of 1A.  Since our duty cycle is 62%, the diode will be conducting 38% of the time, meaning it conducts an average current of 0.38A.  Using P = IV, we can determine that the diode is dissipating at least (0.38)(0.9) = 0.34W.  The diode’s turn-on delay probably accounts for more loss, but I’m not entirely sure how to calculate that.

Experiment #2 (Schottky Diode)

Well let’s just see what happens when we substitute a much better Schottky diode (15TQ060) in place of that lousy 1N4004 rectifier.  Here’s the data from test #2:

  • PIN = 5.5W
  • POUT = 5.1W
  • Efficiency = 93%
  • TPFET = 81°F
  • TDIODE = 81°F
  • TINDUCTOR = 80°F

Wow, that’s quite a difference in efficiency (from 59% to 93%)!  And it’s all thanks to the minimal (<0.3V) forward voltage of that Schottky diode, as well as its fast turn-on time.  Our waveforms are starting to look a lot cleaner as well:

Buck Converter Test #2 Scope Trace

Experiment #3 (More Current!)

So what happens if we now decide to turn up the heat a little?  What if we suddenly decide to supply a 2A load instead of 1A?  Well, I tried just that.  Here’s what happened:

  • PIN = 12.8W
  • POUT = 10.5W
  • Efficiency = 82%
  • TPFET = 96°F
  • TDIODE = 85°F
  • TINDUCTOR = 81°F

Hmm, it seems our efficiency has dropped again.  But not unexpectedly.  Based on the temperatures of the components, it seems like our FET may now be the limiting factor.  And no surprise; the p-channel device I’ve chosen has an on-state resistance of ~0.2Ω.  Using P = IV = I2R, and multiplying by the duty cycle (the switch on-time), I get:

P = I2RD = (22)(0.2)(0.62) = 0.50W

And even at 0.3V, the diode is still dissipating substantial power as well:

P = IV(1-D) = (2)(0.3)(1-0.62) = 0.23W

Now unfortunately, I don’t have a better p-channel MOSFET to try out at the moment.  So I’m just going to have to accept those losses for now (shame on me).  However, there is a way to nearly eliminate the losses of the diode: replace it with another FET!

The Synchronous Buck Converter (via Microchip)

This time I’ll be using an n-channel MOSFET which, as you may know, contains it’s own diode (called the body diode; the p-channel FET contains one as well, but I’ve omitted it in the diagrams above).  But we won’t be relying on that diode to handle any current.  Instead, we’re going to switch on the n-channel FET whenever the p-channel FET turns off (they’ll be complimentary).  In doing so, we’ll create a low resistance path (<0.1Ω) through which the ripple current can continue to flow during the P-FET’s switch-off period.

Sadly, I can’t claim credit for this brilliant idea.  I’m not sure who first thought it up, but it’s called the synchronous buck converter (as opposed to the asynchronous, or standard, buck converter).  I imagine this is because you have to operate the two FETs in sync with one another.  This makes life a little tricky, as you don’t want to accidentally turn on both transistors at once (thus creating a short from power to ground).  But it’s not bad.

Here’s a scope trace showing the n-channel FET’s additional gate drive signal (in purple):

Buck Converter Test #4 Scope Trace

Experiment #4 (More Current, More FET!)

Well I’m sure you’re just dying to know how much of an efficiency improvement this synchronous converter will provide.  Well fear not, here are the results of my last test:

  • PIN = 12.0W
  • POUT = 10.4W
  • Efficiency = 87%
  • TPFET = 96°F
  • TNFET = 84°F
  • TINDUCTOR = 82°F

Indeed, this is an improvement!  We’re not quite back to the 93% efficiency we saw at a load current of 1A, but 87% is still better than 82%, no?

So, lessons learned?  Use quality components.  That means FETs with as low an on-resistance as possible.  And if you don’t want to go with the synchronous converter, make sure you pick a fast diode with low forward voltage.

By the way, although I haven’t done it here, you’ll probably want to wrap your buck converter in a controller of some kind (unless your load current will be fairly constant).  If you don’t, with a constant duty cycle, variations in load will cause your output voltage to change by a fair amount.  Fortunately, If you look around the interwebs, you’ll find a number of ICs that provide buck converter control.  But if you’re clever, you could whip up your own op-amp control circuit.  Or just program an AVR to do the job for you – they’re great at PWM.  Give it a shot and let me know how you make out.

One last thing: if you’ve been counting, you’ll notice that the losses I’ve calculated don’t add up to the difference between input and output power.  Lest we forget, there are still resistive losses in the inductor and output capacitor, as well as switching losses on the transistor(s).  This switching loss has to do with the power dissipated in the FET’s gate capacitance, as well as resistive losses as the transistor ramps between on and off states (nothing happens instantly you know).  The solution?  Again, buy better parts. 🙂

Questions, comments, suggestions, requests?  Feel free to leave them below.  Thanks!

19 thoughts on “Experimenting with Buck Converters”

  1. Thank you for this insightful blogpost.
    However I do believe the P-MOSFETS in your schematics are facing the wrong way.
    The source part should face towards Vin and the drain towards load.

      1. Mike, you should not feel like a dope. This blog is really brilliant, I have trawled your entire blog and its great! Keep the articles and oscope traces coming!!!

  2. Hi, very nice results. I am working on a buck converter to use with a permanent magnet alternator. I was able to get it working using a resistive load. I am having trouble making the circuit to work when charging a 12 volt. The circuit does allow the PMA to spin more freely. If you can give any suggestions it will be greatly appreciated.



  3. Hi Lauri,

    Thanks for your comment. Your project looks really neat! What’s your ultimate power goal?

    So I haven’t had a chance to read through the entire thread above, but it sounds to me like your 12V battery is putting too much load on the circuit. If the PMA isn’t spinning freely, that means it’s electrically loaded (you’ll get the same feel by just shorting the motor terminals together). You might try reducing your duty cycle (and verify that it’s actually reduced by measuring gate voltage). Your target output voltage should be just slightly above the voltage of your battery for a light charge.

    On the other hand, I did notice that in your most recent post to the thread above you said that with an output capacitor in place the battery did not charge. But with the capacitor removed, you saw ~0.14A of charging current. That does not sound like a heavy load… was the motor still tough to turn during this test? If it was, there’s a problem elsewhere in your circuit. But in this test, it sounds like with the output capacitor in place, the output voltage wasn’t making it high enough to overcome the output blocking diode. The capacitor was probably absorbing any voltage spikes that exceeded the ~13V threshold you’d need for charging (battery voltage + blocking diode voltage). By removing it, any transient spikes went into the battery.

  4. I would like to use a buck converter to charge a battery. Is this possible and how would you go about doing that?

    ps- your tutorial is great. thank you

  5. Hi,

    I hit upon your blog from hackaday almost by chance. Very well written blog. What did you use to drive the FETs? A signal generator? or 555 or microcontroller?

    Also I see you applied Vgs of -5V (for P-Mosfet), was it enough to fully turn on the mosfet? I mean you may have been facing higher resistor than the minimum if the fet wasnt fully turned on.

    To drive the n-mosfet in the last experiment, did you just tie both the gates (of p-fet and n-fet together?)


    1. Thanks! Good question on the gate drive signal. Looks like I neglected to mention that. And unfortunately it’s been so long since I ran this test that I don’t clearly remember. Well, I half-remember. The original signal was most definitely produced by the arbitrary waveform generators (DACs) of my RPI IOBoard. However, I’m not sure what I used for amplification (the IOBoard can only produce about +/- 3.5V at its output, and the signals above are 0V to 10V). I suspect what I did was generate a triangle wave and then feed that into a comparator along with a reference voltage which determined duty cycle. So, for example, if I set my triangle wave to oscillate between 0V and 5V, then set my comparison voltage to 2.5V, I’d wind up with a square wave output with a 50% duty cycle.

      Regarding Vgs on the P-FET, I believe I went all the way to -10V, not -5V (unless I’m misreading something?). The vertical scale on the purple, green, and yellow plots is 10V/div in all cases above. And that would be sufficient to turn on this device.

      For the last experiment, again my memory is a little fuzzy, but as I mentioned before, I believe I used a triangle wave input to two comparators. Each comparator had a fixed, but slightly different, comparison voltage input. The result was that the two FETs had a little buffer between turn on and turn off. You definitely don’t want to have the two turned on simultaneously, even briefly.

      Hopefully that helps! Let me know if you have any other questions.

  6. Thanks for the website. I enjoyed the review of the buck converter. could you do a general statement about the values and ratings of a mosfet? I am looking for a general discourse on derating and the value of the parameters in a mosfet. In my car for example a thousand amp battery is much better than the 500 recommended. However the 24 volt battery is a no no!!! So when I design a circuit with a mosfet for wild conditions that are all over the place what values can I change? and how do they affect performance? If I have a mosfet on a circuit with more transients than the salvation army, can I use a higher gate voltage max mosfet to deal with these things? How about a higher source to drain voltage rating? thanks

  7. Hi,
    I am also using IRF9540 for my 24V to 5V buck converter. Duty cycle is 20%
    I am using PIC16F877A microcontroller for PWM generation. I am getting correct 20% duty cycle waveform with 40KHz PWM freq. but when I connect PWM output to drive my buck converter I am getting 24V as output. I not getting what is a reason? I am driving Mosfet gate with BC547 with 4.7OHM resistor at colletor and 220OHM resistor from 24V to Gate of IRF9540. can anybody put some light to help me out?

  8. It’s easy to make synchronous rectifier when there is constant switching with constant duty cycle. It means it’s NOT stabilized.
    But try this with a PWM. For example try to improve the efficiency of a converter, made with the common (and cheap) PWM MC34063 (via synchronous rectification).

  9. im doing synchronous buck converter integrated with solar panel, i would like to know about the designing for its inductor and capacitor. also would wanted to know how to generate gate pulse for p and n mosfets using a micro controller.hoping to use pic 16f877a. kindly help

  10. Thanks Mike,

    Your article inspires me to do some experimentation myself.

    I need to build an efficient voltage divider for solar panels, so I can run several 30v panels in series to feed an inverter who’s max input voltage is 50v.

    However I’d need to improve on the efficiencies you achieved, as the input would be up to 500w.

    I’m a bit surprised that there isn’t a pre built module that does this job, but I guess that most people want a regulated output, where as solar inverters need unregulated, as they have in built circuits and algorithms to draw the most power from the panels by changing the amount of current drawn.

    Anyway, thanks again


Leave a Reply

Your email address will not be published. Required fields are marked *