Learn & build · Electronics · Chapter 9
Oscillators and timers
Every computer, radio, watch and blinking LED needs something that ticks. An oscillator is a circuit that turns steady DC into a repeating signal all by itself. This chapter builds the most famous one, the 555 timer, works out its timing from a charging capacitor, and then looks at the crystals that keep clocks accurate to seconds a month.
1. Why feedback can ring forever
Chapter 7's op-amps used negative feedback to settle down. Flip the sign and a circuit amplifies its own output, round and round. If a signal comes back around the loop with the same timing (a full 360° of phase) and at least as strong as it left, it sustains itself, like a microphone too close to its speaker. That's the Barkhausen criterion: loop gain ≥ 1 and loop phase = 360°. Every oscillator is a way of making that true at exactly one frequency.
A microphone near a speaker howls at one particular pitch, not all pitches. Why that one?
- It's the loudest frequency in the room
- At that pitch the sound returns in step with itself (360° around the loop) with gain above 1
- It's the microphone's own resonance
2. The 555 timer, astable
Inside a 555 are three equal resistors that make two reference voltages, ⅓ and ⅔ of the supply, two comparators that watch the capacitor against them, and a flip-flop that remembers which way it's going. The capacitor charges through R1 + R2 until it reaches ⅔, the output drops and the discharge pin empties it through R2 down to ⅓, the output rises again, and so on. Change the parts and watch.
🎯 Challenge: make it blink at about 1 Hz (between 0.9 and 1.1) with a duty cycle under 60%.
The math, step by step
From chapter 2, a capacitor charging toward \(V_s\) through \(R\) gets from \(V_a\) to \(V_b\) in
\[ t = RC \,\ln\frac{V_s - V_a}{V_s - V_b} \]
Charging from ⅓ to ⅔ of \(V_s\) through \(R_1 + R_2\): \(t = (R_1 + R_2) C \ln\frac{2/3}{1/3} = (R_1 + R_2)C \ln 2\). Discharging toward 0 from ⅔ to ⅓ through \(R_2\): \(R_2 C \ln 2\). So
\[ t_{high} = 0.693\,(R_1 + R_2)\,C, \quad t_{low} = 0.693\,R_2 C, \quad f = \frac{1}{t_{high} + t_{low}} = \frac{1.44}{(R_1 + 2R_2)\,C} \]
Notice the supply voltage cancels out: the thresholds are fractions of the same supply the capacitor charges toward. A 555 blinks at the same rate on 5 V or 15 V. And the duty cycle \(t_{high}/(t_{high}+t_{low})\) is always above 50%, since charging goes through both resistors.
R1 = 1 kΩ, R2 = 47 kΩ, C = 10 µF (the lab's "555 LED blinker"). What frequency?
You change the supply from 5 V to 12 V. What happens to the blink rate?
- It speeds up
- It slows down
- Nothing: the thresholds are fractions of the supply, so it cancels
An oscillator is feedback that comes back in step and at least as strong as it left. In a 555 that loop is a capacitor charging between ⅓ and ⅔ of the supply, so R and C alone set the rhythm.
3. The 555 as a one-shot
Wired differently (monostable), the 555 waits. A short low pulse on the trigger pin starts it: the output goes high, the capacitor charges through R from 0 to ⅔, and then the output drops and stays low until the next trigger. It turns a quick button press into a clean pulse of a set length.
A one-shot with R = 100 kΩ and C = 10 µF. How long is the pulse? (It charges from 0 to ⅔: \(t = RC \ln 3\).)
4. Crystals: keeping time
RC timing is only as good as the parts: 5% resistors and 20% capacitors make a 555 that's off by a lot, and it drifts with temperature. For clocks, a sliver of quartz does the timing. Quartz is piezoelectric: squeeze it and it makes a voltage, put a voltage on it and it flexes. Cut to size, it rings mechanically at one frequency with a Q of 10,000 to 100,000 (a tuned circuit from chapter 3 manages about 100), and an amplifier keeps it ringing.
The math
Accuracy is quoted in parts per million: ±20 ppm means the frequency may be off by 20 millionths. Over a time \(T\), the clock gains or loses \(T \times \text{ppm} \times 10^{-6}\): a month is 2.6 million seconds, so 20 ppm is up to 52 s per month. A cheap 555 at 5% would be off by 36 hours a month.
Why 32,768 Hz? It's \(2^{15}\). Fifteen flip-flops in a row, each halving the frequency (chapter 12), turn it into exactly 1 Hz, one tick per second. That's what's inside every quartz watch and every computer's real-time clock.
How many divide-by-two stages turn 32,768 Hz into 1 Hz?
A 10 ppm crystal, over 30 days (2,592,000 s). Up to how many seconds off?
5. LC oscillators: radio frequencies
For megahertz, a coil and capacitor (chapter 3) set the frequency and a transistor, amplifying (chapter 4, section 5), tops up the energy lost each cycle: the Colpitts and Hartley oscillators, the heart of every old radio's tuning. Your RTL-SDR dongle uses a 28.8 MHz crystal and a phase-locked loop to make any frequency from it, which the radio course takes apart.
Try the 555 LED blinker in the circuit lab: change R2 and C and measure the frequency on its scope. Next: power supplies.
Previous: Filters · All chapters: Learn & build.
Last updated