How to compute hysteresis resistor in Python using UliEngineering
You can easily compute the feedback resistor value needed to create hysteresis in a comparator circuit using the UliEngineering Python library:
from UliEngineering.Electronics.Hysteresis import hysteresis_resistor
from UliEngineering.EngineerIO import *
# Compute feedback resistor for 10k input resistor, 5V reference, 10% hysteresis
rf = hysteresis_resistor("10k", "5V", 0.10)
print(f"Feedback resistor (10k, 5V, 10% hysteresis): {format_value(rf, 'Ω')}")
# Compute feedback resistor for 100k input resistor, 12V reference, 20% hysteresis
rf = hysteresis_resistor("100k", "12V", 0.20)
print(f"Feedback resistor (100k, 12V, 20% hysteresis): {format_value(rf, 'Ω')}")Example output
Feedback resistor (10k, 5V, 10% hysteresis): 450 kΩ
Feedback resistor (100k, 12V, 20% hysteresis): 400 kΩThe hysteresis resistor (feedback resistor) creates positive feedback in a comparator circuit, establishing two different switching thresholds. This prevents unwanted oscillation or multiple switching when the input signal is near the threshold. The calculation determines the required feedback resistor value based on the input resistor, reference voltage, and desired hysteresis percentage.
The feedback resistor is computed using the formula: $R_f = R_{in} \times \frac{1 - h}{h}$, where $R_f$ is the feedback resistance, $R_{in}$ is the input resistance, and $h$ is the hysteresis percentage. This relationship shows that larger hysteresis requires smaller feedback resistance, and vice versa.
Related posts
- How to compute hysteresis threshold ratios in Python using UliEngineering
- How to compute hysteresis threshold voltages in Python using UliEngineering
- How to compute RC time constant in Python using UliEngineering