Como calcular resistores do divisor de tensão por razão em Python usando UliEngineering
Você pode calcular facilmente o resistor superior de um divisor de tensão dado o valor do resistor inferior e a razão de divisão usando a biblioteca Python UliEngineering:
Σ
TechOverflow calculators:
You can enter values with SI suffixes like 12.2m (equivalent to 0.012) or 14k (14000) or 32u (0.000032).
The results are calculated while you type and shown directly below the calculator, so there is no need to press return or click on a Calculate button.
You can enter values with SI suffixes like 12.2m (equivalent to 0.012) or 14k (14000) or 32u (0.000032).
The results are calculated while you type and shown directly below the calculator, so there is no need to press return or click on a Calculate button.
Ω
⚠
⚠
top_resistor_by_ratio.py
from UliEngineering.Electronics.VoltageDivider import *
from UliEngineering.EngineerIO import *
# Calcular resistor superior para divisor de tensão 1:2 com resistor inferior de 10k
rtop = top_resistor_by_ratio("10k", 0.5)
print(f"Top resistor (ratio 0.5, bottom 10k): {format_value(rtop, 'Ω')}")
# Calcular resistor superior para divisor de tensão 1:10 com resistor inferior de 1k
rtop = top_resistor_by_ratio("1k", 0.1)
print(f"Top resistor (ratio 0.1, bottom 1k): {format_value(rtop, 'Ω')}")Exemplo de saída
top_resistor_by_ratio_output.txt
Top resistor (ratio 0.5, bottom 10k): 10.0 kΩ
Top resistor (ratio 0.1, bottom 1k): 9.00 kΩO resistor superior é calculado usando a fórmula: $R_{top} = R_{bottom} \times (\frac{1}{ratio} - 1)$, onde a razão é $V_{out}/V_{in}$.
Check out similar posts by category:
Calculators, 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