How to compute hysteresis threshold voltages in Python using UliEngineering
You can easily compute the hysteresis threshold voltages using the UliEngineering Python library:
hysteresis_threshold_voltages.py
from UliEngineering.Electronics.Hysteresis import hysteresis_threshold_voltages
from UliEngineering.EngineerIO import *
# Compute threshold voltages for 5V reference with 10% hysteresis
low_v, high_v = hysteresis_threshold_voltages("5V", 0.10)
print(f"Low threshold (5V, 10% hysteresis): {format_value(low_v, 'V')}")
print(f"High threshold (5V, 10% hysteresis): {format_value(high_v, 'V')}")
# Compute threshold voltages for 12V reference with 20% hysteresis
low_v, high_v = hysteresis_threshold_voltages("12V", 0.20)
print(f"Low threshold (12V, 20% hysteresis): {format_value(low_v, 'V')}")
print(f"High threshold (12V, 20% hysteresis): {format_value(high_v, 'V')}")Example output
hysteresis_threshold_voltages_output.txt
Low threshold (5V, 10% hysteresis): 2.25 V
High threshold (5V, 10% hysteresis): 2.75 V
Low threshold (12V, 20% hysteresis): 4.80 V
High threshold (12V, 20% hysteresis): 7.20 VThe hysteresis threshold voltages represent the actual voltage levels at which a comparator or switching circuit will change state. These thresholds are calculated as percentages of a reference voltage, creating a dead band that prevents unwanted switching due to noise or signal fluctuations.
The threshold voltages are computed using the formulas: $V_{low} = V_{ref} \times \frac{1 - h}{2}$ and $V_{high} = V_{ref} \times \frac{1 + h}{2}$, where $V_{ref}$ is the reference voltage and $h$ is the hysteresis percentage. The lower threshold is set below the midpoint, while the upper threshold is set above the midpoint.
Related posts
- How to compute hysteresis threshold ratios in Python using UliEngineering
- How to compute hysteresis resistor in Python using UliEngineering
- How to compute RC time constant 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