14
\$\begingroup\$

I'm trying to make a simple but good sine wave generator that will produce 1Vpp @ 1kHz.

Sine waves are nature's oscillations. They're everywhere. So you'd think that it would be a piece of cake to make an electronic sine wave. Apparently not so. SE is riddled with questions on how to make them. There are currently 9 Similar Questions showing on the right hand side of this screen. Most of them seem to have problems.

Low pass filters, high pass filters, ring oscillators and Wien bridges with exotic filament bulbs from 1960. Digital to analogue converters and Arduinos. Most don't seem to work or can't be made to oscillate in a simulation package. Some produce triangles instead of sines. Some designs require knowledge of inductors.

Why is this so hard? Square, saw tooth and triangular waves seem to be easy, yet they don't readily exist in nature. Since they are so useful, I would have thought that I'd just buy a sine oscillator chip (like a NE555 sine variant) , add a resistor and capacitor and off I go with a 99.99% pure wave. Am I missing something, but it seems that simple electronics are not particularly compatible with sine wave generators?

\$\endgroup\$

closed as primarily opinion-based by Scott Seidman, Voltage Spike, PeterJ, Robherc KV5ROB, Armandas Sep 3 '16 at 16:21

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Bottom line - the companies tooled to make them feel there are things they can be doing that are more consistent with their corporate goals. \$\endgroup\$ – Scott Seidman Aug 31 '16 at 1:19
  • 3
    \$\begingroup\$ Also, it appears the AD9833 by Analog Devices is still in production: analog.com/media/en/technical-documentation/data-sheets/… \$\endgroup\$ – Ryan Griggs Aug 31 '16 at 2:18
  • 5
    \$\begingroup\$ "...1Vpp @ 1kHz" Yes, but at what THD, noise, frequency vs temperature stability...? There's a reason Audio Precision still sells multi-thousand dollar testers, which are often used outside the audio arena, purely because they're built around a very high purity sine wave generator, good to ~200 kHz. \$\endgroup\$ – Warren Young Aug 31 '16 at 2:18
  • 4
    \$\begingroup\$ I think some of the challenge is requirements. If you have very low requirements for quality, its easy enough to build your own or go digital. If you have very stringent requirements, you're going to find yourself in a niche market very quickly. \$\endgroup\$ – Cort Ammon Aug 31 '16 at 4:13
  • 1
    \$\begingroup\$ "Simple tuning fork" - but amplitude decays quickly. To get a continuous tone you have to keep striking it (= not pure tone). Electronic equivalent is a simple coil and capacitor (tuned circuit). Same problem, to get continuous oscillation you have to keep 'hitting' it with a pulse stream or amplifier with positive feedback. \$\endgroup\$ – Bruce Abbott Aug 31 '16 at 13:19
1
\$\begingroup\$

If you want a 99.99 % pure signal, the usual square, saw tooth and triangle signal generators fail. As you wrote those signals don't exist in nature and a really precise technical signal of this shape doesn't exist too. A perfect step transition does not exist and a perfect ramp is not real too.

The problem with an exact analog signal generator is the necessary amplitude regulation. A little bit less amplification and the signal slowly disappears, a little bit to much and the sinus signal is distorted. The perfect amplitude regulation is difficult for slow sinus signals.

\$\endgroup\$
25
\$\begingroup\$

The main problem with sine wave generation is that it takes two resonant elements to tango in producing a 180° phase shift -- classically, an inductor and a capacitor. At RF, this isn't a problem -- inductors are easy. However, as you get into lower frequencies, the large inductors involved become unwieldy, which is why alternative sine generation approaches based on multiple RC networks, filters, or shaper networks are used. RC network or filter approaches are good for fixed frequency sines -- the Wien bridge of Hewlett's day is still quite a viable circuit, and simple enough to implement around a dual opamp without a lamp, as there are alternatives to the incandescent bulb for gain stabilization -- Figure 43 in LTC AN43 is your friend here, reproduced below (the appnote has better versions, but Figure 43 suffices to show the concept).

LTC AN43 Figure 43

However, if you need an agile sine source at low frequencies, the Wien-bridge's requirement for a dual gang potentiometer or equivalent electronic element is a downer. This is where all-analog function generator ICs such as the ICL8038/MAX038 and the XR2206 came in -- providing basically what you asked for with reasonable (within a % or two) THD, across several decades. These ICs all used the same basic approach -- an astable with tracking square and triangle outputs, followed by feeding that triangle wave into a circuit known as a "sine shaper". There are several sine-shaper approaches, covered well here -- overdriven pairs can be used to good effect in an IC design, although a more sophisticated approach uses a fully translinear sine shaper circuit a la the (obsolete) AD639. The JFET approach mentioned in the overview link is more practical for discrete parts experiments, despite its amplitude sensitivity, though.

What eventually killed the monolithic analog function generators, though, was digital technology. Modern agile sine sources, such as the AD9833, are the digital equivalents of the triangle-to-sine approach, using what's called a Direct Digital Synthesis technique, in which a phase accumulator is used to divide down a fast square-wave clock into a numerical ramp, which then feeds a ramp-to-sine lookup table. This can be done on a microcontroller as well of course, although such does limit the frequency of operation quite significantly.

Interestingly enough, the demand for accurate sines in the analog world has been reduced nowadays, even at RF -- the realization that the RF mixing function is best implemented by way of digital switching means that square-wave RF local oscillators are a much more viable option than they first seem.

\$\endgroup\$
  • 2
    \$\begingroup\$ @PaulUszak, "I can kick a rusty bucket and it will resonate with a sinusoidal pattern", yes, but it will not be a sustained oscillation. It is not difficult to make something "ring" with a sinusoidal variation in amplitude. The difficulty lies in sustaining that oscillation without it dying out or distorting, as mentioned in several answers. \$\endgroup\$ – Johannes Aug 31 '16 at 8:00
  • 4
    \$\begingroup\$ @PaulUszak your £1 plastic recorder only "makes sine waves" if you don't care about 25% or more total harmonic distortion. And if that is the case, any simple electronic oscillator circuit will be "good enough". \$\endgroup\$ – alephzero Aug 31 '16 at 10:49
  • 1
    \$\begingroup\$ @PaulUszak "Basically isn't a sine wave generator the only way to test anything analogue & audio?" Actually no, because if you're looking at audio then it's very unrepresentative of what it's actually used for. Pink noise is often a much better solution. \$\endgroup\$ – Graham Aug 31 '16 at 11:34
  • 2
    \$\begingroup\$ @PaulUszak -- squares are actually very good for analog testing too -- you can gather a wealth of data based on the step response of a system. \$\endgroup\$ – ThreePhaseEel Aug 31 '16 at 11:46
  • 2
    \$\begingroup\$ @PaulUszak "I want [a sine wave reference] to calibrate my sound card oscilloscope." Well, perhaps you'd be better off posting "How should I calibrate my sound card oscilloscope?" as a question, because there are many severe limitations to using a sound card as an oscilloscope digitizer, including some that will completely distort waves you might be interested in - such as the common square and triangle waves. Calibrating it to a sine wave might give you a false impression of usefulness. \$\endgroup\$ – Adam Davis Aug 31 '16 at 18:06
11
\$\begingroup\$

"Am I missing something, but it seems that simple electronics are not particularly compatible with sine wave generators?"

Let me start my answer with the following sentence:

"A good harmonic (linear) oscillator needs a suitable non-linearity" .

The reason for this apparent contradiction was explained in another answer already: Each "sinusoidal" oscillator needs an amplitude regulation mechanism. For small amplitudes (start of oscillation) the loop gain must be slightly larger than unity - thus allowing oscillation to build up. However, before hard-limiting takes place (supply rail) the loop gain must be reduced automatically to stop further increase.

Hence, we need a circuitry that is amplitude-dependent - which means: Non-linear. As a result, the loop gain swings periodically around "1" - and the closed-loop poles slightly swing between the right half of the s-plane (rising amplitudes) and the left half (decaying amplitudes). It is not possible to place the poles (as required by the theoretical oscillation criterion) directly on the imag. axis of the s-plane.

Now - the problem is as follows: The non-linearity must be (a) large enough to allow a safe start-up of oscillations (with consideration of all tolerances) and (b) as small as possible with respect to harmonic distortions. Hence, a trade-off is necessary.

There are various non-linear elements in use for this purpose (diodes, FET-resistor, OTA as resistor, light bulbs, thermistors,...). However, the best results are obtained using an extra regulation loop (containing rectification and controlled active gain blocks) with a relatively large time constant. This time constant determines the periodic movements of the poles (as mentioned above). Using such principles, THD values in the order of 0.01% are possible.

EDIT: (additional information).

There are oscillator topologies with two or even more opamps which have nice features: One of the opamps performs "soft amplitude limiting" and the ouput of the other amplifier unit is a lowpass/bandpass filtered version of the first opamp. This structure allows surprisingly small THD values. Examples are: Two-integrator loops (with different time constants) and GIC-based oscillators.

\$\endgroup\$
6
\$\begingroup\$

There used to be a couple of nice function generator ICs, the Exar XR2206 and Maxim MAX038.

The XR2206 produced sine, square, triangle, ramp, and pulse waveforms from 0.01 Hz to 1 MHz; the Maxim the same from 0.1 Hz to 20 MHz.

Both are now listed as obsolete on Digi-Key, but you can still find them around, e.g. here at Jameco. Note: "Clearance" for $7.95. For the same price you can get a kit from Hong Kong for a dollar more.

Don't know why they have been discontinued, perhaps people think it's easier just to use a microcontroller + DAC + lookup table.

\$\endgroup\$
  • \$\begingroup\$ (+1) And there was the (old and now also obsolete) Intersil ICL8038 too. I wonder if that is why Maxim chose the 038 part of their MAX038 part number...? \$\endgroup\$ – SamGibson Aug 31 '16 at 1:01
  • \$\begingroup\$ Name those people, because I think they're mad... \$\endgroup\$ – Paul Uszak Aug 31 '16 at 1:17
  • 2
    \$\begingroup\$ ~2% THD doesn't count as "sine wave" for many applications. Test gear meant to check for distortion in other circuits, for one. The chips you talk about are basically triangle wave producers with post-processing to either square the output up or round it off a bit. \$\endgroup\$ – Warren Young Aug 31 '16 at 2:12
  • 5
    \$\begingroup\$ Production IC manufacturing requires an extraordinary amount of overhead, and fabs don't idle well, so it's not feasible to run at low volume. Maxim seldom kills parts, but MAX038 had no volume design wins, despite seemingly every engineer sampling 1 unit and building themselves a bench oscillator. So between no new wafer starts, and no design wins, and the fab upgrading to new equipment (making the masks obsolete), and the distributors charging rent for their shelf space, nobody wants to pay what this part really costs. Maxim would have been better off giving this part away for free. \$\endgroup\$ – MarkU Aug 31 '16 at 6:31

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