A sweet little one-transistor crystal oscillator for the Project14 | Making Time season. In Project14 spirit, it's only 5 ultra-cheap components. Just off the border between analogue and digital. With the 5 components we'll make a Pierce crystal oscillator. One of the most commonly used oscillators in microcontroller circuits. |
The circuit is often used in digital designs, because that's where we need clocks. But in essence it's an analogue circuit.
Like every oscillation circuit, we have to have a gain > 1 at the requested frequency, when the phase is 0 or 360°. So that the circuit keeps energising itself.
This is the extremely simple schematic that does that :
source: National Semiconductor application note 32.
I'm going to take a lot of jumps here over the difficult stuff:
- the JFET is an inverter, and gives us 180° of phase shift.
- the rest has to be approximated by the rest of the circuit.
You can take this for granted, or read the document from Ramon Cerda that I provided in the sources below.
The better you approximate the 0° / 360° goal, the efficienter your oscillator.
But it's very forgiving:
- we are already over 180° . Before 180°, gain works against us. Once this cliff is taken, gain supports the oscillation.
- the JFET has plenty of gain
- the crystal is a narrow band device
So even when things are terribly off, the circuit will still want to oscillate at the crystal's frequency.
I had guaranteed success with crystals between 12 and 19 MHz. Even if the power supply ramped up slowly and there was no hard trigger event to kick off the play.
With a 4 and 4.4 MHz crystal, I had to disturb the circuit (introduce some bounce by wiggling the crystal in the socket) to get the circuit oscillating.
How to Build?
What components did I use:
- a 100 µH inductor, retrieved from a defunct VCR player Product LinkProduct Link.
- a J112 JFET Product LinkProduct Link.
- any 1 nF capacitor (ceramics will do just fine) Product LinkProduct Link.
- any 10 MΩ resistor Product LinkProduct Link.
- leftover female headers for power supply, output and to place different crystals.
- a few crystals, from anywhere, or this very common one: Product LinkProduct Link.
- leftover perfboard. I built it on an 8 * 6 matrix.
Don't breadboard this circuit. It's over 10 MHz. Use perfboard or a plain copper clad PCB. Or point-to-point.
That said, you can see in the comments that jw0752 successfully built one on a breadoard.
- a DC supply between 3 V and 18 V. A single CR 2032 coin cell will do. Or a pair of AA(A)s, a 9 V battery, etc. or your bench supply.
Here's the schematic I used. The same as the application note . Just couldn't locate a 1 nF capacitor.
I then made a rough drawing of the perfboard layout
... and built it like that:
Here is that same layout, but redrawn after all was finished.
This can help to replicate the project on some perfboard:
I gathered some crystals from my throwaway pile:
... and tested them.
Above with a 12 MHz crystal. Below is a scope capture with a 16 MHz crystal. Circuit powered by a 3.3 V supply:
Here's the Pierce crystal oscillator in action:
That's the build. The remainder of the article are some further investigations in the use and operation. Feel free to skip.
The Pierce Oscillator in Practical Applications
If it is so common in microcontroller circuits, why don't I ever see the inverter or JFET on modern designs, or on LaunchPads, Arduinos, MBED boards? That's because most microcontrollers have the inverter part of the circuit implemented internally already. You just need to provide the crystal and 2 capacitors. Here's a Hercules ARM microcontroller datasheet's schematic of the internal parts (abstracted). In essence it's the same Pierce circuit.
|
Why do I say it's an analogue circuit, when it is often implemented with a NOT gate? Well, you'll see that when a NOT gate is used, the designers put a resistor in parallel between the output and input of the gate. source: the article William bases his design on. That resistor, together with the gate's input impedance and the capacitor at the input, turn this gate into an analog amplifier. We're perverting its digital behaviour and turn it into a high gain transistor (like, say, a JFET ). That's why it only works with a subset of logic NOT gates. It wouldn't work if you'd simulate one in an FPGA. You'd expect a perfect square wave on the output, but I challenge you to build this circuit and probe the output. |
source: photo of Figure 7.38A taken from my copy of The Art of Electronics
The exact same design is featured in The Art of Electronics by Horowitz and Hill. They use a 2.5 mH and the now as good as obsolete 2N5485 JFET. |
Looking at Gate vs Output
This is a common source n-channel JFET design, where the source is tied to the ground and is shared by input and output.
Here are the gate and drain captured, relative to that source (ground) shared point
The input source is a 9 V battery.
Both signals use the same 0 position on the oscilloscope screen and the same scale.
: The ground level is where you see this in the image below.
As you can see, there's a lot happening.
One of those things is, that the gate is being pushed down to 15 V negative.
Sources:
The design comes from a National Semiconductors (now TI) Application Note.
The discussion of splatkillwill was the inspiration for this post.
The excellent article of Ramon Cerda dives into the practical considerations when building reliable oscillators.
Top Comments