Skip to content

Instantly share code, notes, and snippets.

@jwcooper
Last active September 27, 2015 22:37
Show Gist options
  • Save jwcooper/1342329 to your computer and use it in GitHub Desktop.
Save jwcooper/1342329 to your computer and use it in GitHub Desktop.
<SCRIPT LANGUAGE="JavaScript">
function calcBoost(form) {
vinmax=eval(form.vinmax.value);
vinmin=eval(form.vinmin.value);
voutmax=eval(form.voutmax.value);
voutmin=eval(form.voutmin.value);
freq=eval(form.freq.value);
iout=eval(form.iout.value);
vripple = eval(form.vripple.value);
// calculate duty cycle
minduty = 100*(1-vinmax / voutmin);
maxduty = 100*(1-vinmin / voutmax);
form.minduty.value = minduty;
form.maxduty.value = maxduty;
// calculate inductor values: D*Vin * (1-D) / (freq * 2 * Iout ) < L
// for vinmin and voutmin
D1 = (1-vinmin / voutmin);
L1 = D1 * vinmin * (1-D1) / (freq * 2 *iout);
// calculate for vinmin and voutmax
D2 = (1-vinmin / voutmax);
L2 = D2 * vinmin * (1-D2) / (freq * 2 *iout);
// calculate for vinmax and voutmin
D3 = (1.0-vinmax / voutmin);
L3 = D3 * vinmax * (1-D3) / (freq * 2 *iout);
// for vinmax and voutmax
D4 = (1.0-vinmax / voutmax);
L4 = D4 * vinmax * (1.0-D4) / (freq * 2.0 *iout);
L = Math.max(L1, L2, L3, L4);
form.minL.value = L * 1000000;
// Calculate peak current Ipk = (Vin * D)/(f * L)
// for vinmin and voutmin
Ipk1 = vinmin * D1 / (freq * L);
// for vinmin and voutmax
Ipk2 = vinmin * D2 / (freq * L);
// for vinmax and voutmin
Ipk3 = vinmax * D3 / (freq * L);
// for vinmax and coutmax
Ipk4 = vinmax * D4 / (freq * L);
Ipk = Math.max(Ipk1, Ipk2, Ipk3, Ipk4);
form.ipk.value = Ipk;
// Find the minimum capacitor Cap > Iout / (Vripple * freq)
cap = iout / (vripple * freq);
form.cap.value = cap * 1000000;
form.vdiode.value = voutmax;
form.idiode.value = Ipk;
}
</script>
<div class="textblock"> <!-- InstanceBeginEditable name="text" -->
<form>
<div align="center">
<table width="75%" border=2 cellpadding=3>
<tr>
<td width="16%" align="center"><strong>Frequency</strong></td>
<td width="18%"><div align="center">
<input type="text" name="freq" value="31250" size=10>
Hz</div></td>
<td width="66%">This is the boost converter frequency. For microcontrollers its often the CPU clock / 256 </tr>
<tr>
<td align="center"><strong>Min Vin</strong></td>
<td><div align="center">
<input type="text" name="vinmin" value="9" size=10>
V</div></td>
<td>The lowest expected input voltage </tr>
<tr>
<td align="center"><strong>Max Vin</strong></td>
<td><div align="center">
<input type="text" name="vinmax" value="12" size=10>
V </div></td>
<td>The highest expected input voltage </tr>
<tr>
<td align="center"><strong>Min Vout</strong></td>
<td><div align="center">
<input type="text" name="voutmin" value="30" size=10>
V</div></td>
<td>The lowest desired output voltage </tr>
<tr>
<td align="center"><strong>Max Vout</strong></td>
<td><div align="center">
<input type="text" name="voutmax" value="60" size=10>
V</div></td>
<td>The highest desired output voltage </tr>
<tr>
<td align="center"><strong>Iout</strong></td>
<td><div align="center">
<input type="text" name="iout" value="0.020" size=10>
Amps</div></td>
<td>Output current draw </tr>
<tr>
<td align="center"><strong>Vripple</strong></td>
<td><div align="center">
<input type="text" name="vripple" value="0.1" size=10>
V
</div></td>
<td>Maximum allowable voltage ripple </tr>
</table>
</div>
<p align="center"><br>
<input type=button value="Calculate!" onclick="calcBoost(this.form)">
</p>
<div align="center"> <table width="100%" border="1" cellpadding="10">
<tr>
<th width="26%" scope="row">Min. Duty Cycle</th>
<td width="56%"><strong>D</strong>min<strong> = 1 - (Vi</strong>max<strong>/Vo</strong>min<strong>)</strong></td>
<td width="18%"><div align="center">
<input name=minduty type=text value="" size="2" maxlength="2" > %
</div></td>
</tr>
<tr>
<th scope="row">Max. duty cycle</th>
<td><strong>D</strong>max<strong> = 1 - (Vi</strong>min<strong>/Vo</strong>max<strong>)</strong></td>
<td><div align="center">
<input name=maxduty type=text value="" size="2" maxlength="2" > %
</div></td>
</tr>
<tr>
<th scope="row">Min. Inductor size</th>
<td><strong> L &gt; D</strong><strong> * Vin * (1-D) / (freq * 2 * Iout ) </strong></td>
<td><div align="center">
<input name=minL type=text value="" size="5" maxlength="5" > uH
</div></td>
</tr>
<tr>
<th scope="row">Peak inductor current</th>
<td><strong>Ipk = (Vin</strong>max<strong> * D)/(f * L)</strong></td>
<td><div align="center">
<input name=ipk type=text value="" size="5" maxlength="5" > A
</div></td>
</tr>
<tr>
<th scope="row">Minimum capacitor</th>
<td><strong>Cap &gt; Iout / (Vripple * freq)</strong></td>
<td><div align="center">
<input name=cap type=text value="" size="5" maxlength="5" >
uF
</div></td>
</tr>
<tr>
<td align="center"><strong>Minimum Schottky diode</strong></td>
<td>Vbreakdown &gt;= Voutmax &amp; Idiode &gt;=Ipk</td>
<td><div align="center">
<input type="text" name="vdiode" value="" size=2>
V
<input type="text" name="idiode" value="" size=2>
A </div>
</tr>
</table>
</div>
</form>
<p>Don't forget that Duty cycle is the amount of time the switch is <strong>off</strong> / output is low. Be sure to measure the output voltages before connecting up anything important! </p>
<p>We like the J&amp;W Miller / Bourns RLB9012 inductors and other thru-hole from the same company</p>
<p><a href="http://web.jfet.org/inGrid/">Thanks to Riad for some of the math!</a></p>
<!-- InstanceEndEditable --> </div>
<!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat --><div class="wikiinclude">
<!-- InstanceBeginEditable name="wikispace" --><!-- InstanceEndEditable -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment