Comparators, Schmitt trigger and timers

Comparators and zero-crossing detectors, Schmitt triggers with hysteresis, the op-amp astable, and 555 monostable and astable timing.

Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Comparators turn analog measurements into decisions: a level switch trips an alarm, a zero-crossing detector times a thyristor firing angle, a flash ADC is a bank of comparators. Real signals are noisy, so a plain comparator chatters near its threshold; the Schmitt trigger cures this with hysteresis. The 555 timer packages two comparators and a flip-flop into the most widely used timing chip, giving one-shot delays and clock oscillators from one resistor-capacitor pair.

Key ideas

Comparator. An op-amp (or a dedicated comparator IC) used without negative feedback. If v₊ > v₋ the output goes to its high level, otherwise to its low level. A non-inverting comparator has the signal on v₊ and the reference on v₋; an inverting comparator swaps them. With the reference at 0 V it is a zero-crossing detector. Dedicated comparators (often with open-collector outputs) switch much faster than op-amps, which are compensated for linear use and recover slowly from saturation.

Chatter and hysteresis. Noise on a slowly varying input makes a comparator switch many times as the signal crosses the threshold. A Schmitt trigger adds positive feedback, so the threshold depends on the present output state: an upper threshold V_UT for switching one way and a lower threshold V_LT for switching back. Noise smaller than the hysteresis width V_H = V_UT − V_LT cannot cause false switching.

Inverting Schmitt trigger. Input to v₋; a divider R₁ (to ground or V_ref) and R₂ (from the output) sets v₊. With output ±V_sat the thresholds are ±β·V_sat (plus a shift from V_ref), where β = R₁/(R₁ + R₂). The output goes low when the input rises above V_UT and high when it falls below V_LT.

Non-inverting Schmitt trigger. Input through R₁ to v₊, R₂ from output to v₊, v₋ at reference. Thresholds ±(R₁/R₂)·V_sat for V_ref = 0.

Op-amp astable (square-wave generator). An inverting Schmitt trigger whose input is a capacitor charged from its own output through R. The capacitor swings between the two thresholds, giving a square wave at the output and an exponential near-triangle across C.

555 timer. Inside: a resistor divider of three equal resistors sets 2/3·V_CC and 1/3·V_CC; the threshold comparator resets a flip-flop when its pin exceeds 2/3·V_CC; the trigger comparator sets it when its pin drops below 1/3·V_CC; a discharge transistor shorts the timing capacitor when the output is low.

  • Monostable: a trigger pulse sets the output high and releases C, which charges through R from 0 to 2/3·V_CC: pulse width 1.1·RC, independent of V_CC.
  • Astable: C charges through R_A + R_B from 1/3 to 2/3·V_CC (output high) and discharges through R_B alone back to 1/3·V_CC (output low). Since ln 2 = 0.693, each interval is 0.693 × resistance × C. The duty cycle is above 50 % in the basic circuit; a diode across R_B allows below 50 %.

Formulas

β = R₁ / (R₁ + R₂) — feedback fraction of the Schmitt trigger.

V_UT = β·V_sat + (1 − β)·V_ref, V_LT = −β·V_sat + (1 − β)·V_ref — inverting Schmitt with V_ref applied to the bottom of R₁ and symmetric output ±V_sat.

V_H = V_UT − V_LT = 2β·V_sat — hysteresis width (V).

V_UT,LT = ±(R₁/R₂)·V_sat — non-inverting Schmitt with v₋ = 0.

T = 2·R·C·ln((1 + β)/(1 − β)) — op-amp astable period (s).

T = 1.1·R·C — 555 monostable pulse width (s).

t_H = 0.693·(R_A + R_B)·C, t_L = 0.693·R_B·C, f = 1.44 / ((R_A + 2R_B)·C) — 555 astable.

D = (R_A + R_B) / (R_A + 2R_B) — 555 astable duty cycle (fraction of period output is high).

Worked examples

Example 1 (standard: Schmitt trigger). An inverting Schmitt trigger uses an op-amp saturating at ±12 V, R₁ = 10 kΩ (to ground) and R₂ = 40 kΩ (from output). Find the thresholds and hysteresis. Will 1 V peak-to-peak noise on a slowly rising input cause chatter?

  1. β = R₁/(R₁ + R₂) = 10/50 = 0.2.
  2. V_UT = β·V_sat = 0.2 × 12 = +2.4 V; V_LT = −2.4 V.
  3. V_H = 2β·V_sat = 4.8 V.
  4. 1 V of noise is far smaller than 4.8 V, so once the output has switched the input cannot get back across the other threshold: no chatter.

Answer: V_UT = +2.4 V, V_LT = −2.4 V, V_H = 4.8 V; no chatter.

Example 2 (GATE level: 555 astable). A 555 astable uses R_A = 4.7 kΩ, R_B = 10 kΩ and C = 10 nF. Find t_H, t_L, the frequency and the duty cycle.

  1. t_H = 0.693(R_A + R_B)C = 0.693 × 14.7×10³ × 10×10⁻⁹ = 101.9 µs.
  2. t_L = 0.693·R_B·C = 0.693 × 10×10³ × 10×10⁻⁹ = 69.3 µs.
  3. T = t_H + t_L = 171.2 µs, so f = 1/T = 5.84 kHz (the 1.44 formula gives 5.83 kHz, the difference being rounding of ln 2).
  4. D = t_H/T = 101.9/171.2 = 59.5 %.

