How to compute voltage across resistor in Python using UliEngineering
You can easily compute the voltage dropped across a resistor using Ohm’s law with the UliEngineering Python library:
voltage_across_resistor.py
from UliEngineering.Electronics.Resistors import *
from UliEngineering.EngineerIO import *
# Compute voltage across 1kΩ resistor at 5mA
voltage = voltage_across_resistor("1k", "5mA")
print(f"Voltage across 1kΩ at 5mA: {format_value(voltage, 'V')}")
# Compute voltage across 100Ω resistor at 33mA
voltage = voltage_across_resistor("100Ω", "33mA")
print(f"Voltage across 100Ω at 33mA: {format_value(voltage, 'V')}")Example output
voltage_across_resistor_output.txt
Voltage across 1kΩ at 5mA: 5.00 V
Voltage across 100Ω at 33mA: 3.30 VThe voltage is computed using Ohm’s law: $V = I \times R$
Related posts
- How to compute current through resistor in Python using UliEngineering
- How to compute resistor value from voltage and current in Python using UliEngineering
- How to compute power from current and voltage in Python using UliEngineering
Check out similar posts by category:
Electronics, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow