DC Buck & Boost

crutschow

Joined Mar 14, 2008
34,283
As tindle noted, building switching power supplies is not a trivial task.
In such a design there's generally a large gap between theory and practice.
And you certainly can't expect to throw some random parts you have, especially inductors, into the mix and expect it to work.

Also, building devices such as a switching power supply is very difficult without an oscilloscope to see what is happening.
If you want to do other types of such designs I suggest you look into purchasing one, otherwise you will continue to be frustrated, not knowing why your circuit doesn't work.
 

Thread Starter

bumba000

Joined Oct 7, 2015
97
Ok. I am still waiting on confirmation for the PWM frequency. I'm guessing that I can figure this one out on my own using an oscilloscope but havent figured that one out yet. I did just build an oscilloscope using this tutorial: http://makezine.com/projects/sound-card-oscilloscope/

It seems to be working very well I just need to learn how to use it !

Thank You for the parts list and the time that it took you to put it together for me. I know it's easy to say thank you and sit back waiting for more answers, but I'm not just sitting here waiting for answers and I really do appreciate all of your help, feedback, input and tips - all of you - thank you.

John
 

Veracohr

Joined Jan 3, 2011
772
You should be able to figure out the PWM frequency by using the Arduino function micros() to count the time between on states of the PWM output and write this number to the screen output ( I forget the name of that function at the moment).
 

Alec_t

Joined Sep 17, 2013
14,280
If the PWM frequency is > 20kHz then a sound-card oscilloscope won't be of use as a waveform monitor (sound-card bandwidth is limited and typically cuts off sharply at ~20kHz).
 

Thread Starter

bumba000

Joined Oct 7, 2015
97
Ok. Well I finally have an answer to the PWM frequency!! I'm running at 375Hz. I can simply change which pin I'm PWMing from and it will be 750Hz. Alternatively I can put some code in place to change the frequency to ( I guess) whatever I would like but that will also change how I keep track of time.

What would an ideal PWM frequency be for this project?

Thank You, John
 

Thread Starter

bumba000

Joined Oct 7, 2015
97
So I've been playing around with the frequency and it seems as though we may be getting somewhere. I've also removed the inductor from the less expensive store bought device that I have here. It only measures 2uH but is much larger than the small 33uH inductor that I purchased from digikey. I also have a couple of 560uF 6.3v aluminum polymer capacitors I removed from a working video card.

So using the "beefier" inductor, an aluminum polymer input and output cap with 2 of my very small diodes and a much higher frequency I'm getting better results. So I am putting an order together with digikey now. I'm going with the inductor http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail&itemSeq=181646518&uq=635802786450408020
I'm going with the inductor you pointed me to because it's just 2.2uH but very high amp handling and is okay with very high frequencies. I understand that the difference between the inductor you've pointed out and an identical inductor with just a higher henry rating is that the higher henry will allow a wider voltage fluctuation more quickly. I don't think that that will be necessary or you would have pointed that out as well. Right?

and the mosfet http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail&itemSeq=181646380&uq=635802786450408020.
I am looking at all of these caps in the filter link you've posted and I am at a loss. There are so many voltages. Like I said, I have two 6.3v caps here that are working. I've also used a couple of 35V caps. What am I looking for? What voltage of capacitor is appropriate here?

Thank You.
 

tindel

Joined Sep 16, 2012
936
Great questions!

Unfortunately - a PWM frequency less than 20kHz will not be adequate. You need at least 20kHz. It is possible that if you were measuring the switching frequency with the sound card of your computer that you may have been aliasing.

Recall the equation that I referred to v(t) = L* di(t)/dt where v(t) is the voltage with respect to time, L is the inductance, and di(t)/dt is equal to the change in current with respect to time. If you move dt and L over to the left hand side of the equation you get v(t) * dt / L = di(t). Now if you integrate both sides with respect to dt (assuming v(t) is a unit step function (which it is in a boost converter)) you get the following: v(t)*t / L = i(t). Now, if you don't understand that, that's fine. Just know that i = v * t / L when v is a step voltage.

