How to get a clock signal from a crystal oscillator - Page 1
Forum section: electronics / beginners

author: igendel
author_rank: Frequent Contributor
timestamp: September 12, 2017, 02:04:07 am
content: Hi all,How can I generate a stable clock signal (say, 5V square wave) from a simple Crystal oscillator (e.g. those metallic HC-49 package kind)?Specifically I'm looking at 1 to 2MHz range, but a more general answer will be appreciated tooI'm asking this because I have this IC which has a clock-in pin, and I have these crystals, and I want to make them work together...

author: Rerouter
author_rank: Super Contributor
timestamp: September 12, 2017, 02:08:17 am
content: I would say use 2 inverters, 1 is the main oscialltor, 1 is the buffer to reduce loading effects.The main inverter has a series resistor if lets say 1K for that frequency, going to one of the crystals pins, you have your loading capacitors of roughly equal to your crystals capacitance, then the other end of the crystal feeding the inverter input, you would also want to place a 1M resistor across the output and input of this inverter to make sure it starts up reliably.The second inverter would take the same input as the first and is acting as a buffer.

author: rs20
author_rank: Super Contributor
timestamp: September 12, 2017, 02:10:30 am
content: Quote from: Rerouter on September 12, 2017, 02:08:17 amThe capacitors are supposed to be equal to the load capacitance (maybe x2 or /2) states in the datasheet, right? Something like 18 pF often. Seems like assuming that it's equal to the measured capacitance of the crystal is asking for trouble?

author: Rerouter
author_rank: Super Contributor
timestamp: September 12, 2017, 02:13:58 am
content: It will get it going, it may not be 100% stable, but it will oscillate at roughly that frequency, At the same time i am ballparking the series resistance for the crystal, and my advice could be massively overdriving the thing, but it should get it going.

author: rs20
author_rank: Super Contributor
timestamp: September 12, 2017, 02:21:58 am
content: Fair enough, it just seemed a bit odd to give such definitive-sounding advice when that's not the nominal value at all. Point granted that it'll probably oscillate, albeit not at the right frequency.Anyway, if one wants to nerd out and get an accurate frequency,this adviceseems helpful.

author: igendel
author_rank: Frequent Contributor
timestamp: September 12, 2017, 02:30:04 am
content: Quote from: Rerouter on September 12, 2017, 02:08:17 amOk, a bit slower please...Inverter - would that be a NOT gate, like those Logic ICs?1K resistor - How did you decide on that value?Loading capacitors - Those between the crystal's pins and GND?

author: Rerouter
author_rank: Super Contributor
timestamp: September 12, 2017, 04:56:52 am
content: Yes a not gate. The series resistance i chose as 12MHz is 200 ohms, and a 32k is a few K. This is to limit the amount of heat on the crystal. You want it strong enough to be stable. But not so much that the crystal begins deforming.The capacitors i mentioned are the 2 to ground. With this gain limited oscilattor you should be able to use calculators like those for an arduino328p.The 1M resistor across the inverter is what makes it gain limited.

author: Ice-Tea
author_rank: Super Contributor
timestamp: September 12, 2017, 06:55:39 am
content: Just to be clear: you can get the wholde deal, with a nice logic clock signal out, in a single package as well...

author: igendel
author_rank: Frequent Contributor
timestamp: September 12, 2017, 07:39:14 am
content: Quote from: Rerouter on September 12, 2017, 04:56:52 amGreat, thanks - I'll give it a try as soon as I can.Quote from: Ice-Tea on September 12, 2017, 06:55:39 amI've been looking for something like this too, but couldn't find an exact match - the closest thing was PLL clock multipliers. Can you please tell me the name of a specific component? Thanks!

author: rs20
author_rank: Super Contributor
timestamp: September 12, 2017, 07:52:35 am
content: Quote from: igendel on September 12, 2017, 07:39:14 amDigikey.com.il oscillators between 1 and 2 MHz.

author: igendel
author_rank: Frequent Contributor
timestamp: September 12, 2017, 08:32:06 am
content: Quote from: rs20 on September 12, 2017, 07:52:35 amOh, I thought you meant an IC that takes a passive crystal and outputs a clock signal. I already have the crystals.

author: David Hess
author_rank: Super Contributor
timestamp: September 12, 2017, 09:52:31 am
content: Quote from: igendel on September 12, 2017, 02:04:07 amAN12 - Circuit Techniques for Clock Sources - Linear TechnologySingle transistor crystal oscillators are more reliable than gate oscillators but gate oscillators are usually good enough.

author: danadak
author_rank: Super Contributor
timestamp: September 12, 2017, 10:36:00 am
content: Google "crystal oscillators application note", lots of hits, on designconsiderations.https://1drv.ms/f/s!Al2JgiX7_qf0iw6V0-oqd0dY7YPdRegards, Dana.

author: igendel
author_rank: Frequent Contributor
timestamp: September 12, 2017, 11:04:20 am
content: Quote from: David Hess on September 12, 2017, 09:52:31 amThanks, I'll read that.Quote from: danadak on September 12, 2017, 10:36:00 amYes, I definitely should have thought of that

author: Ian.M
author_rank: Super Contributor
timestamp: September 12, 2017, 03:56:20 pm
content: If you want to use the crystal in a Pierce oscillator using a logic gate, read T.I'sUse of the CMOS Unbuffered Inverter in Oscillator CircuitsThe various crystal manufacturers Pierce oscillator notes are often also worth a read. e.g.http://www.rakon.com/component/docman/doc_download/223-ic-crystal-oscillator-circuits?Itemid=Its worth noting that probing such an oscillator with a x1 scope probe at the inverter input side of the crystal will almost certainly stop it and even a x10 probe will disturb its operation either side of the crystal and may cause a marginal oscillator to either start working or fail when probed. If you *really* need the waveform and don't have a low capacitance active probe, you need to replace the load capacitance with the probe + a much larger series capacitor to block DC e.g. 1.5nF, with a shunt trimmer adjusted so the capacitance 'seen' by the crystal is the same as the removed load capacitor.

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2017, 06:28:57 pm
content: As mentioned above, you need to use an unbuffered logic gate. I like the 74LVC1GX04 because it's compact, but the 74LVC1404 should be better, because it has a Schmitt trigger buffer and a disable option to save power, when it's not needed.http://www.ti.com/lit/ds/symlink/sn74lvc1gx04-ep.pdfhttp://www.ti.com/lit/ds/symlink/sn74lvc1404.pdf

author: igendel
author_rank: Frequent Contributor
timestamp: September 13, 2017, 12:06:30 am
content: Quote from: Ian.M on September 12, 2017, 03:56:20 pmHmmm... a serious trap for young players!Thanks for the warning. I'll probably test the square wave by feeding it as an external clock for a little MCU and watching the Clock Out signal.Thanks again everyone for the valuable information!

author: CD4007UB
author_rank: Contributor
timestamp: September 13, 2017, 01:04:55 am
content: For a 1 or 2 MHz clock, you could use an old-fashioned CD4007 chip - cheap, versatile, and still available in a through-hole package (rather than SMD), which makes it easy to use on solderless breadboard. Some of our students have fun building a quartz oscillator as a project.For a simple introduction, see Ray Marston's article athttp://www.nutsvolts.com/magazine/article/fet_principles_and_circuits_part_3.

author: igendel
author_rank: Frequent Contributor
timestamp: November 17, 2017, 10:15:04 am
content: So it's been a while... I had some delays because of the crystals I thought I had, eBay sellers etc., but I finally got to doing this.Here's what's on the improvised circuit:- NOT gate by TI (SN74AHC1G04)- 1.8432MHz crystal with 18pF load capacitors (I guessed the value - the crystals came with no datasheet)- 1M resistor between inverter input and output.- 1K resistor in series from inverter output to crystal input. It's small but it's thereI started by giving it 5V and measuring the output with the scope (Keeping in mind the warning about this), x10 probe.The frequency looks very good (well, for a nameless crystal anyway), but the ringing is crazy - the resulting signal is 9V peak-to-peak!Now, what are the odds that the ringing is just an artifact from the probe? I wouldn't want to feed these extremes into the clock pin of an MCU...

author: Ian.M
author_rank: Super Contributor
timestamp: November 17, 2017, 10:30:26 am
content: 74AHC without a ground plane and local decoupling right next to the gate's Vcc pin is asking for trouble. I don't see any decoupling on that board at all. If you think the ringing may be a probe artefact due to excessive ground lead length, remove the probe ground clip and tip spring hook, stretch some bare wire and wind it around a suitable former to form a three turn coil that fits snugly on the probe ground ring, bend the end at rightangles to lie parallel with the probe tip, cut it to a point the same length as the probe tip, and probe directly at the IC pins. The rightangle bend *MUST* be touching the ground ring.

author: PA0PBZ
author_rank: Super Contributor
timestamp: November 17, 2017, 10:36:40 am
content: Quote from: Ian.M on November 17, 2017, 10:30:26 amOr, without so many words:

author: Ian.M
author_rank: Super Contributor
timestamp: November 17, 2017, 10:48:04 am
content: Nice picture of the commercial offering, but with the rightangle away from the ground ring, its got more self-inductance than if its right up against it, and you need springy brass wire as copper wire of that diameter will be too floppy at that length side-arm, so it isn't ideal for DIY. Either will be vastly preferable to a 4" ground lead.Another approach is to form a single turn ground spring from copper plated steel wire (e.g. MIG wire) with the leg at rightangles to the coil, and solder the leg direct to the nearest ground point, bending it so the probe tip will be right on the signal to be tested. With care, and a helping hands supporting the probe body, that can let you do hands-free measurements.

author: igendel
author_rank: Frequent Contributor
timestamp: November 17, 2017, 11:19:09 am
content: With all the excitement I forgot to decouple the inverterI added a 0.1uF ceramic (THT) to the inverter Vcc now, It actually made the output messier (because there's no proper ground plane?), the scope couldn't even find an alignment by itself, thought it was 30MHz or something.Removed the decoupling cap, tried to probe without the long ground wire (I don't have a suitable brass wire so I improvised something similar). The ringing got better, especially the undershoot, but still significant (see image).

author: Rerouter
author_rank: Super Contributor
timestamp: November 17, 2017, 11:30:55 am
content: If your happy with your probing technique, try upping that drive strength resistor to 4.7K,It is likely not so much a ground plane (your distances are way smaller than tranmission line theory), but where the 2 capacitors meet with ground, ideally they would be directly at the inverters GND pin, this way you close the loop to being as small as possible, reducing inductance,

author: Ian.M
author_rank: Super Contributor
timestamp: November 17, 2017, 11:51:51 am
content: 74AHC outputs typically have a slew rate of approx 0.5V/ns. For a transition between 0 and 3.3V that will give approx 6ns risetime unloaded. That transition 'looks' like a 1/4 cycle of a >600MHz sinewave, so if the scope and active probe bandwidth is under 500MHz you haven't got a hope in hell of seeing what's actually going on, and you really need 1GHz bandwidth to be certain. During the risetime, the gate pulls a current pulse from its supply, which can be approximated as a half cycle at >1200 MHz. That would be above the self resonant frequency of a 100nF leaded cap. Fortunately the situation will be a bit better as soon as the gate is loaded, but the transition is still likely to have HF components >100MHz.Hook up your probe to a Jim Williams pulse generator (seehttps://www.eevblog.com/forum/blog/eevblog-306-jim-williams-pulse-generator/) and see what the ringing looks like. If its period is similar to that you are observing in your oscillator circuit, odds are, its a probe artefact.For decoupling, try 1nF ceramic in a small SMD package, glued directly on top of the chip, and wired as directly as possible to its power and ground pins. Put the 0.1uF leaded ceramic across the power input to the breakout board, and *PRAY*!

author: igendel
author_rank: Frequent Contributor
timestamp: November 17, 2017, 12:09:45 pm
content: Quote from: Rerouter on November 17, 2017, 11:30:55 amNo good - the ringing was a bit more pronounced with 4.7K than with 1K.Quote from: Ian.M on November 17, 2017, 11:51:51 amNow where do I get that kind of pulse generator in a short notice?Soldering an SMD cap on that chip would be quite a challenge now... I'll give it a try later today. Thanks!

author: StillTrying
author_rank: Super Contributor
timestamp: November 17, 2017, 12:30:06 pm
content: Quote from: igendel on November 17, 2017, 11:19:09 amAt least you now know the frequency of the ringing.Why are you viewing a 5V signal on 5V/div. If you used the next sensitivity up 2V/div. you'd see more detail, triggering would be easier/more stable, and the Auto Max. Min. and Vpp numbers would be more accurate.

author: Ian.M
author_rank: Super Contributor
timestamp: November 17, 2017, 12:57:40 pm
content: Quote from: igendel on November 17, 2017, 12:09:45 pmBuild it Manhatten style on a scrap of copper clad FR4 - the 90V supply can be done with 10x really cheap zinc carbon PP3 batteries from the market, so you can discard the PSU circuit (the 10Meg-24K divider chain + everything to the left of it). For the 50R emitter resistor, its best to use two 100R SMD resistors upside down either side of the output pad to minimise inductance. Breadboard the circuit with 100pF for C2 and if you cant easily source a few 2N2369 transistors to try, try different low Vceo, high Ft transistors till you find one that pulses reliably. RF transistors are more likely to avalanche than most switching transistors. If you are using a through hole transistor, its probably best to drill a hole in the PCB and mount it up-side down for minimum lead length. Caution: metal can transistors usually have the can connected to the collector - you'll need to countersink the hole slightly to remove a ring of copper to avoid shorting it out.See AN47, appendix D, page 93 ofhttp://www.linear.com/docs/4138Also note that C2 can be replaced by a long length of coax for a flat(ish) topped pulse. 10m of 66% velocity factor coax will give you a pulse duration of about 50ns, which will resemble a half cycle of a 10MHz squarewave.