Fork me on GitHub

Project Notes

#197 WienBridgeAudioToneGenerator

A fixed-frequency tone generator based on a Wien Bridge Oscillator

The Build

Notes

I wanted a simple tone generator to provide a test signal for audio projects:

  • fixed frequency is OK
  • as close to a pure sinusoid as possible
  • AC-coupled output
  • some gain/attenuation control would be nice

This sounded like a good application for a Wien Bridge Oscillator.

Wien Bridge Oscillators

A Wien bridge oscillator is a sinusoidal oscillator with a resonant frequency of:

f = 1/(2πRC)

The resonator comprises essentially:

  • R-C series High Pass Filter, connected (at the non-inverting input of the opamp) with:
  • R-C parallel Low Pass Filter In other words a Band Pass Filter with a high Q factor at the resonant frequency.

The combined resistance and reactance of the RC circuits results in an average voltage input to the non-inverting opamp input of 1/3 the upper voltage rail. this is why the opamp needs a gain of 3 in order ot sustain oscillation.

Design Decisions

To generate an audio frequency, I’ve selected R=10kΩ and C=10nF, for a theoretical resonant frequency of 1.592kHz.

I’m using a venerable LM324 opamp. It doesn’t have great upper and lower limits, and without stabilisation, this leads to serious clipping. See notes later on diode stabilisation.

The opamp in the oscillator is configured for a gain of just over 3 (100kΩ/47kΩ).

Instead of dual rails, I’m using a single rail supply (tested at 5V and 9V). One opamp in the LM324 is used to buffer and 100kΩ voltage divider, thus providing a stable “virtual ground” at Vcc/2 for the oscillator (VGND in the schematic).

A third opamp in the LM324 is used to buffer the oscillator output to avoid any load inpact on the oscillation.

The 4th opamp unit in the LM324 is unused.

Test Results - Breadboard Build

On a breadboard, the circuit oscillates without trouble, but the frequency (~1.195kHz) is unsurprisingly quite a bit off the theoretical.

The basic circuit (without diode stabilisation) also gets clipped severely because the LM324 output can’t get close enough to its rails. In these scope traces:

  • CH1 - AC-coupled output
  • CH2 - DC-coupled non-inverting input
  • CH3 - VGND

no_diode_10nf_5v

To avoid the clipping, we need the oscillation to stay away from the rails, yet still hit > 3 gain to ensure the oscillation is sustained. One technique is “diode stabilisation” that effectively clamps the maximum voltage drop across one resistor in the opamp feedback loop.

After some experimentation, I decided to double up the 1n4148 diodes to squeeze a decent gain out of the circuit while still avoiding clipping issues. The diodes do distort the waveform however, so although it still looks OK, it’s not a pure sine wave. Here’s the breadboard circuit with diode stabilisation:

dual_diode_10nf_5v

That is looking pretty good. Next step was to put the circuit on a proto

Test Results - Protoboard Build

Once on a protoboard and in a case, the circuit behaviour is even better. Actual frequency is ~1.574kHz, very close to the theoretical resonant frequency of 1.592kHz.

Here is the output waveform:

final_build_scope

And in the frequency domain we can see the waveform is reasonably clean:

final_build_scope_fft

Construction

Breadboard

The Schematic

WienBridgeAudioToneGenerator_bb_build

Putting it in a case

WienBridgeAudioToneGenerator_pcb_layout

WienBridgeAudioToneGenerator_build_wip

The Build

Credits and References

About LEAP#197 OpAmpOscillators
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.