# How to build an accurate oscillator around 1 kHz?

Is there a way to build an accurate oscillator producing a sine wave for a single fixed frequency in the 500 Hz - 5 kHz range, using relatively common components?

• Any frequency within this range would be fine (although somewhere around 1 kHz would be preferred), as long as this frequency can be accurately obtained in practice, within 1% or better of the theoretical value.
• Some distortion of the sine wave is not critical, as long as the fundamental frequency is at the specified value. (In fact, other wave forms would be an acceptable comprise if a sine wave is too difficult.)
• The only power supply available is 0-5V DC. The output should also be within 0-5V (although not necessarily reaching those values).
• 1% accuracy at 1 Khz would not commonly be considered "Accurate". 200 and 50 PPM crystals are commonly available. – Connor Wolf Apr 20 '13 at 2:29

I think the DDS is the way I'd do it but, if you want a straight 5V logic solution you can use a 4060 logic chip. Here's one - the device uses a reference frequency from a crystal (or RC network) and offers a frequency divided down version - it's a 14-stage binary ripple counter and if you use a 1MHz clock you can easily derive 976.56Hz.

Next, if you are not happy with a square wave you can apply low-pass filtering to extract the fundamental frequency. Depending on how much low-pass filtering you do determines how pure the sinewave is. Here is a good application note about turning squares into sines. None of it is rocket science hence I'm letting the links speak for themselves.

• I'm interested in where did you get 1.024kHz from. – TNW Apr 20 '13 at 13:46
• @TNW oops I meant 976.56Hz. I should have divided 1e6 by 1024! – Andy aka Apr 20 '13 at 14:56
• Thanks you. I've just tried this on a breadboard with a 32kHz crystal, R2=2.2kΩ, Rbias=330kΩ, C2=33pF and C3=100pF (using Fig 13 in the 74HC4060 datasheet). Yet, I've connected the Q3 output (freq/8) to an LED and I can see it flash at about 1-2Hz. I would expect not to be able to see anything 32kHz/8, but to be able to see it blinking much further in the divider (around Q13). In fact, removing the crystal from the circuit altogether produces very similar results. Any idea what could have gone wrong? – Bruno Apr 20 '13 at 15:02
• I'm not sure why it'd still oscillate without the xtal. I've never used it with a xtal below 1MHz - maybe there is something about the device that means it doesn't like 32.758kHz xtals in that configuration and maybe removing the xtal causes some spurious oscillation that is undocumented? – Andy aka Apr 20 '13 at 15:23

For a stable, low distortion sine wave of a fixed frequency, consider one of the several Direct Digital Synthesis ICs from Analog Devices. There is an excellent introduction to DDS here.

The way DDS ICs work is: Memory within the device contains data for all supported waveforms, most commonly supported being the sine wave. The device uses an external clock or oscillator of frequency much higher than the desired frequency range, to generate the desired waveform at the desired frequency.

Both stability and waveform purity achieved are very high, so long as recommended output filter capacitors are used.

The Analog Devices AD9850 is a good option for the purpose described in the question, providing a highly accurate, spectrally pure analog sine wave all they way up to 40 MHz. The frequency tuning resolution is 0.0291 Hz across the entire range.

Reference schematics and even PCB layouts are provided towards the end of the datasheet.

Alternatively, if there is a requirement to test out the functioning of a DDS in a pre-built module before jumping into design, such modules are available on sites like eBay for under $5 including shipping. A microcontroller will be required for sending the frequency tuning commands to the DDS IC. • At 1kHz that's probably overkill. A microcontroller with a DAC should work just as well. – starblue Apr 20 '13 at 11:26 • Agreed but at$4.50, it's a worthwhile tool to have around, as well. – Anindo Ghosh Apr 20 '13 at 11:33
• I wonder how they can sell it at that price. Digikey lists the AD9850 at around 20€. – starblue Apr 20 '13 at 14:51
• @starblue At the electronic components street market in Mumbai (where I live), the AD9850 retails at around \$5.56 (INR 300) in single units and less than half that for a cut tape of 100 units. On the other hand there are weeks on end when the part is not available at all. I assume Digikey adds in a mark-up for low volume parts, as inventory management cost. – Anindo Ghosh Apr 20 '13 at 20:25

The first thing that comes to mind is an XR2209. That would be quick, easy, and outputs triangle or square waves. If you really want a sine wave, it's easy enough to get there.

• I'm not sure a voltage-driven oscillator, where f=1/(RC) (in the example from the datasheet) would achieve the required precision, since R and C are likely not to be that precise. – Bruno Apr 20 '13 at 15:21

## protected by W5VO♦Apr 20 '13 at 0:27

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).