[rec.audio] Lots more about R-C sinusoidal oscillators

max@trinity.uucp (Max Hauser) (01/29/88)

You'd better skip over this article if you are not interested in
sinusoidal oscillators or other waveform generators. I've 
cross-posted to rec.audio because some of the examples are actually
from audio test generators.

In response to a request in sci.electronics for simple RC sinusoidal
oscillators, wtm@neoucom.UUCP (Bill Mayhew) very kindly suggests:

> Summary: try a twin T oscillator
> 
> My ancient copy of the ARRL handbook has simple little circuit for
> a twin T single transistor circuit.  It is quite stable.  It
> requires one transistor, 4 resistors and 4 capacitors.  ...

  [Followed by neat on-line schematic]

> ....  Definitely a circuit for Old Farts.  I never really did like
> the light bulb in a Wien bridge.  --Bill

Well, Bill posted a helpful reply, which is more than I did, but
now this talk about RC sinusoidal oscillators among old farts has 
got me going, as I used to work with a lot of circuits for waveform
generation and shaping, and came up with a few of my own. You will
not find them in the Radio Amateur's Handbook, as far as I know.

I have to point out first that any objection to a "light bulb" in a 
Wien-bridge oscillator applies to a twin-tee too, in spades. The 
essential part of a Wien bridge is just a network with two R's 
and two C's (a series R and C from input to output of the network;
a parallel R and C from output to ground), just as the essential 
twin-tee is a network with three R's and three C's. In both cases,
adding sufficient linear gain around the network makes an oscillator,
but a mechanism is needed to regulate the gain if the sinusoid is to
have low distortion, not to mention predictable amplitude.

You can build either oscillator with an explicit automatic-gain-control
(AGC) element (a light bulb as an average-power-sensitive-resistance
is an old and cheap, but by no means the only, form); or you can build
either oscillator with "no" AGC, as in Bill's example, in which case you
are relying on the implicit nonlinearity of the gain element (transistor,
say; rec.audio readers can certainly use tubes [valves] if they prefer
the sound) to regulate loop gain. This is narrowband AGC or "self-limiting
oscillation": as the oscillation tends to grow in amplitude, the gain
element begins to distort, and the gain seen by the component at the
oscillator's fundamental frequency begins to drop (as more and more of
the gain element's output takes the form of distortion, i.e. components
at frequencies other than the fundamental). This gain drops to the point
required to sustain a steady oscillation amplitude. The RC network
as an incidental benefit usually provides some filtering action so that
if the circuit's output is taken at the proper point, distortion 
components there will be small.

The advantage of a light bulb or other long-time-constant gain control
(often a linear variable-gain circuit is used nowadays) is that it can 
leave the oscillation signal path extremely linear and thus yield a
lower-distortion sinusoid, all other things being equal.

If you really want to know "all about" simple sinusoidal oscillators
(amplitude limiting, distortion, frequency stability, etc.), I recommend
Clarke and Hess, _Communications Circuits: Analysis and Design_ 
(Addison-Wesley 1971), the veritable bible of oscillator-mixer-receiver
designers. In any event, though, simple RC sinusoidal oscillators
always entail SOME type of loop-gain control, even if it consists of
a person hired to adjust a knob ("manual" gain control: MGC?).


Three standard, competing RC sinusoidal oscillator configurations,
each based on an RC network added to a gain stage, are the twin-tee
network (which needs three Rs and three Cs, and realizes
a transmission gain of zero, ideally, at a phase shift of 180
degrees); the three-section phase-shift networks (which also need
three Rs and three Cs; the common CRCRCR three-zero form exhibits
a phase shift of 180 degrees at a transmission gain of about 1/29, if
memory serves); and the Wien-bridge network, needing two Rs and two Cs
to show a gain of 1/3 at a phase shift of zero. Many other RC networks
can exhibit the essential property of frequency-dependent phase shift
that passes either zero or 180 degrees at a well-defined useful 
frequency (though if you can devise such a network with fewer than two
capacitors, I'd like to hear from you ...).

Second-order considerations, however, are different for the three
common networks I've mentioned; and they favor the Wien bridge
heavily, in my opinion. First, it needs only four timing components
to set frequency, while the others need six (and the twin-tee has
ratios in it as well). Second, and this is more subtle but no less
practically important, the Wien bridge is the most straightforward
and "designable." The target gain value to turn it into an oscillator
is +3, which is both easy to achieve and easy to set. This value can
be scaled up or down by ratioing the arms of the Wien network. The
phase-shift network is similar in this regard except that it has more
loss and therefore requires more gain to make it oscillate.

The twin-tee, horror of horrors, when you sit down and analyze it,
theoretically requires "infinite" amplifier gain to oscillate, since
the basic network realizes an infinitely deep transmission notch as
the phase shift passes 180 degrees. No finite gain value will permit
it to oscillate.  The twin-tee oscillator works in practice because
the network exhibits a less-than-infinite notch due to component
mismatches, or it oscillates detuned from the nominal center frequency
where it matches the magnitude and phase shift of its companion gain
stage. Besides the annoyance of a circuit that works more poorly as
the components become ideal, it too needs a large (and highly
component-sensitive) gain, as well as six critical RC elements.

(The "ideally non-oscillating" phase-shift oscillator was a witty
topic among bored iconoclast circuit theorists a few years ago.)

Several years ago I had occasion to look into this subject in depth,
needing cheap sinusoidal audio test-signal generators, and this
led to an oscillator circuit that exploited the internal schematic of
CMOS NAND gates in a way that their designers surely did not intend.

You can take a CMOS gate chip; bias properly to operate the transistors
in a linear mode, in which case a 4-input NAND gate becomes a simple
op amp with four inverting inputs; embed Wien-type RC networks, one to
each input, in a summing-junction topology; add a couple of diodes to
a second gate for a controlled soft nonlinearity; and presto, you have
a near-minimum-component RC sinusoidal oscillator that will operate at
up to four different preset frequencies according to which gate input
you enable. This works up to about 40 kHz (M. Hauser, "Programmable
sinewave oscillator uses only one CMOS IC," _Electronic Design_ 
vol. 22 no. 24 p. 200, 22 November 1974; note that a "pi" is missing
from the denominator of the frequency expression). I also put a similar
one in Popular Electronics for another purpose at about the same time
(that was in the Good Old Days, after Poptronics had merged with 
Electronics World, but when it was still about electronics).

If you want continuously variable frequency, these RC networks all
lose because they require tandem adjustment of multiple component
values. Tom Fredrickson and co. at National Semi were pushing, 
several years ago in the NSC Linear Application notes, a better
approach to easily-tuned RC sinusoidal oscillators based on 
comparators in feedback with 180-degree phase-shift networks; if
you change the network via a single resistor, it changes the 
180-degree frequency and also the gain, but the gain no longer 
matters, since the comparator detects zero-crossings and depends on
the phase-shift circuitry to clean up its output waveform.

There is always the tack, taken by Intersil in the horrible 8038 
and more successfully later by Exar in the 2200 series oscillator
chips, of a (integrator-and-hysteresis) triangle-wave oscillator 
followed by a nonlinear network to shape the triangles into sinusoids.
These methods yield easy frequency tuning, but are much more
complicated in design than simple fixed sinusoidal RC oscillators.

Square waves, of course, are easy to generate by various means, and
they can be both extremely stable and also frequency-selectable, via
crystals, counters, etc.  Unfortunately squarewave frequency sources
are awkward starting points for other waveforms over any sort of 
frequency range, unless you use a high-frequency clock, generate the
waveform numerically, and run it through a DAC (shudder); or lock a 
controllable oscillator of desired waveform to the squarewave source;
or employ a variable-frequency filter.

Another approach that I used, to convert audio-frequency square waves
directly into triangle waves, with constant amplitude over a wide 
frequency range, uses a capacitor and current switch to generate
triangle waves whose slope is set by an external current. In turn 
this current comes from another subcircuit that measures the period 
of the incoming square wave, obtains its reciprocal directly (thus an 
analog current proportional to input frequency) in a little Gilbertoid
"translinear" circuit, and uses that to correct the ramp rate for 
the changes in input frequency so that the triangle amplitude stays
constant over different squarewave frequencies. My instrumentation 
application needed only square and triangle waves, but in principle
sinusoids are again available by post-distorting the triangles.

An early version of that circuit appeared in _Electronic Design_
("Square-to-triangle-wave converter provides constant amplitude, 
rapid response," vol. 25 no. 24 pp. 160-162, 22 November 1977),
including further references to triangle-sine converter circuits.

I don't think that I can render that or the CMOS circuit on-line
as Bill did, but they should be available in technical and college
libraries if any circuit hackers are interested. Should you be unable
to find them, I do have some copies that I'm happy to part with ("as
a service to the net") at least until they are used up. Send a
self-addressed stamped envelope to Max Hauser, P. O. Box 7051, 
Berkeley, CA 94707, USA (no e-mail requests, please). Specify which
circuit you want, if not both.

Light bulbs, indeed.


Max Hauser, circuit hacker 
max@eros.berkeley.edu / ...{!decvax}!ucbvax!eros!max

"This ... demonstrates the soapbox phenomenon. Given any slim excuse,
99.624 percent of all persons will sound off. Given no excuse at all,
99.608 percent of them will do so."         -- Mary-Claire van Leunen