How to compute voltage divider current in Python using UliEngineering

You can easily compute the current flowing through a voltage divider using the UliEngineering Python library:

voltage_divider_current.py
from UliEngineering.Electronics.VoltageDivider import *
from UliEngineering.EngineerIO import *

# Compute current for 10k and 10k resistors at 5V input
current = voltage_divider_current("5V", "10k", "10k")
print(f"Current through 10k+10k divider at 5V: {format_value(current, 'A')}")

# Compute current for 1k and 9k resistors at 12V input
current = voltage_divider_current("12V", "1k", "9k")
print(f"Current through 1k+9k divider at 12V: {format_value(current, 'A')}")

Example output

voltage_divider_current_output.txt
Current through 10k+10k divider at 5V: 250 µA
Current through 1k+9k divider at 12V: 1.20 mA

The current is computed using Ohm’s law: $I = \frac{V_{in}}{R_{top} + R_{bottom}}$


Check out similar posts by category: Electronics, Python