Electronics with passion: amplifiers and power supplies, FET's and vacuum tubes..
audio

Budget Wien bridge oscillator with low THD

 [Читать на русском]

 

 

How can one tune the best in class audio amplifier without using a top quality signal source? DIY Wien bridge oscillator comes to rescue!

 

In this article:

  • Linearity of professional equipment using budget OpAmps
  • Low distortion precision AGC
  • Can be battery operated: minimized EMI

 

How things began

At the beginning of this Century my family and I have suddenly decided to move quite far from our home Country. Some of my electronic junk parts collection followed us, but big chunk of it we had to abandon. Once settled in a new living space I wanted to finalize my home brewed mono-block amplifiers ASAP and finally start listening to the music. By the way the biggest part of the belongings we transported with us consisted of books and CD's.

I was lucky that our new best friend in our new home Country possessed a decent oscilloscope that I could borrow from him for a while. But a quality source of the test signal remained an open question. Also at that time I did not know right ways to purchase components here. Frankly speaking by then I was still more used to scavenge parts from scrapped things 🙂 Hence I found few antique OpAmps made in USSR and a couple of those LM324 scavenged from dead PC power supplies.

LM324 datasheet: National/TI, Fairchild, OnSemi...
I must confess that I love reading NatSemi' datasheets - they provide plenty of smart schematic examples where you can learn a lot. OnSemi also did quite well here. Shame on Fairchild regarding educational aspect of their LM324 documentation 🙂

 

Good old classics

Wien bridge oscillator surely is well known even to the folks just starting their careers in electronics. Nevertheless there are few tricks can be applied to the basic schematic. The tricks described further on will allow even a beginner to build the sine wave generator of the outstanding quality while using ordinary and easily available components.

Wien bridge oscillator

Provided R1=R2 and C1=C2 the generator frequency can be calculated as follows:

On this frequency the filter (highlighted in green) will have attenuation ratio 1/3 and zero phase shift. To balance the bridge and make the generator working correctly we need to provide identical conditions in the other side of the bridge. Therefore the negative feedback divider (selected in blue) has to comply the formula R4 = 2 * R3.
Unfortunately in the real life there is no such thing as identical resistors or capacitors. Also the real OpAmp can possibly not have the infinite amplification factor. Add to this equation fluctuations of parts parameters caused by the temperature changes etc. Should one construct the generator as depicted above - it will either seize generation or go wild producing crazily distorted signal.

 

Automatic Gain Control

There are well known solutions for Wien bridge oscillator that help keeping its amplification in the desired limits. Either R3 or R4 gets replaced by some non-linear component: small bulb, thermo-resistor, diodes, opto-coupled resistor or FET. A variation on the theme of the latter solution is being discussed here.
In order to achieve really low THD (Total Harmonic Distortions) the intrinsic non-linearity of that element controlling the gain in the loop has to be minimized. It is easy to obtain while using bulbs or thermo-resistors on frequencies above few dozens of Hertz due to their thermal inertness. The special care must be taken when using semiconductor regulators.

 

Almost working Wien bridge oscillator schematic

The oscillator depicted above might work just Ok. The violet rectangle highlights the pick-detector of the automatic gain control circuitry. VT1 substitutes R3 from the diagram at the top of this article. Once powered up this circuit will start oscillating: the discharged C3 feeds zero volts at the J-FET's gate resulting in a low drain-source resistance. Hence the high loop gain at the power up.

Once the circuit starts oscillating - C3 gets charged via VD1. This positive charge is applied to the gate of VT1 and reduces conductance of its channel (increases its resistance). This effectively reduces the amplifier's loop gain and stabilizes the output amplitude at levels around VT1' threshold voltage + voltage drop across VD1.

There are still problems with this circuit:

  • The loop gain of our AGC circuitry (highlighted in blue and violet) is too high. This might result in very unwanted low frequency oscillations at the frequency dictated by C3R7. These oscillations could result in an interrupted and extremely distorted signal at the generator's output.
  • The somewhat subtler issue here is that: all nonlinearities of the channel of VT1 will modulate the output signal.

 

High AGC stability and linearity at once

The solution to both issues - too much gain in the AGC control loop and the FET channel nonlinearity playing too much into the signal - is quite trivial. We allow the FET to influence the amplifier's gain just a tiny bit that we need to keep things going right. Let's settle the gain variations say as from 2.5 till 3.5. Adding two humble resistors (R3 and R5 on the schematic below) allows us to restrict the influence of FET's channel conductance on the amplifier's gain within the desired margins.

As a result of this modification the FET channel sees lower voltage and current variations during signal swing thus it operates on a smaller part of its output curve - hence this little part of the curve can be better approximated by the straight line (thus better resembles the perfect resistor). On top of that we do pass the big part of the signal current through the linear parts (resistors) and only small fraction of it goes via the still-not-so-linear FET channel.

At the power up the C3 is discharged and therefore VT1 channel is "open", resulting in the highest possible gain of approximately 3.5. That is just right for the circuit to start oscillating smoothly.

High accuracy sine wave oscillator based on the Wien bridge
  • R1, R2 = 100 kOhm
  • C1, C2 = 1 nF = 1000pF
  • R4 = 10 kOhm
  • R3 = 3.9 kOhm
  • R5 = 3 kOhm
  • VT1 = 2SJ103
  • R6 = 470 Ohm
  • C3 = 2.2 uF
  • R7 = 1 MOhm = 1000 kOhm
  • R8 = 10 kOhm

Virtually any small signal p-channel J-FET can be used as a direct replacement of VT1. Its threshold voltage dictates the generated signal amplitude. N-channel J-FETs seem to be more wide spread these days. Just flip the VD1 and C3 polarity and use a small signal n-channel amplifier j-fet transistor in place of VT1. Should the signal swing be not enough for your particular needs - the buffer amplifier (on the right) can easily be converted to the amplifier with some gain.

The circuit as described above will work just perfectly... provided one uses the top of the line operation amplifiers.

 

Output stage of budget OpAmp - in a pure class A

Using LM324 I was expecting issues in a form of well-known class AB amplifier's crossover distortions. Yeah, they talk about crossover distortions in big power amps, why bother in a tiny, operating at a fraction of a milliampere currents OpAmp? Because it also has class AB output stage! Believe it or not - checking its internal schematic should have convinced you by now - you will see the proof at the bottom of this article.

I really wanted to have the clean sine wave at the output of that oscillator. Thus I decided to force OpAmp's output stages into the real class A operation mode. That goal was easy to achieve by loading OpAmps with the constant current sinks. We are still talking milliamperes here - hence 1mA CCS.

Constant Current Sources (sinks)
  • R9 = 6.2 kOhm
  • VT2-VT4 =2n2222

VT2-VT4 can be virtually any small signal npn BJT's. It would be good to pick all three from the same production batch. Also one may decide to match them in the schematic above in a way that all collector currents measure somewhat close. I must admit that neither tight tolerances nor temperature stability or high dynamic impedance or even the high linearity matters here. OpAmp will take care of it all.

There is a great advantage of this particular CCS design that fits our application really well: its very low minimal voltage drop.

 

Battery operated

Use of a battery operated signal source can help reducing the noise at the input of the device under test. Probably the simplest, cheapest and most convenient battery source is a block of four alkaline batteries. 6V that it puts out is high enough to power a decent operational amplifier. LM324 is Ok to work from as low as +-1.5В power supply. Even better - it is claimed to be capable of operating at negative rail voltage at its inputs and output. Note that 50uA of the current that it can sink into its output when it's close to the negative rail is apparently not enough for our purposes. Fortunately the external constant current sinks come to rescue: 1mA that they can sink is enough to work with 10kOhm load at few Volts of the output swing.

It's desirable to leave approximately equal margins between the output voltage picks and the maximum OpAmp operating output voltage swing. Thanks to the external current sinks LM324 can operate close to the negative rail. But the maximum positive voltage at its output can hardly get close to the positive rail minus 1.5V. Hence we lower the virtual ground connection a bit. The LED serves dual purpose here: it subtracts some 1.7V from the virtual ground point, and also provides for a "power on" indication.

Shifted virtual ground connection
  • VD2 = Red LED 1.7V
  • R10, R11 = 2 kOhm
  • C10, C11 = 0.1 uF (ceramic or film)
  • C12, C13 >= 10 uF

 

Let's test it...

It was already long ago when I built and debugged that generator. Please forgive my poor memory - I fail to tell now the complete story that lead me to the current design. Here I'd like to put up the proof that external current sinks were crucial for using LM324 in a low-distortion application. While typing this I wonder whether I could see the crossover distortions on that old scope I used while I was building that thing?

The oscillogram below was obtained recently from the generator with shut-off external current sinks (transistor bases shorted to emitters).

LM324 without external current sinks yields crossover distortions

The worst thing on the picture above are those little notches around zero crossing points. These so-called "crossover distortions" are ones of the most evident sound-killers in all modern "class AB" amplifier designs. Honestly here it looks like LM324 output stage operated in a pure "class B", in other words - with zero quiescent current through its output stage. Nevertheless in our case we erase it completely by forcing LM324 into the true "class A" operation.

