Hysteresis and the Schmidt Trigger


A common scenario encountered in mobile robotics is the need to compare an analog signal with some prescribed threshold voltage, and decide whether the analog voltage is "greater" or "less than" this voltage. This is commonly accomplished by use of a voltage comparator. A good example of such an application is with the optical detector circuits used in making your mobile robot "follow a white line". The detector is generally over the white line, or not over the white line, and a comparator circuit may compare the detector voltage with a threshold voltage, and send a digital signal to a 68HC1x signifying whether that particular detector is over the white line or not. A middle ground, however, is during the transition when the detector is "half over the white line". This situation can sometimes cause problems that we shall address here.

The voltage comparator is much like an op-amp. Voltage comparators are usually used in a "digital mode" - where their output is either a logical "1" (V_out = Vcc) or logical "0", (V_out = Vss). This is as opposed to, e.g., an op-amp operating in a linear mode- such as in an inverting or non-inverting op amp configuration.

Thus comparators generally are designed to operate more optimally than op-amps in digital applications, in that comparator output voltages will go very close to the power supply voltage "rails", and their outputs will swing between these rails very fast (a very high "slew rate"). Be aware, however, that many comparators have an "open collector output" (this makes them more versatile), such that they often require a pull-up resistor on the output in order to function proplerly.

One problem with comparators is that the signal is often noisy, and when the input voltage is close to the threshold voltage, a little bit of noise can make the voltage vary to levels that rapidly fluctuate to values just above or just below the threshold voltage. This can cause output "glitches", that can make control systems unstable. For example, your car may jump erratically or shimmy around a lot while trying to follow the white line. This problem is depicted in the MatLab plots shown below. The left plot shows the response of a comparator to a noiseless signal. The output = 5V whenever Vin > V-threshold (here V-theshold = 2.5 Volts). The second plot shows the situtation when the signal is corrupted by high frequency noise such as the 120Hz noise present in ambient light coming from ordinary flourescent lights. The third plot shows the results of using hysteresis (such as employing a "Schmidt triggered comparator").
Response of a comparator to noiseless & noisy signals


Response of a comparator to noiseless & noisy signals
The Schmidt Trigger concept makes use of "positive feedback". The circuit diagram above demonstrates how hysteresis can be incorporated using an ordinary comparator (or op-amp). The basic idea is that the "effective threshold voltage" is actually adjusted dynamically. Inspect the circuit shown above. Assume that the potentiometer is adjusted so that V_threshold = 2.5 Volts. Since V_in is fed into the non-inverting input, the output would normally go high (+5V) whenever V_in > 2.5 Volts, and would go low (0 Volts) whenever V_in <2.5 Volts. By adding positive feedback (via Rf), the "current output state" in a sense "reinforces" the input value. In other words, if the output state is currently high, it will not switch to "low" unless the input voltage drops "substantially" below the threshold voltage {i.e. approximately> V_in <[v_thresh 2.5V(10k/Rf)]}. Conversely, if the output state is currently low, it will not transition to the high state unless the input voltage rises "substantially" above the threshold voltage {i.e. approximately> V_in > [V_thresh + 2.5V(10k/Rf)]}. The difference in the effective threshold voltages (see the dashed lines in the rightmost plot) is thus:

V_hysteresis = 5V(10k/Rf).

Thus the amount of hysteresis can be controlled by choosing the feedback resistance value. Normally Rf >> 10k. In this example, V_hysteresis = 0.5 Volts. Note that the use of hysteresis is very effective in removing the glitches. This is why Schmidt triggers (that employ hysteresis) are often used to condition noisy signals in digital applications. If one does not want to add a whole slew of Schmidt trigger circuits to their design, note that it is possible, by feeding the photodetector outputs into the A-to-D inputs of the 68HC1x, to effective implement the hysteresis operation in software.

Since the future response of a system employing hysteresis depends on the current state/output of the system, a system with hysteresis has "memory", that is it's reponse depends on the past. Some people remember this by associating "hysteresis" with the word "history".

Back to Home Page