Toolvito

Works on this device

Comparator Hysteresis Calculator

A comparator with positive feedback switches at two different input voltages, so a slow or noisy signal does not make the output chatter. This tool finds the resistors for the thresholds you want, or the thresholds that your resistors give.

Enter your values

The signal goes to the − input. You choose the feedback resistor R3, and the tool finds R1 and R2.

Your values

The input voltage at which the output switches while the input rises.

The input voltage at which the output switches back while the input falls.

The supply or reference voltage at the top of R1.

Ideal value: the positive supply. The real level is in the data sheet of the comparator.

Ideal value: 0 V, or the negative supply. The real level is in the data sheet of the comparator.

From the output to the + input. A large value, such as 100 kΩ to 1 MΩ, loads the output less.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Calculate.

How to use this calculator

  1. Choose the circuit. In the inverting circuit the signal goes to the − input. In the non-inverting circuit the signal goes through a resistor to the + input.
  2. To design a circuit, choose resistors for chosen thresholds. Enter the upper and the lower threshold, the output high and low voltage, and the feedback resistor you want to use.
  3. Choose Calculate. The result shows the exact resistor values and the working.
  4. Pick standard resistor values by hand. Then choose Check these resistors under the result, change the values to the standard ones, and calculate again to see the thresholds they really give.

The two circuits

  • Inverting: the signal is at the − input. R1 goes from a supply or reference voltage to the + input, R2 goes from the + input to ground, and the feedback resistor R3 goes from the output to the + input. The output goes low when the signal rises above the upper threshold.
  • Non-inverting: the signal goes through R1 to the + input. The feedback resistor R2 goes from the output to the + input. The − input sits at a reference voltage. The output goes high when the signal rises above the upper threshold.

The formulas

  • Inverting, thresholds: threshold = (Vs ÷ R1 + Vout ÷ R3) ÷ (1 ÷ R1 + 1 ÷ R2 + 1 ÷ R3). Vs is the voltage that feeds R1. Use the output high voltage for the upper threshold and the output low voltage for the lower one.
  • Inverting, resistors: 1 ÷ R1 + 1 ÷ R2 + 1 ÷ R3 = (output high − output low) ÷ (hysteresis × R3). Then 1 ÷ R1 = (lower threshold × that sum − output low ÷ R3) ÷ Vs, and 1 ÷ R2 is the rest.
  • Non-inverting, thresholds: threshold = Vref × (1 + R1 ÷ R2) − Vout × R1 ÷ R2. Use the output low voltage for the upper threshold and the output high voltage for the lower one.
  • Non-inverting, resistors: R1 ÷ R2 = hysteresis ÷ (output high − output low), and Vref = (upper threshold + output low × R1 ÷ R2) ÷ (1 + R1 ÷ R2).
  • Hysteresis = upper threshold − lower threshold.

Worked example

An inverting comparator runs from 5 V, and its output swings from 0 V to 5 V. You want thresholds of 3 V and 2 V, and you choose a feedback resistor R3 of 100 kΩ. The sum of 1 ÷ R is (5 − 0) ÷ (1 × 100,000) = 50 µS. 1 ÷ R1 = 2 × 50 µS ÷ 5 = 20 µS, so R1 = 50 kΩ. 1 ÷ R2 = 50 − 20 − 10 = 20 µS, so R2 = 50 kΩ.

Check: with the output at 5 V, the + input sits at (5 ÷ 50,000 + 5 ÷ 100,000) ÷ 0.00005 = 3 V. With the output at 0 V it sits at (5 ÷ 50,000) ÷ 0.00005 = 2 V.

For the same thresholds in the non-inverting circuit with R2 = 100 kΩ: R1 ÷ R2 = 1 ÷ 5 = 0.2, so R1 = 20 kΩ. The reference voltage is 3 ÷ 1.2 = 2.5 V.

Limits you should know

  • The result is arithmetic on the values you typed. It is not professional engineering advice. Check a real design against the data sheet of the comparator.
  • The comparator is ideal: its inputs take no current, it has no offset voltage, and its output sits at the two levels you typed. Offset and input current move the real thresholds a little.
  • The real output levels are in the data sheet. An open-collector output with a pull-up resistor does not reach the supply, because the feedback resistor loads it. Use a feedback resistor much larger than the pull-up resistor, or type the level you measure.
  • In the non-inverting circuit the resistance of the signal source adds to R1.
  • The tool gives exact resistor values. It has no table of standard values: choose the next standard value by hand, then check the thresholds again. The tolerance of the resistors moves the thresholds too.
  • The voltages at the inputs must stay inside the input range of your comparator. The tool does not check this.

Related tools