Flattered bottom of the curve certainly would also not be acceptable in a high accuracy sine wave generator. But this one is easy to eliminate by simply raising the power supply voltage.

 

The final result was just great!  🙂

Few years later after I built this circuit I tried to measure the THD it produces. I must admit that I bumped into the limits of my measurement setup - I could not see anything behind its noise. That gives us figures of THD better than 0.01%.

Wien bridge + LM324 + AGC + CCS = nearly perfect sine wave

There are in fact two test signal generators built on this board:

TLE555CP + LM324 = sine wave + saw-tooth generators

Now it's your turn 😉

Instead of using fixed value C1, C2, R1 and R2 - one can put switchable pairs of capacitors and twin potentiometer. This will result in wide range sine wave generator; still with very low level of distortions.

In case you were not planning to provide a standalone power supply for your design - I would suggest using a simple protection circuit described here, same as I did.

12 Comments

  1. Pingback: OpAmp + MOSFET = a decent headphone amplifier | MyElectrons

  2. johny radio

    hi Serge

    thanks for this amazing article. i’m a beginner– don’t understand most of it. But trying.

    can this circuit be used for a battery-powered AC power supply, delivering 40 Volts at 60 Hz, into a 100 Watt audio amplifier?

    how?

    many thanks,
    johny

    • serge

      Hi Johny, thanks for the comment!

      Sure this implementation of the generator could be used as a sine-wave / clock source for a big power converter. Probably quite an inefficient one, though. Of course it will require a power stage and a transformer to be added to the picture.

      If one would ask my advice on how to power an audio amp from batteries:
      1) I’d rather go for a direct power from batteries to the amp if at all possible – this would render probably the best imaginable quality.
      2) Otherwise resorting to switched power supplies seems to be more economical these days. Certainly in that case the major care must be taken to filter out the noises. But that’s still doable in smaller form-factors and “greener”, than converting using 50 or 60Hz.

      • Johny radio

        I’m curious about your mysterious “new Country”, and your old one. I’m guessing you moved from Russia to Italy…?

        It seemed to me a switched supply (that would be a class D amp, right?) is far more complex than the circuit above. Ironically, I’m driving a class D audio amp, which requires 40V AC.

        What do you mean converting to 60 Hz? You mean with the circuit above?

        How is switching greener? Would be awesome if you can direct me to a simple switching supply.

        Ciao!

        • Сергей

          Hi Johny, your guess was almost right: I moved from Russia to Belgium. Probably Italy would have been better choice, at least in respect to the weather 🙂

          Today there exist a plethora of integrated switching regulators, where one would need to add just a coil and few simple components extra, mainly to set the voltage/current.

          Switching PS is “greener” because the higher the conversion frequency is – the smaller transformer is needed and potentially the lower power losses will be (the latter is subject to many conditions, of course).

          Regarding your particular power conversion needs: I wonder how your amp is fed normally? Can you post/share a schematic or at least a sketch, please? Then we could think of a better solution, I hope.

  3. Pingback: Генератор синусоиды с мостом Вина с низким уровнем искажений | MyElectrons.ru

  4. arif

    Hi Johnny

    Great site, thank you for your efforts. I was simulating this circuit on LT Spice, but using your values, the circuit just doesnt oscillate. Changing the capacitor resistor ratio to 10k/10n, it oscillates beautifully at 15.5kHz. Can this oscillate any faster?

    • serge

      Hi Arif
      and welcome to the site!
      Please take into account that LM324 was chosen for this experiment rather for educational purposes. Should you want to build the real circuit around this schematic – I would suggest selecting some good modern OpAmp. In that case one can go much higher in frequency.
      Cheers,
      – Serge.

  5. Craig Shelley

    Thanks for the article, it is very clear and the explanations are very easy to understand.
    However I think there may be a mistake in the conditions for oscillation formula.
    In the section titled “Good Old Classics”, you have the conditions for oscillation specified as
    R3=2*R4
    I believe this should be
    R4=2*R3


    Craig

    • serge

      Hi Craig,
      welcome to MyElectrons.com!

      You’ve got good eye, thanks for spotting the error 🙂 Fixed.

  6. otsile

    Hello mr Серега for the amazing article.

    i am a student, studying biomedical engineering. am so interested in learning electronics, but unfortunately now i can quiet understand quite a lot of stuff.

    i wanna ask a question but it might seem so stupid 😉
    what if instead of replacing the R3 resistor with FET, add instead another resistor parallel to R4 and connect in series two diodes parrallely connected between themselve?

    i tried to connect them but in Microcap i cant quite get a perfect sin wave

  7. zivorad

    Dear Sir, I am interested in the perfect transmitter oscillator. Can this work at 1670 Khz

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.