So let's do a bit more math. Assume that you're operating at a duty cycle of 1-3.6/5 = 28% (which is the duty cycle you ultimately want). If you're operating at 750Hz then your operating period is 1/750Hz = 1.333ms and your inductor charge time is 1.333ms*0.28 = 373us. So what is your current going to be after one cycle? i = 3.6V * 373us / 2.2uH = 610A! Surely if your inductor could produce these types of currents, then you would probably have an electrical fire, but your inductor can't produce these kind of currents... so it will saturate and possibly still cause an electrical fire! The answer has to be somewhere in between. So what to do?

You could increase your inductor by a factor of 500 to get the current variant to 1.22A (A more realistic current) but then you have a 1.1mH inductor and the boss is going to have your ASS when you tell him that you chose a $25 inductor that is the entire size of the product you're making and the entire cost to the consumer. I think we can choose another option!

I know what you're thinking. "How about we increase the frequency?" Great idea! How about to, 100kHz. Our PWM period is now 1/100kHz = 10us, our inductor charge time is 10us* 0.28 = 2.8us, and our change in current is now i = 3.6V*2.8us / 2.2uH = 4.5A. Much more reasonable. And won't cost a small fortune. This one should do the trick! The boss would be happy with you except that there's still one more question... how big of a cap to procure.

For the period of time that the inductor is charging (2.8us), the cap is discharging. So the cap has to provide the entire 10A load for a that 2.8us. A 50W load for 2.8us = 140uJ of energy. Recall that the energy stored in a cap is W = C * V^2 / 2 where C is capacitance and V is the voltage. Therefore, we know that capacitor discharges 140uJ of energy. If we say we want no more than 100mV of ripple (2%) equally spaced about 5V (5.05 to 4.95V) then we can calculate C! deltaW = C * V1^2 / 2 - C*V2^2 / 2 -> C = (deltaW/2) / ( V1^2 - V2^2) = (140uJ/2) / (5.05V^2 - 4.95V^2) = 70uF. I then usually multiply this by 3 or 4 - so 270uF seems appropriate - but you want at least 3 100uF caps probably because of your large amount of ripple current (~15A). I'd probably get 5 of these and put them in parallel.

Now the boss/owner is super happy with you... you can build these for about ~$15 in quantity after boards, manufacturing, connectors, and all of the other loose ends are wrapped up. He was hoping to hit $12.50 so he could easily double his money. He might have to charge a bit more, or accept lower margins... but the product is out and the boss / owner is making profits so you're a hero.

Now you know why a good power engineer makes six figures. I will send you a invoice :D
 
Last edited:

Thread Starter

bumba000

Joined Oct 7, 2015
97
Hello Tindel!
Yes I can do this. I can get up to 62kHz. I'm still reading the rest of your post...
Thank You !

EDIT**
You're an amazing dude! Not because of your brains but because of your generosity and your brains. I hope to understand this as well as you do some day. Maybe then I'll be generous enough to lend a hand too.

In the meantime I will build this up and let you know what happens.

Thank You Tindel,
John
 
Last edited:

Thread Starter

bumba000

Joined Oct 7, 2015
97
Ok, so as it turns out - I can get to 100kHz. I have put a cart together at digikey. I'll likely have a tracking number before I get another response but I am still curious to know what's the advantage to using 5 100uF caps as opposed to a single 500uF cap? Please don't mistake my question for questioning your knowledge. I just want to know and haven't found a solid answer yet.

Thanks a bunch again, John
 

tindel

Joined Sep 16, 2012
936
Another good question.

Let's look a bit more at ripple current (I did just glance over it before, didn't I?). Remember this poor output cap is going from charge to discharge every few us. It's discharging at 10A (per your specification) and charging at around 3.5A (per my earlier calculation of average input current (13.5A) minus the load current (10A)). This ends up being a total ripple current of about 13.5A. The highest rated 270uF cap I could find was about 4.5A. Using that cap would cause an electrical fire. But they did have that 100uF cap that was 5.6A rated. If you put 5 in parallel - you have 5*5.6A = 28A capacity. Giving you about 2x margin on your needed ripple current.

A second benefit of using this particular cap is that because it's a nice round number (100uF) that they sell more of them, so they are cheaper.
 

Thread Starter

bumba000

