Simple buck regulator inductor selection using Python

The following example shows how to compute the ideal, minimum and maximum inductance for a buck regulator using Python and the UliEngineering library.

In our example, we use a LMR36006-Q1 from Texas instruments. Note that the formula is virtually the same for pretty much all modern buck regulators you can buy, from the cheapest Chinese to the rad-hardened space parts.

First, install UliEngineering using

pip install -U UliEngineering

Now you can use the following code to compute the inductor values

#!/usr/bin/env python3
from UliEngineering.Electronics.SwitchingRegulator import *
from UliEngineering.EngineerIO import *

Vin = normalize_numeric("48V")
Vout = normalize_numeric("24V")
fsw = normalize_numeric("750kHz")
Ioutmax = normalize_numeric("5A")

#
# Optional parameters
#

# How much ripple voltage is acceptable?
# The output voltage will swing by 1/2 of the ripple voltage
# on either side of the average output voltage
# If unsure, use 0.04 * Vout (conservative)
# Choosing a larger value will make it easier to find
# suitable components
output_voltage_ripple = 0.01 * Vout

# Switch current limits.
# Lookup the min/nom/max switch current limits in the datasheet!
# This is different for every IC and there is no good way to guess it!
# If you only have nominal values, set min to nominal*85% and max to nominal*120%
# to account for temperature coefficients and tolerances.
min_switch_current = 6.3
max_switch_current = 8.8

# Light load current is used to calculate the capacitance
# You can use 5% of the maximum output current if you are unsure
light_load_current = 0.05 * Ioutmax

# Safety factors
# Exceeding the saturation current rating of the inductor
# will cause hard saturation for ferrite core inductors.
# Therefore, this safety factor should be conservative (e.g. 20% = 1.2)
saturation_curent_rating_safety_factor = 1.2
# The RMS current rating only affects thermal performance
# Therefore, this safety factor can be lower (e.g. 10% = 1.1)
rms_current_rating_safety_factor = 1.1
# Recommended ripple current rating
# safety factor for the output capacitors
# (applied to the calculated inductor ripple current)
# This is a thermal rating factor.
output_capacitor_ripple_current_safety_factor = 1.1

#
# END OF PARAMETERS
#

abs_max_inductance = buck_regulator_inductance(Vin, Vout, fsw, Ioutmax, K=0.1)
max_inductance = buck_regulator_inductance(Vin, Vout, fsw, Ioutmax, K=0.2)
optimal_inductance = buck_regulator_inductance(Vin, Vout, fsw, Ioutmax, K=0.3)
min_inductance = buck_regulator_inductance(Vin, Vout, fsw, Ioutmax, K=0.4)

# Another minimum inductance based on the desire to avoid subharmonic oscillation
# This highly depends on the IC in use, check the datasheet for more information
# Example is for LMR36006 from Texas Instruments
min_inductance_osc = 0.28 * Vout/fsw

# Compute peak, RMS and ripple current for the different inductances
abs_max_inductance_current = buck_regulator_inductor_current(
    Vin, Vout, abs_max_inductance, fsw, Ioutmax
)
max_inductance_current = buck_regulator_inductor_current(
    Vin, Vout, max_inductance, fsw, Ioutmax
)
optimal_inductance_current = buck_regulator_inductor_current(
    Vin, Vout, optimal_inductance, fsw, Ioutmax
)
min_inductance_current = buck_regulator_inductor_current(
    Vin, Vout, min_inductance, fsw, Ioutmax
)

# Compute saturation current rating for the inductors
abs_max_inductance_rms_current = abs_max_inductance_current.rms * saturation_curent_rating_safety_factor
max_inductance_rms_current = max_inductance_current.rms * saturation_curent_rating_safety_factor
optimal_inductance_rms_current = optimal_inductance_current.rms * saturation_curent_rating_safety_factor
min_inductance_rms_current = min_inductance_current.rms * saturation_curent_rating_safety_factor

# Compute RMS (thermal) current rating for the different inductances
abs_max_inductance_rms_current = abs_max_inductance_current.rms * rms_current_rating_safety_factor
max_inductance_rms_current = max_inductance_current.rms * rms_current_rating_safety_factor
optimal_inductance_rms_current = optimal_inductance_current.rms * rms_current_rating_safety_factor
min_inductance_rms_current = min_inductance_current.rms * rms_current_rating_safety_factor

# Calculate the peak inductor current rating
abs_max_inductance_peak_current = abs_max_inductance_current.peak
max_inductance_peak_current = max_inductance_current.peak
optimal_inductance_peak_current = optimal_inductance_current.peak
min_inductance_peak_current = min_inductance_current.peak

# Calculate ripple current for each inductance value
abs_max_inductance_ripple = buck_regulator_inductor_ripple_current(Vin, Vout, abs_max_inductance, fsw, Ioutmax)
max_inductance_ripple = buck_regulator_inductor_ripple_current(Vin, Vout, max_inductance, fsw, Ioutmax)
optimal_inductance_ripple = buck_regulator_inductor_ripple_current(Vin, Vout, optimal_inductance, fsw, Ioutmax)
min_inductance_ripple = buck_regulator_inductor_ripple_current(Vin, Vout, min_inductance, fsw, Ioutmax)

# Compute the minimum capacitance required to meet the output voltage ripple
abs_max_inductance_capacitance = buck_regulator_min_capacitance(
    abs_max_inductance_ripple,
    output_voltage_ripple,
    fsw,
    abs_max_inductance,
    Vout,
    Ioutmax,
    light_load_current
)

max_inductance_capacitance = buck_regulator_min_capacitance(
    max_inductance_ripple,
    output_voltage_ripple,
    fsw,
    max_inductance,
    Vout,
    Ioutmax,
    light_load_current
)

optimal_inductance_capacitance = buck_regulator_min_capacitance(
    optimal_inductance_ripple,
    output_voltage_ripple,
    fsw,
    optimal_inductance,
    Vout,
    Ioutmax,
    light_load_current
)

min_inductance_capacitance = buck_regulator_min_capacitance(
    min_inductance_ripple,
    output_voltage_ripple,
    fsw,
    min_inductance,
    Vout,
    Ioutmax,
    light_load_current
)

# Compute the maximum ESR of the capacitor
abs_max_inductance_esr = buck_regulator_output_capacitor_max_esr(output_voltage_ripple, abs_max_inductance_ripple)
max_inductance_esr = buck_regulator_output_capacitor_max_esr(output_voltage_ripple, max_inductance_ripple)
optimal_inductance_esr = buck_regulator_output_capacitor_max_esr(output_voltage_ripple, optimal_inductance_ripple)
min_inductance_esr = buck_regulator_output_capacitor_max_esr(output_voltage_ripple, min_inductance_ripple)

# Compute the output capacitor RMS current
abs_max_inductance_cap_rms = buck_regulator_output_capacitor_rms_current(Vin, Vout, abs_max_inductance, fsw)
max_inductance_cap_rms = buck_regulator_output_capacitor_rms_current(Vin, Vout, max_inductance, fsw)
optimal_inductance_cap_rms = buck_regulator_output_capacitor_rms_current(Vin, Vout, optimal_inductance, fsw)
min_inductance_cap_rms = buck_regulator_output_capacitor_rms_current(Vin, Vout, min_inductance, fsw)

# Compute the output capacitor ripple current
abs_max_inductance_cap_ripple = abs_max_inductance_current.ripple * output_capacitor_ripple_current_safety_factor
max_inductance_cap_ripple = max_inductance_current.ripple * output_capacitor_ripple_current_safety_factor
optimal_inductance_cap_ripple = optimal_inductance_current.ripple * output_capacitor_ripple_current_safety_factor
min_inductance_cap_ripple = min_inductance_current.ripple * output_capacitor_ripple_current_safety_factor

# Compute the output

# Compute saturation current rating for the inductors
# NOTE: Low safety factor due to usage of maximum
# switch current which has a safety factor included
# This safety factor is mostly to compensate for an inductor +-10% tolerance
saturation_current_safety_factor = 1.1 
abs_max_inductance_saturation_current = max(abs_max_inductance_peak_current, max_switch_current) * saturation_current_safety_factor
max_inductance_saturation_current = max(max_inductance_peak_current, max_switch_current) * saturation_current_safety_factor
optimal_inductance_saturation_current = max(optimal_inductance_peak_current, max_switch_current) * saturation_current_safety_factor
min_inductance_saturation_current = max(min_inductance_peak_current, max_switch_current) * saturation_current_safety_factor

# Compute the catch diode power rating
catch_diode_power = buck_regulator_catch_diode_power(Vin, Vout, Ioutmax, fsw)

# Print results
print("Absolute maximum inductance (K=0.1):", format_value(abs_max_inductance, "H"), 
    "with Isat >=", format_value(abs_max_inductance_saturation_current, "A"), 
    "& Irms >= ", format_value(abs_max_inductance_rms_current, "A"))
print("\tRipple current: ", format_value(abs_max_inductance_ripple, "A"))
print("\tPeak current: ", format_value(abs_max_inductance_peak_current, "A"))
print("\tMin Capacitance: ", format_value(abs_max_inductance_capacitance, "F"), "for ripple voltage", format_value(output_voltage_ripple, "V"))
print("\tMax Capacitor ESR: ", format_value(abs_max_inductance_esr, "Ω"))
print("\tCapacitor RMS current: ", format_value(abs_max_inductance_cap_rms, "A"))
print("\tRecommended capacitor ripple current rating: ", format_value(abs_max_inductance_cap_ripple, "A"))

print("Maximum inductance (K=0.2):", format_value(max_inductance, "H"), 
    "with Isat >=", format_value(max_inductance_saturation_current, "A"), 
    "& Irms >= ", format_value(max_inductance_rms_current, "A"))
print("\tRipple current: ", format_value(max_inductance_ripple, "A"))
print("\tPeak current: ", format_value(max_inductance_peak_current, "A"))
print("\tMin Capacitance: ", format_value(max_inductance_capacitance, "F"), "for ripple voltage", format_value(output_voltage_ripple, "V"))
print("\tMax Capacitor ESR: ", format_value(max_inductance_esr, "Ω"))
print("\tCapacitor RMS current: ", format_value(max_inductance_cap_rms, "A"))
print("\tRecommended capacitor ripple current rating: ", format_value(max_inductance_cap_ripple, "A"))

print("Optimal inductance (K=0.3):", format_value(optimal_inductance, "H"), 
    "with Isat >=", format_value(optimal_inductance_saturation_current, "A"), 
    "& Irms >= ", format_value(optimal_inductance_rms_current, "A"))
print("\tRipple current: ", format_value(optimal_inductance_ripple, "A"))
print("\tPeak current: ", format_value(optimal_inductance_peak_current, "A"))
print("\tMin Capacitance: ", format_value(optimal_inductance_capacitance, "F"), "for ripple voltage", format_value(output_voltage_ripple, "V"))
print("\tMax Capacitor ESR: ", format_value(optimal_inductance_esr, "Ω"))
print("\tCapacitor RMS current: ", format_value(optimal_inductance_cap_rms, "A"))
print("\tRecommended capacitor ripple current rating: ", format_value(optimal_inductance_cap_ripple, "A"))

print("Minimum inductance (K=0.4):", format_value(min_inductance, "H"), 
    "with Isat >=", format_value(min_inductance_saturation_current, "A"), 
    "& Irms >= ", format_value(min_inductance_rms_current, "A"))
print("\tRipple current: ", format_value(min_inductance_ripple, "A"))
print("\tPeak current: ", format_value(min_inductance_peak_current, "A"))
print("\tMin Capacitance: ", format_value(min_inductance_capacitance, "F"), "for ripple voltage", format_value(output_voltage_ripple, "V"))
print("\tMax Capacitor ESR: ", format_value(min_inductance_esr, "Ω"))
print("\tCapacitor RMS current: ", format_value(min_inductance_cap_rms, "A"))
print("\tRecommended capacitor ripple current rating: ", format_value(min_inductance_cap_ripple, "A"))

print()
print("Minimum inductance to avoid subharmonic oscillation: ", format_value(min_inductance_osc, "H"))
print()
print("Catch diode power rating (if any catch diode is required):", format_value(catch_diode_power, "W"))

Example output:

Absolute maximum inductance (K=0.1): 32.0 µH with Isat >= 9.68 A & Irms >=  5.50 A
        Ripple current:  500 mA
        Peak current:  5.25 A
        Min Capacitance:  138 µF for ripple voltage 240 mV
        Max Capacitor ESR:  480 mΩ
        Capacitor RMS current:  144 mA
        Recommended capacitor ripple current rating:  550 mA
Maximum inductance (K=0.2): 16.0 µH with Isat >= 9.68 A & Irms >=  5.51 A
        Ripple current:  1.00 A
        Peak current:  5.50 A
        Min Capacitance:  69.1 µF for ripple voltage 240 mV
        Max Capacitor ESR:  240 mΩ
        Capacitor RMS current:  289 mA
        Recommended capacitor ripple current rating:  1.10 A
Optimal inductance (K=0.3): 10.7 µH with Isat >= 9.68 A & Irms >=  5.52 A
        Ripple current:  1.50 A
        Peak current:  5.75 A
        Min Capacitance:  46.1 µF for ripple voltage 240 mV
        Max Capacitor ESR:  160 mΩ
        Capacitor RMS current:  433 mA
        Recommended capacitor ripple current rating:  1.65 A
Minimum inductance (K=0.4): 8.00 µH with Isat >= 9.68 A & Irms >=  5.54 A
        Ripple current:  2.00 A
        Peak current:  6.00 A
        Min Capacitance:  34.5 µF for ripple voltage 240 mV
        Max Capacitor ESR:  120 mΩ
        Capacitor RMS current:  577 mA
        Recommended capacitor ripple current rating:  2.20 A

Minimum inductance to avoid subharmonic oscillation:  8.96 µH

Catch diode power rating (if any catch diode is required): 1.93 W

Note that in order for the circuit to be short-circuit-proof, choose the inductor saturation current to be at least the switch currentl limit of the regulator (this is not included in the code above). For additional safety and considering the tolerance of both the inductor and the switch current rating, I recommend to add a safety margin of 20% to the saturation current rating.

As you can see, the subharmonic oscillator minimum value is rather irrelevant since it’s two orders of magnitude smaller that the “Minimum inductance” value based on ripple current.

Also check out the documentation of buck_regulator_inductance() and other functions from UliEngineering.Electronics.SwitchingRegulator for reference:

Compute the optimal inducitivity of a buck regulator

This formula is based on the the inductor ripple current fraction [K].

The formula we use is:

L = ((vin - vout) * (vout) / (f * K * Ioutmax)) * (Vout/Vin)

(note that Vout/Vin is an estimation for the duty cycle.)

A good assumption which is shared by most major manufacturers is
to choose the inductor value in between K=0.2 and K=0.4.
Typically, the best inductor value is around K=0.3,
but one depends 

It is generally recommended by the more verbose datasheets, to alwas choose
the inductor larger than the value obtained with K=0.1. This is due to the
current mode control scheme which requires a certain level of inductor ripple.

Note that many datasheets also specify minimum inductor values to avoid
subharmonic oscillations. This depends on the part and varies by more than
and order of magnitude and is not handled by the function.

For reference see e.g. TI at https://www.ti.com/lit/ds/symlink/lmr36006.pdf#page=22,
section 9.2.1.2.4: Inductor Selection.