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

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

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

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

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

Example output

next_higher_resistor_output.txt
Next higher than 1.5k: 1.58 kΩ
Next higher than 100Ω (E24): 110 Ω

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


Check out similar posts by category: Electronics, Python