Joined Oct 7, 2015
97
O'kay Tindel. I've already built the circuit using your parts incorrectly once. It didn't work. Nothing smoked and I pulled it all apart. I've made this schematic to gain approval before building again. Can't believe how way off I was when putting all of this together. I've already built a similar circuit out of "around the house" parts and it worked just not like it needs to. I looked at what I built today and compared it to what I built a few weeks ago - face in palms. Wow. Anyways, here's my schematic.

 
Last edited:

GS3

Joined Sep 21, 2007
408
Designing SMPS requires a deep knowledge of every component to the point that when consumer devices started using SMPS instead of traditional PSU there were tons of problems. One of them was caused by electrolytic caps which performed OK at mains low frequency but failed at high SMPS frequencies. Look at this article https://en.wikipedia.org/wiki/Capacitor_plague Millions and millions of power supplies failed over the years because design engineers had neglected to take into account ESR.

Yes, if you run the SMPS at 1000 times the mains frequency then you need a capacitor 1000 times smaller. If the smaller capacitor has 1000 times the ESR and you are putting 1000 times the current then... it's going to fail.

To make things worse miniaturization raises the ESR even higher leading to a decade of exploding capacitors.

Similar thing with inductors. You need to understand them very well. SMPS inductors carry a DC component which traditional transformers do not. Unless the design is very careful it is easy to saturate the core.

The feedback loop of a SMPS is more complex to analyze than that of a linear power supply. Search for *SMPS feedback loop* and you will see what I mean.

It is not realistic to want to try to design or even understand a SMPS without some serious studying.
 

Thread Starter

bumba000

Joined Oct 7, 2015
97
I appreciate your response and I sure don't mind doing some reading ( I'd much rather watch some videos on the subject :)), but I'm building this out of parts that I purchased from DigiKey recommended by user Tindel who seems to have a good bit of experience in the field. What I'm asking is if I'm putting the circuit together properly.

While I'm out reading and waiting on confirmation or correction of my schematic, I do thank you.
 

spinnaker

Joined Oct 29, 2009
7,830
Designing SMPS requires a deep knowledge of every component to the point that when consumer devices started using SMPS instead of traditional PSU there were tons of problems. One of them was caused by electrolytic caps which performed OK at mains low frequency but failed at high SMPS frequencies. Look at this article https://en.wikipedia.org/wiki/Capacitor_plague Millions and millions of power supplies failed over the years because design engineers had neglected to take into account ESR.

Yes, if you run the SMPS at 1000 times the mains frequency then you need a capacitor 1000 times smaller. If the smaller capacitor has 1000 times the ESR and you are putting 1000 times the current then... it's going to fail.

To make things worse miniaturization raises the ESR even higher leading to a decade of exploding capacitors.

Similar thing with inductors. You need to understand them very well. SMPS inductors carry a DC component which traditional transformers do not. Unless the design is very careful it is easy to saturate the core.

The feedback loop of a SMPS is more complex to analyze than that of a linear power supply. Search for *SMPS feedback loop* and you will see what I mean.

It is not realistic to want to try to design or even understand a SMPS without some serious studying.
Excellent feedback GS3. Even someone analog handicapped like me can understand.

Hard to believe that well trained engineers can miss something like that in their design.
 

Thread Starter

bumba000

Joined Oct 7, 2015
97
Feedback loop is where we sample the output and then adjust the output according to our ouput needs. If I have this right so far, it's in the works. I plan to work this in due to a variety of loads that may be connected. The loads will be small heating elements. All will be in the range of 0.2ohm to 1.5ohm. The arduino will test the load before setting the output and then sampling the output and adjusting as needed as the power supply level increases or decreases.

This is very similar to the MAX1523 circuits I've built that operate on 3-5v and put out from 5 to 12. Tiny little chips. The big lesson there was to pickup a breakout board for them. =0)
 
Last edited:

Thread Starter

bumba000

Joined Oct 7, 2015
97
Well several times now I've proof read my schematic and compared it to the other circuits I've already built here. I'm going to say that I have it right and just as soon as I grab a Guiness I'll be plugging in my soldering iron. Thanks for the feedback. ;)
 

tindel

Joined Sep 16, 2012
936
Your schematic is right, but there is still much more to consider. I would NOT do this with any alcohol in my system. You're not talking lethal voltages - but you could still have a fire!
 
Top