# How does a Crystal work?

Specifically, a 2pin and 4pin quartz crystal oscillator.

What I know: current is applied and the crystal oscillates in order to provide an oscillating signal.

What I want to know: How does the vibration cause an oscillating current? How are 2/4pin crystals different? Lastly, why can a 4pin run alone and a 2pin needs capacitors.

-
What are you asking about, crystals or complete canned oscillators? The title says "crystal", so that's what I answered. – Olin Lathrop Jul 3 '14 at 12:58

The devices with two pins are not oscillators, they are resonators (crystals), which can be used in an oscillator circuit (such as a Pierce oscillator), and if used with the correct circuit will oscillate at (or near) the marked frequency. The Pierce oscillator circuit uses two capacitors (load capacitors) and an amplifier.

The devices with four pins are complete circuits including a resonator and an active circuit that oscillates. They require power and output a square wave or sine wave output at (or near) the marked frequency.

There are also (ceramic) resonators with three pins that act like crystals with capacitors.

The way crystals (and ceramic resonators) work is that they are made of a piezoelectric material that produces a voltage when they are distorted in shape. A voltage applied will cause a distortion in shape. The crystal is made into a shape that will physically resonate (like a tuning fork or a cymbal) at the desired frequency. That means that the crystal will act like a filter- when you apply the desired frequency it will appear like a high impedance once it gets vibrating, and to frequencies a bit different, it will be more lossy. When put in the feedback circuit of an amplifier, the oscillation will be self-sustaining. Much more, and some math, here.

-
A crystal resonator can be modeled as an LC bandpass filter, usually with a very narrow passband (high Q). Also, putting a bandpass filter in a loop with an amplifier is a general method for building an oscillator as the circuit will oscillate in the passband of the filter. If you use a tunable filter, then you can build a tunable or sweepable oscillator. This is used in RF test equipment regularly with magnetically-tunable YIG spheres acting as bandpass filters either stand-alone as tunable filters or in tunable oscillators. – alex.forencich Jul 4 '14 at 9:33

If you think of a crystal as being a tiny bell, it's easy to see how, if you hit it with a tiny little hammer, it would ring with a pure tone just like a big bell would if you hit the big bell with a small hammer.

That's exactly what a crystal does, but the trick is that it's made of piezoelectric material which makes electricity when you hit it and changes shape when you shock it with electricity.

To make it produce that pure bell-like tone continuously, it's connected across an amplifier which works just like someone pushing you on a swing so that when you got to just a little past the peak of one swing they'd give you a push to make sure you came back for the next one.

The piezoelectric nature of the crystal causes it to change shape when the amplifier output "pushes" it with an electric signal, and then when the amplifier lets go, the crystal springs back and generates its own signal which says "push me", and sends it to the input of the amplifier at just the right time for the amplifier to generate another push and regenerate the cycle, forever.

So what makes the crystal start oscillating?

Noise.

There's noise everywhere, and it's like zillions of tiny hammers hitting everything all the time.

Some of that noise hits the crystal, and when it's hooked up to the amplifier and starts to ring a little from the noise hits, the amplifier gets the electrical signal from the crystal's physical ringing tone (frequency), builds it up, and sends it back to the crystal. That makes the crystal change shape even more, sending a bigger signal back to the amplifier when the crystal's shape springs back, until the system is oscillating continuously and is stable.

-
Awesome answer which uses simple language to explain it very well. I think it might help to add that the infinite and self-starting oscillatory behavior is due to positive feedback behavior. – Steven Lu Jul 4 '14 at 10:16

A crystal does not oscillate on its own. You don't simply apply power and get oscillations out. Think of a crystal as a very accurate and sharp frequency filter. You put it in the feedback path of a amplifier in the right way, and it causes the circuit to oscillate at the crystal's resonant frequency. It's the circuit that causes the oscillations. They crystal kills all the frequencies except the one it's tuned for, which only allows enough overall loop gain for the circuit to oscillate at the crystal's frequency.

-
That makes good sense. I understand that the voltage coming in creates a distortion and this vibration, but how does it filter? Does it create another electrical contact at a certain frequency or..? – Sciiiiience Jul 3 '14 at 13:06
@scii: A crystal is a small chunk of material that exhibits the piezo-electric effect. This is carefully cut and trimmed to mechanically resonate at the intended frequency. A signal at that frequency causes it to resonate. One off-frequency doesn't. The resonance Q is so high that the frequency has to be very close to right for the crystal to resonate. – Olin Lathrop Jul 3 '14 at 13:10
Okay. One final thing, when the crystal does resonate what happens? Does it pass current? i.e. it only allows current at that frequency to flow. Or does the resignation cause more current? +1 to all your answers thank you. – Sciiiiience Jul 3 '14 at 14:08
@Scii: The electrical view of a crystal is quite complex, but basically yes, it allows the voltage of its tuned frequency to appear on the other side (with the right load), whereas other frequencies are attenuated. There are also phase shifts envolved. In fact, oscillators that require "parallel resonance" crystals are counting on a phase shift at the resonant frequency. The circuit Spehro showed is a example of this. – Olin Lathrop Jul 3 '14 at 14:28
Applying an electric field (voltage) to a piezoelectric crystal causes it to deform. Deforming a piezoelectric crystal generates an electric field. Resonators are cut to ring like a bell (mechanical vibration) at a specific frequency. If this frequency is applied to one side of the crystal, it will resonate and it will generate an electric field in opposition to the one applied, generating a low voltage across the crystal (passing the input signal). If the frequency applied does not cause the crystal to resonate, then the voltage across the crystal will be high (attenuating the input signal). – alex.forencich Jul 5 '14 at 7:12