Even simpler buck regulator calculation using Python
In Simple buck regulator inductor selection using Python we showcased a Python-based method to mathematically determine suitable inductor ranges.
However, that method requires a lot of parameter to be choosed or entered from the datasheet, which are sometimes not available. Also, sometimes the inductor value is already known (e.g. from a table in the datasheet).
Based on that, the following simplified approach focuses on calculating the inductor current ripple and output voltage ripple for a given set of parameters, using a fixed inductor value.
3V3-Buck-Calculation.py
#!/usr/bin/env python3
# IMPORTANT: We use the valley current limits
from UliEngineering.Electronics.SwitchingRegulator import *
from UliEngineering.EngineerIO import *
Vin = normalize_numeric("12V")
Vout = normalize_numeric("3.3V")
fsw = normalize_numeric("600kHz")
Ioutmax = normalize_numeric("3A")
inductance = normalize_numeric("4.7uH")
Cout = normalize_numeric("22uF")
#
# END OF PARAMETERS
#
inductance_current = buck_regulator_inductor_current(
vin=Vin, vout=Vout, inductance=inductance, frequency=fsw, ioutmax=Ioutmax
)
output_ripple = buck_regulator_output_voltage_ripple(
ripple_current = inductance_current.ripple,
frequency=fsw, capacitance=Cout, esr=1e-3 # Guess for parallel ceramic ESR
)
# Print results
print("Inductance:", format_value(inductance, "H"))
print("\tRipple current: ", format_value(inductance_current.ripple, "A"))
print("\tPeak current: ", format_value(inductance_current.peak, "A"))
print("\nInductor minimal ratings:")
print("\tSaturation current: ", format_value(inductance_current.peak, "A"))
print("\tThermal (RMS) current: ", format_value(inductance_current.rms, "A"))
print("\nRipple with Cout =", format_value(Cout, "F"))
print("\tVoltage ripple (P-P): ", format_value(output_ripple.pp, "V"))
print("\tVoltage ripple (RMS): ", format_value(output_ripple.rms, "V"))Example output
Buck-Calculation-Output.txt
Inductance: 4.70 µH
Ripple current: 848 mA
Peak current: 3.42 A
Inductor minimal ratings:
Saturation current: 3.42 A
Thermal (RMS) current: 3.01 A
Ripple with Cout = 22.0 µF
Voltage ripple (P-P): 8.88 mV
Voltage ripple (RMS): 2.56 mVCheck out similar posts by category:
Electronics
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow