# 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

``````from UliEngineering.Electronics.SwitchingRegulator import *
from UliEngineering.EngineerIO import *

Vout = normalize_numeric("5V")
fsw = normalize_numeric("2.2MHz")

abs_max_inductance = buck_regulator_inductance("48V", Vout, fsw, "300mA", K=0.1)
max_inductance = buck_regulator_inductance("48V", Vout, fsw, "300mA", K=0.2)
optimal_inductance = buck_regulator_inductance("48V", Vout, fsw, "300mA", K=0.3)
min_inductance = buck_regulator_inductance("48V", Vout, fsw, "300mA", 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

print("Absolute maximum inductance: ", format_value(abs_max_inductance, "H"))
print("Maximum inductance: ", format_value(max_inductance, "H"))
print("Optimal inductance: ", format_value(optimal_inductance , "H"))
print("Minimum inductance: ", format_value(min_inductance, "H"))
print("Minimum inductance to avoid subharmonic oscillation: ", format_value(min_inductance_osc, "H"))
``````

This code will output the following values:

``````Absolute maximum inductance:  339 µH
Maximum inductance:  170 µH
Optimal inductance:  113 µH
Minimum inductance:  84.8 µH
Minimum inductance to avoid subharmonic oscillation:  636 nH
``````

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()` 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.
``````