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

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

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics projects - 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.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader