How to find the next lower standard resistor value in Python using UliEngineering

You can easily find the next lower standard resistor value using the UliEngineering Python library:

next_lower_resistor.py
from UliEngineering.Electronics.Resistors import *
from UliEngineering.EngineerIO import *

# Find next lower E96 resistor value for 1.5k
resistor = next_lower_resistor("1.5k")
print(f"Next lower than 1.5k: {format_value(resistor, 'Ω')}")

# Find next lower E24 resistor value for 120Ω
resistor = next_lower_resistor("120Ω", sequence=e24)
print(f"Next lower than 120Ω (E24): {format_value(resistor, 'Ω')}")

Example output

next_lower_resistor_output.txt
Next lower than 1.5k: 1.47 kΩ
Next lower than 120Ω (E24): 100 Ω

The next_lower_resistor() function finds the next lower standard resistor value from the specified E-series (default is E96).


Check out similar posts by category: Electronics, Python