Circuit 3D

Oscillators

An oscillator is a circuit that makes a repeating signal by itself, a square wave or a sine wave, from a steady DC supply. It feeds part of its output back to its input, and a timing part, a capacitor, an inductor or a quartz crystal, sets how fast it repeats: 10 mH with 1 µF rings at about 1.59 kHz.

f = 1 ÷ (2π√(LC))

where L is the inductance in henries and C the capacitance in farads; RC oscillators such as the 555 time a capacitor charging through resistors instead.

A crystal oscillator uses vibrating quartz for the steadiest frequency of all.

What is an oscillator?

An oscillator is a circuit that turns a steady DC supply into a repeating signal, switching or swinging back and forth by itself at a frequency set by its parts.

Every blinking light, beeping alarm, radio and computer clock has one. The simplest kind charges a capacitor until a switch trips, empties it, and starts again, as the lab’s 555 beacon does in Figure 1. A bigger capacitor takes longer to fill, so it blinks more slowly.

10 µF: the capacitor charges for 541 ms and empties for 471 ms, between a third and two-thirds of the supply, so the beacon oscillates at f = 1 ÷ 1.012 s ≈ 0.988 Hz.

Figure 1. The lab’s Fixed-Rate Beacon: a CMOS 555 on 3 V with 10 kΩ and 68 kΩ timing resistors, blinking a red LED at the rate its capacitor sets.

How does an oscillator work?

An oscillator feeds part of its output back to its input through a network that picks one frequency, with an amplifier making up whatever each trip round the loop loses.

To keep going, the signal must come back in step with itself and at least as strong as it left: a loop gain of one or more with a phase shift of 360°, the Barkhausen criterion. Noise at switch-on is enough to start it, and the loop builds it up until the amplifier limits it. With too little gain, each cycle is smaller than the last and it dies away.

What is an RC oscillator?

An RC oscillator sets its frequency with resistors and capacitors, either by charging a capacitor to a threshold and resetting, or by shifting a sine wave’s phase round a loop.

The first kind, a relaxation oscillator, makes square waves: the 555 timer charges between a third and two-thirds of its supply, at a rate set by the RC time constant. Phase-shift and Wien bridge oscillators use an op-amp and RC networks to make clean sine waves. RC oscillators are cheap and easy to adjust, but drift with temperature and part tolerances, often by a percent or more.

What is an LC oscillator?

An LC oscillator uses an inductor and a capacitor, a tank circuit, whose energy swings between the capacitor’s electric field and the inductor’s magnetic field at its resonant frequency, f = 1 ÷ (2π√(LC)).

Figure 2 steps through one cycle. On its own the swing fades, as resistance takes a little each cycle, so a transistor tops it up, in designs such as the Colpitts and Hartley oscillators. LC oscillators suit high frequencies, from hundreds of kilohertz into gigahertz, which is why radios and metal detectors use them.

+− C L energy in the capacitor’s electric field

Start: the capacitor is charged, top plate positive, and no current flows yet. All the energy is in its electric field.

Figure 2. An LC tank, a capacitor and an inductor in a loop, swapping its energy back and forth. Resistance drains a little each cycle, so an oscillator’s amplifier tops it up.

What are crystal and chip oscillators, the clock in a can?

A crystal oscillator uses a thin slice of quartz that vibrates at one precise frequency, set by its size and cut, typically accurate to within tens of parts per million.

Quartz is piezoelectric: a voltage bends it, and bending it makes a voltage, so in a feedback loop it rings like a tuning fork. A watch crystal runs at 32,768 Hz, which halves fifteen times to exactly one tick a second. A bare crystal needs a chip’s own amplifier and two small capacitors; a crystal oscillator chip seals crystal and circuit in one metal can or tiny package, so power in gives a square-wave clock out. Figure 3 shows why clocks use crystals rather than RC or ceramic timing.

RC 7.2 h ceramic 3.6 h crystal 51.8 s worst-case drift over a month

Over a month: a clock timed by a ±1% RC oscillator could be 7.2 h out, a ceramic resonator 3.6 h, but a ±20 ppm quartz crystal only 51.8 s.

Figure 3. Worst-case drift on a log scale for a calibrated RC oscillator at ±1%, a ceramic resonator at ±0.5% and a quartz crystal at ±20 ppm.

What are oscillators used for?

Oscillators set the pace for almost every electronic device: clocks for computers and Arduino boards, tones in buzzers and alarms, carriers for radio, and the switching in PWM and buck and boost converters.

They also blink indicator lights, drive ultrasonic sensors and time the refresh of displays. Pick an RC oscillator when cheap and adjustable matters, an LC one for radio frequencies, and a crystal when the timing has to be right.

How do you calculate an oscillator’s frequency?

To calculate an oscillator’s frequency, use f = 1 ÷ (2π√(LC)) for an LC oscillator, and f = 1.44 ÷ ((R1 + 2R2) × C) for a 555 astable, rearranged for whichever part you need.

Example 1: an LC oscillator’s frequency

An LC oscillator’s tank has a 100 µH inductor and a 1 nF capacitor. What frequency does it oscillate at?

Given
L = 100 µH, C = 1 nF
Find
the LC oscillator’s frequency
Solution
√(LC) = √(100 µH × 1 nF) = 316.2 nsf = 1 ÷ (2π × 316.2 ns) = 503 kHz
Answer
503 kHz

Example 2: a 555 tone’s capacitor

A 555 astable with R1 = 1 kΩ and R2 = 6.8 kΩ drives a speaker. What capacitor makes it sound 1 kHz?

Given
a 555 astable with R1 = 1 kΩ and R2 = 6.8 kΩ, to sound 1 kHz
Find
its timing capacitor
Solution
C = 1.44 ÷ ((R1 + 2R2) × f) = 1.44 ÷ (14.6 kΩ × 1 kHz) = 98.6 nFThe nearest common value, 100 nF, gives 1.44 ÷ (14.6 kΩ × 100 nF) = 986 Hz
Answer
100 nF, for 986 Hz

Summary

Key equations

  • f = 1 ÷ (2π√(LC)) an LC oscillator
  • f = 1.44 ÷ ((R1 + 2R2) × C) a 555 astable
  • drift = tolerance × time a clock’s error

Key terms

Feedback
Output fed back to the input.
Relaxation
Charges, then resets.
Tank
An inductor and a capacitor.
ppm
Parts per million.

Practice problems

  1. What does an oscillator need to keep oscillating?

  2. An LC tank has L = 100 µH and C = 10 nF. What is its frequency?

  3. Why does a quartz watch crystal run at 32,768 Hz?

  4. A clock’s 20 ppm crystal runs at its limit. How far out could it be after 30 days?

  5. Doubling a 555 astable’s capacitor does what to its frequency?

FAQ

What is a crystal oscillator chip?

A crystal and its oscillator circuit sealed in one package, usually with four pins: power, ground, an enable pin and the clock output. Power it and it gives a steady square wave at its marked frequency.

What is the difference between an oscillator and an amplifier?

An amplifier makes a bigger copy of a signal you give it; an oscillator makes its own signal, by feeding its output back to its input.

What is a crystal oscillator used for?

Keeping accurate time: the clocks in watches, computers, phones and microcontrollers, and the reference frequencies in radios.

Does an oscillator make AC?

It makes a repeating signal, often riding on DC: a 555’s output swings between 0 V and its supply rather than above and below zero.

What is a 32.768 kHz crystal?

The standard watch crystal. 32,768 is 2¹⁵, so dividing by two fifteen times gives exactly one pulse a second.

Why won’t my oscillator start?

Usually too little loop gain, the wrong load capacitors on a crystal, or a break in the feedback path. Check the supply and the parts’ values first.

What is a ring oscillator?

An odd number of inverters in a loop. Each flips the next, so the loop never settles, oscillating at a rate set by their delays.

What is a VCO?

A voltage-controlled oscillator, whose frequency follows an input voltage. Synthesizers and phase-locked loops use them.