C6 · Lesson 48 · Comparators and oscillators
Op amps without negative feedback
Take away the negative feedback and an op amp becomes a decision-maker: its output slams to one rail or the other depending on which input is higher. That's a comparator, the boundary between the analog world and the digital one. Add positive feedback and it gains memory, switching at two different thresholds so that noise can't make it chatter. Add a capacitor that it charges and discharges, and it oscillates on its own.
Play
- A relaxation oscillator: the op amp's output charges C through R; the output switches whenever the capacitor's voltage crosses a threshold set by the divider on the + input.
- Watch the capacitor's voltage on the scope. Between what two levels does it swing?
- Change R or C. How does the period change? (A tiny step source starts it, as electrical noise would.)
Predict
In the oscillator above, the divider feeds half the output back to the + input, and the output swings between +10 V and −10 V. Between what levels does the capacitor swing?
Between −5 V and +5 V. With the output at +10 V, the + input sits at +5 V; the capacitor charges toward +10 V until it passes +5 V, which flips the output to −10 V and the threshold to −5 V. Then it discharges toward −10 V until it passes −5 V, and so on. Each half cycle takes , so the period is .
Name it
Comparators and positive feedback
Comparator. With no feedback, when and otherwise. If the input is noisy near the threshold, the output chatters, switching several times on each crossing.
Schmitt trigger. Feed a fraction β of the output back to the + input. The threshold then depends on the output's state:
(for an inverting Schmitt with the reference at 0). Once the output switches, the threshold jumps away from the input, so small noise can't switch it back. Digital inputs of microcontrollers use Schmitt triggers for exactly this (C2.26).
Relaxation oscillator. An inverting Schmitt trigger whose input is a capacitor charged from its own output through R. The capacitor heads toward but turns round at :
which is for β = ½. The output is a square wave; the capacitor's voltage is a train of exponential segments.
In practice. Dedicated comparator chips switch in nanoseconds and have outputs made for logic; op amps used as comparators are slower, limited by their slew rate. The 555 timer is a pair of comparators and a flip-flop built for oscillators and timers. Relaxation oscillators aren't precise (their period depends on R, C and the thresholds); clocks use crystals.
A slow sine with a little fast noise feeds a plain comparator (U1) and a Schmitt trigger (U2) whose thresholds are ±0.5 V. The comparator chatters at each crossing; the Schmitt trigger switches once.
Worked example
A Schmitt trigger on a ±12 V op amp feeds back through 100 kΩ, with 10 kΩ to ground. What are its thresholds?
Show the solution
- Feedback fraction.
- Thresholds. V gives ±1.09 V, so the hysteresis is 2.18 V: noise smaller than that can't make it chatter.
Answer the thresholds are ±1.09 V, 2.18 V of hysteresis.
Worked example
A relaxation oscillator uses R = 10 kΩ, C = 100 nF and β = 0.5. What is its frequency?
Show the solution
- Period.
- Frequency.
Answer the oscillator runs at 455 Hz.
Worked example
A ±12 V Schmitt trigger must clean a signal that carries 0.3 V of peak noise. With 10 kΩ from the non-inverting input to ground, what feedback resistor gives enough hysteresis?
Show the solution
- Hysteresis needed. The noise can swing the input 0.6 V peak to peak, so the hysteresis, , must be at least 0.6 V:
- Feedback resistor. With 10 kΩ to ground, gives = 390 kΩ.
- With less. A noisy edge crosses the threshold several times and the output chatters.
Answer a 390 kΩ feedback resistor gives enough hysteresis.
Check
A Schmitt trigger feeds back β = 0.2 of its ±5 V output. What's its upper threshold?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
Same Schmitt trigger: β = 0.2, ±5 V. How wide is its hysteresis?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
A relaxation oscillator has R = 47 kΩ, C = 10 nF and β = ½. What's its period?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A relaxation oscillator has R = 10 kΩ, C = 10 nF and β = 0.8. What's its period?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Why does a Schmitt trigger switch cleanly on a noisy signal while a plain comparator chatters?
Check
A ±12 V Schmitt trigger must reject 0.1 V of peak noise, with 10 kΩ to ground at its non-inverting input.
(a)
What β does it need?
(b)
What feedback resistor?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
Check
A relaxation oscillator has R, C and feedback fraction b.
Step 1
What's its period?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
Its frequency?
Step 3
What β makes the period exactly RC?
Explain why
How does a relaxation oscillator keep oscillating without any input signal?
The op amp's output is always at one of its two saturation levels, and it charges the capacitor toward that level through the resistor. The positive feedback divider sets a threshold partway there. When the capacitor's voltage crosses the threshold, the comparator flips its output to the other level, which also moves the threshold to the opposite side. Now the capacitor heads the other way until it crosses the new threshold, and the output flips back. The cycle repeats on its own, each half taking a time set by RC and the threshold fraction.
Practice
Keep practicing
8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.