Answer: t_H ≈ 102 µs, t_L ≈ 69 µs, f ≈ 5.84 kHz, D ≈ 59.5 %.

Common mistakes

  • Using negative-feedback analysis (virtual short) on a comparator or Schmitt trigger; with positive feedback the inputs are not equal except at the switching instant.
  • Mixing up which threshold applies: the inverting Schmitt switches low at V_UT and high at V_LT.
  • Calling the 555 astable duty cycle R_B/(R_A + 2R_B); that is the low-time fraction.
  • Using 0.693·RC for the 555 monostable (it is 1.1·RC because C charges from 0 to 2/3·V_CC, and ln 3 = 1.1).
  • Assuming a sine wave compared with a non-zero reference gives a 50 % duty cycle; it does not.
  • Using a slow general-purpose op-amp as a high-speed comparator.

For GATE IN

Expect threshold and hysteresis calculations for inverting and non-inverting Schmitt triggers (including with a reference), duty cycle of a comparator driven by a sine, output waveforms for a given input, and 555 monostable and astable timing. Practise drawing the transfer characteristic (v_o against v_i) with arrows showing the direction of the hysteresis loop.

Quick check

  1. A 555 monostable has R = 100 kΩ and C = 10 µF. Pulse width?
  2. A Schmitt trigger has V_UT = 3 V and V_LT = 1 V. Hysteresis?
  3. A zero-crossing detector is driven by a 50 Hz sine. Output frequency and duty cycle?
  4. In a 555 astable, R_A = R_B. Duty cycle?

Answers: 1. 1.1 s. 2. 2 V. 3. 50 Hz square wave, 50 %. 4. 2/3, about 66.7 %.

Try answering each one aloud before you open it.

  1. 1.What is a comparator in analog electronics?Concept

    A comparator is an electronic device that compares two voltages or currents and outputs a digital signal indicating which is larger. It has two input terminals and one output. When the voltage at the non-inverting input is higher than the inverting input, the output is high, and vice versa.

  2. 2.Explain the working principle of a Schmitt trigger.Concept

    A Schmitt trigger is a comparator circuit with hysteresis, meaning it has two different threshold voltage levels for switching from high to low and low to high. This helps in cleaning up noisy signals by providing a stable output even when the input signal is noisy or slowly varying. It is widely used to convert analog signals into digital signals.

  3. 3.What is the purpose of hysteresis in a Schmitt trigger?Concept

    Hysteresis in a Schmitt trigger provides noise immunity and prevents false triggering by ensuring that the input signal must pass through two different threshold levels to change the output state. This makes the Schmitt trigger ideal for applications where the input signal is noisy or has slow rise and fall times.

  4. 4.Why are comparators used in analog-to-digital converters (ADCs)?Application

    Comparators are used in ADCs to compare the input analog signal with a reference voltage. This comparison helps in determining the digital equivalent of the analog input. In successive approximation ADCs, for example, comparators are crucial for determining each bit of the digital output.

  5. 5.What happens if the reference voltage in a comparator circuit is noisy?Application

    If the reference voltage in a comparator circuit is noisy, it can lead to incorrect or unstable output signals. The comparator may switch states erratically, causing false triggering and unreliable operation. This is why stable and clean reference voltages are crucial in comparator circuits.

  6. 6.How does a 555 timer work in astable mode?Concept

    In astable mode, a 555 timer continuously oscillates between its high and low states, generating a square wave output. The frequency and duty cycle of the output waveform are determined by two external resistors and a capacitor connected to the timer. This configuration is often used for generating clock pulses.

  7. 7.Why is a Schmitt trigger used in digital circuits?Application

    A Schmitt trigger is used in digital circuits to convert noisy or slowly changing analog signals into clean digital signals. Its hysteresis characteristic ensures that the output remains stable despite fluctuations in the input signal, making it ideal for debouncing switches and signal conditioning.

  8. 8.Calculate the frequency of oscillation for a 555 timer in astable mode with R1 = 1 kΩ, R2 = 2 kΩ, and C = 1 µF.Numerical

    The frequency of oscillation for a 555 timer in astable mode is given by the formula: f = 1.44 / ((R1 + 2R2) * C). Substituting the given values: f = 1.44 / ((1 kΩ + 2 * 2 kΩ) * 1 µF) = 1.44 / (5 kΩ * 1 µF) = 1.44 / 0.005 = 288 Hz.

  9. 9.What is the role of a capacitor in a 555 timer circuit?Concept

    In a 555 timer circuit, the capacitor is used to determine the timing intervals. In astable mode, it charges and discharges between two-thirds and one-third of the supply voltage, controlling the frequency and duty cycle of the output waveform. In monostable mode, it determines the duration of the output pulse.

  10. 10.Explain how a comparator can be used to create a zero-crossing detector.Application

    A zero-crossing detector is a circuit that outputs a signal whenever the input waveform crosses zero volts. By using a comparator with its reference voltage set to zero, the output changes state each time the input signal crosses zero. This is useful in applications like phase-locked loops and frequency counters.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?