I've a 1 MHZ crystal oscillator.

I want to generate a Square wave of 1 MHZ using the crystal oscillator.

How to connect it and what are the needed components?

  • 3
    \$\begingroup\$ What duty cycle? What rise/fall time is required? How tight a tolerance do you need to those values? \$\endgroup\$
    – Polynomial
    Commented Nov 19, 2012 at 12:50
  • 3
    \$\begingroup\$ Do you have a part number or datasheet for the crystal oscillator? \$\endgroup\$
    – Justin
    Commented Nov 19, 2012 at 12:51
  • \$\begingroup\$ Hope this will help you axtal.com/data/publ/ukw1979_e.pdf \$\endgroup\$ Commented Nov 19, 2012 at 12:53
  • \$\begingroup\$ See if page 24 from "Saneesh AT" link above will work for you. \$\endgroup\$ Commented Nov 19, 2012 at 14:44
  • 4
    \$\begingroup\$ If you want a 1MHz square wave, I would suggest using a higher frequency crystal and dividing it down, for two reasons: (1) 4MHz crystals are apt to be cheaper and easier to find than 1MHz ones; (2) Getting a 50.0000% duty cycle from a crystal is a bit tricky; by contrast, if one converts the signal from a crystal into a pulse wave (just pass it through an inverter or two) and divides that down, the resulting wave will "naturally" have a perfect 50% duty cycle. \$\endgroup\$
    – supercat
    Commented Nov 19, 2012 at 16:52

2 Answers 2


Choice depends on MANY tradeoffs such as: cost, volume, stability, temperature range, frequency, package size, power consumption, phase noise, etc You have to specify all or we make assumptions.

  • The "sweet spot" for fundamental AT cut Xtal's in micro-slice low cost EMD package is 4 or 8MHz to divide down to 1MHz. Lower is bigger and more expensive, much higher tends to be overtone harmonic and less stable.

  • 50 ppm stability is standard, 30 ppm is avail for -20~+70'C, much less is not possible unless you choose a VCXO 1ppm or a narrow temperature range.

  • 50 ppm tolerance is standard at room temp. design can null this but costs more than sorting if you can tolerate 30 ppm or 15 ppm as cost goes up with small sort bins. 50ppm tolerance is $0.15 @1k and 30 ppm is $0.20 @1k assuming SMD 4 or 8MHz. enter image description here

  • Standard CMOS parallel resonant oscillator is easiest and lowest parts count, but use NPO caps to create parallel load of 15 to 20pF typ as specified with 2 caps on either side.

Although you can get better phase noise results with a discrete filter Pierce oscillator design, the standard CMOS inverter works well for most.

enter image description here

  • C1 + C2 = Cload
  • R = self bias 1~10MΩ
  • R1 = limit power dissipation in Xtal (uW) is usually 3~10KΩ
  • 2
    \$\begingroup\$ This worked perfectly with R=1MΩ, R1=3.3KΩ, Cx=22pF, XTAL=16Mhz. And I've managed to save Atmega from External Clock mode (in case anybody searches it). Thanks. \$\endgroup\$ Commented Jul 6, 2014 at 7:39
  • \$\begingroup\$ Some questions. Is there a way to calculate R and R1 or just trial and error between those values? Do both caps have to have equal values? Where is the output in that circuit? \$\endgroup\$
    – Iaka Noe
    Commented Jun 4, 2019 at 21:17
  • \$\begingroup\$ R = 1~10MΩ usually internal to uC, R1 = 3~10KΩ while C2 may be smaller to include Cin and stray C of x pF. Depends on room temp. accuracy you want. e.g. C1 and C2 are effectively in series but C1 being on the high impedance input side has Cin x pF and stray to ground x pF so often you see C2 smaller by 3~4 pF dpending on Cin and stray. e.g a 16pF Xtal needs 32pF for both caps with C2 reduced by stray and C-input of inverter If C is too high because you ignored Cin and stray C it would run a bit slower by xx PPM \$\endgroup\$ Commented Jun 4, 2019 at 21:44

Since you have not provided any specific details of the crystal oscillator, I'll have to take a generic approach:

  1. Use a diode clipper circuit if you want a not-so-accurate square wave. Since the frequency you are using is reasonably high (and you have not specified for what application the osci. output is used), this gives you a pretty decent almost-a-square wave.

  2. Since crystals provide with the purest sine waves available, you can get a unity duty cycle wave. You can use a Schmitt trigger to convert the sine wave to square wave quite accurately depending on the quality of components you are using. This trigger circuit can also give you variable duty cycle waves depending on the input you give to it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.