2009/9/23 Olin Lathrop : > Jesse Lackey wrote: >> This all worked, but I had to manually "tune" the PWM signal for best >> efficiency and ensure it could boost to 70V @ the 3V minimum input >> voltage. =A0By adjusting duty cycle and frequency one could see when the >> inductor was saturating, and how efficiency was poor at low frequency, >> then got pretty decent within a range, and then poor again as the >> frequency went up. >> >> All kind of fun, but I'd certainly rather have a set of equations to >> come up with duty cycle and frequency given voltage in range/out >> range/output current range/inductor value & current spec, etc. =A0At >> least >> know good starting points for duty cycle/frequency and around what >> inductor specs are going to be required for a given design to know if >> cost/performance is going to be reasonable prior to building a board. > > I'm not sure what you're asking since the equations are the same whether a > microcontroller produces the switching pulses or some other electronics > does. =A0The guiding equation for inductive switching power supply is: > > =A0 =A0 =A0 =A0 Volt Sec > =A0Amps =3D -------- > =A0 =A0 =A0 =A0 Henries > > In other words, if you know any three of applied voltage to a inductor, t= he > length of time that voltage is applied, the inductance, and the resulting > change in inductor current, you can find the fourth. > > For a micro to control a switching power supply directly from firmware, we > want switching edges to be a few uS apart. =A0Just to see where we're at, > let's see what size inductor would charge up to 1/4 amp from 3V in 10uS: > > =A0 =A0 =A0 =A0 =A0 =A0Volt Sec =A0 3V 10uS > =A0Henries =3D -------- =3D ------- =3D 120uH > =A0 =A0 =A0 =A0 =A0 =A0 =A0Amps =A0 =A0 =A0250mA > > OK, that's not way out of line so a 100uH inductor should be quite usable. > That's a common value and finding one with at least 500mA saturation curr= ent > will be no problem. =A0So now that we've tentatively decided on 100uH 500= mA > inductor, let's see what the longest guaranteed not to saturate switch on > time is. =A0Obviously, this needs to be computed at the maximum input vol= tage, > which you said previous was 4.2V: > > =A0 =A0 =A0 =A0Amp Henries =A0 500mA 100uH > =A0Sec =3D ----------- =3D ----------- =3D 11.9uS > =A0 =A0 =A0 =A0 =A0 Volts =A0 =A0 =A0 =A0 =A04.2V > > So this tells us that as long as the firmware never leaves the switch on = for > more than 11uS, and the inductor current starts out at zero, we are safe = and > the inductor won't saturate. =A0Let's say the controller is a 10F204 where > each instruction cycle is 1us, so that would be 11 instruction cycles. > That's actually a fairly long time, but then again that is the max > saturation limit. =A0Nothing says we have to charge up the inductor to 50= 0mA > each pulse, and there are some reasons not to. > > We'll likely use a NPN switch, since FETs that can handle 70V aren't going > to switch well with only 3V on the base. =A0The downside of a bipolar is = you > have to keep feeding it enough base current to stay in saturation. =A0Let= 's > say you can get a NPN that can withstand the voltage with a guaranteed ga= in > of at least 40 (I haven't checked, but that sounds about right). =A0If you > wanted to max out the inductor at 500mA, the would require 500mA / 40 =3D > 12.5mA base current to keep the transistor saturated. =A0At least that's > easily doable from a PIC pin, since those are rated for twice that curren= t. > I wouldn't actually run the transistor at the limit, since there will be > some rise in C-E voltage. > > I don't want to write a book here, so I'm going to cut short a few thought > processes. =A0Let's just pick 6uS as the inductor on time, and we'll use a > pulse on demand system. =A0Whenever the output voltage goes below its > regulation threshold, the micro will produce a 6uS (6 instruction cycle) > pulse. > > Note how each time we pick a parameter, we can feed that into the equatio= ns > and nail down something else more tightly. =A0At this point we've decided= to > use a 100uH inductor, a NPN grounded emitter switch with a minimum > guaranteed current gain of 40, and a fixed size 6uS pulse on demand contr= ol > system. =A0Now we go back and find what our highest inductor current can = be: > > =A0 =A0 =A0 =A0 Volt Sec =A0 4.2V 6uS > =A0Amps =3D -------- =3D -------- =3D 252mA > =A0 =A0 =A0 =A0 Henries =A0 =A0 =A0100uH > > 1/4 amp is going to be no problem for finding a inductor or transistor, so > that all looks good. =A0To keep the transistor saturated, it needs 252mA = / 40 > =3D 6.3mA base current. =A0Obviously we want a little more for margin and= to > keep the saturate voltage low. =A010mA sounds like a nice number given the > circumstances. > > Here's something that might not be obvious. =A0The limiting case for base > current is the lowest input voltage, not the highest. =A0You might think = it > doesn't matter because the inductor current will scale linearly with input > voltage, so proportionately less base current is needed as the input volt= age > goes lower. =A0However, there is a larger fixed offset subtracted from the > base current drive voltage than from the inductor drive voltage. =A0This = is > because the voltage accross the base resistor is the supply voltage minus > the fixed B-E drop of the transistor, whereas the inductor charge voltage= is > the supply voltage minus only the transistor saturated on voltage. =A0The= net > effect is that the base current scales down more quickly as the supply > voltage drops than the inductor current does. =A0So we need to know what > current the transistor must sustain at 3V: > > =A0 =A0 =A0 =A0 Volt Sec =A0 3.0V 6uS > =A0Amps =3D -------- =3D -------- =3D 180mA > =A0 =A0 =A0 =A0 Henries =A0 =A0 =A0100uH > > 180mA / 40 =3D 4.5mA minimum required base current with 3V supply. =A0Let= 's say > 700mV is lost between the B-E drop of the transistor and the high side > output pin driver in the PIC. =A0That leaves 3.0V - 700mV =3D 2.3V accros= s the > base resistor. =A02.3V / 4.5mA =3D 511 ohms. =A0We of course want to buil= d in some > margin and keep the saturation voltage down. =A0360ohms sounds like a nice > number. =A0That provides 30% margin. > > Now we need to do a sanity check at the maximum supply voltage. =A0Again = let's > assume 700mV is lost that is not applied accross the base resistor. =A0(4= .2V - > 700mV) / 360ohms =3D 9.7mA. =A0That's real close to the 10mA we thought s= ounded > nice earlier, so that checks fine. > > I'd add another minor detail to speed up the switching transitions a litt= le. > At 6uS on it's not a big deal, but a $.01 part can help things just a > little. =A0Turning the transistor on isn't a issue since the inductor cur= rent > starts out at 0 anyway. =A0The base current will build up to its steady v= alue > much faster than any appreciable inductor current will. =A0However, we wa= nt to > make the transistor switch off as fast as possible. =A0Grounding its base= via > a 360 ohm resistor is actually not that bad, but we can still speed it up > with a small capacitor in parallel accross the base resistor. =A0The resi= stor > alone will probably turn off the transistor within about 100nS. =A0To see > where we're at, let's see what capacitance would result in a 100nS time > constant, meaning about 2/3 of the effect is over in 100nS. =A0100nS / 36= 0ohms > =3D 278pF. =A0Hmm, that sounds too big. =A0Make it 100pF. =A0That results= in a time > constant of 100pF * 360ohms =3D 36nS. > > Normally you have to consider the inductor discharge time. =A0In this case > it's obvious from casual observation it's not a issue given the 70V outpu= t, > but let's do the calculation anyway just to show it: > > =A0 =A0 =A0 =A0Amp Henries =A0 252mA 100uH > =A0Sec =3D ----------- =3D ----------- =3D 383nS > =A0 =A0 =A0 =A0 =A0 Volts =A0 =A0 =A070V - 4.2V > > which is well under a single instruction cycle. =A0Or put another way, the > inductor current is guaranteed to reach 0 with the switch off for just one > instruction cycle. > > Of course the above is only true during normal operation when the output > voltage is already around 70V. =A0Startup is a whole other issue. =A0This= is one > of the advantages of having a micro. =A0You can easily use a different > algorithm and different parameters during startup than during normal > operation. =A0I don't feel like getting into startup here, but it's somet= hing > that has to be considered. > > So the 10F204 code for the normal operating loop looks like this: > > loop > =A0 =A0 =A0 =A0 skip_low =A0 =A0 =A0 =A0 =A0 =A0;output below regulation = threshold ? > =A0 =A0 =A0 =A0 goto =A0 =A0loop =A0 =A0 =A0 =A0;no, go back and check ag= ain > > =A0 =A0 =A0 =A0 switch_on =A0 =A0 =A0 =A0 =A0 ;turn on the switching elem= ent > =A0 =A0 =A0 =A0 nop > =A0 =A0 =A0 =A0 nop > =A0 =A0 =A0 =A0 nop > =A0 =A0 =A0 =A0 nop > =A0 =A0 =A0 =A0 nop > =A0 =A0 =A0 =A0 switch_off =A0 =A0 =A0 =A0 =A0;turn off switch 6uS later > =A0 =A0 =A0 =A0 goto =A0 =A0loop =A0 =A0 =A0 =A0;back to wait for output = low again > > SKIP_LO, SWITCH_ON, and SWITCH_OFF are macros that expand to single > instructions. =A0It's a good idea to add that layer of abstraction. =A0It > separates the control algorithm from the details of how that particular > project is wired to the micro. > > Now we can calculate the maximum output current the supply can maintain > voltage regulation with. =A0From the code above it should be obvious that > there is a minimum of 4uS between the fixed size 6uS pulses, for a maximum > pulse repetition period of 10uS, and a maximum pulse rate of 100KHz. > > At the lowest specified input supply voltage, we calculated earlier the > inductor charges to a maximum of 180mA. =A0This was assuming no switch lo= ss, > but let's see what the best possible case is and scale back from there. = =A01/2 > * (180mA)**2 * 100uH =3D 1.62uJ, x 100KHz =3D 162mW, / 70V =3D 2.3mA. =A0= Obviously > we're not going to get 100%, but certainly this supply will be good for at > least 1mA. =A0Since the spec said "miniscule" (rant about bad engineering > suppressed), we can claim we're done. > >> I have to admit I spent only 1 or 2 evenings online reading and >> looking >> at dc/dc design info before just tuning it for the particular design I >> had in front of me. > > The calculations above took way longer to describe than to do. =A0A coupl= e of > minutes with a calculator is all it should take to get to this stage. > > > ******************************************************************** > Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products > (978) 742-9014. =A0Gold level PIC consultants since 2000. > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > Bloody good post Olin! RP -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist