Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Compensating AGC stableised sinewave oscillators

Not open for further replies.


Active Member
Hi All,
I've recently had cause to build a sweepable audio frequency sinewave oscillator. Since I was hoping for a low distortion, I thought that a design incorporating an automatic gain control (AGC) was the only option. I've not had much sucess and so I've opted just to build someone else's published design, but it did make me realise that stabalising this kind of oscillator seems to be more complicated than it first appears.

I'm trying to gain a better understanding of how I could design this type of circuit if I did need to, and I'm hoping that some of the good folks here might be able to give some insight.

The basic idea (see fig 1) is that you have a filter or some kind of phase shift network that provides a 360 degree phase shift at the ocillation frequency, with some gain H. This is connected in a feedback loop with an amplifier of gain G. You arrange for the product of G and H to be 1, and the oscillations stay at a steady amplitude. So far so simple.

The tricky part is that you have to watch the output of the oscillator and continually adjust the gain of the amplifier (G) to keep the amplitude both stable and at the desired level.
We'll leave asside the practical matter of low-distortion variable gain amplifiers for the moment, but we do have to take into account ripple voltage on the control signal as any component of the control voltage at (multiples of) the signal frequency will manifest as distortion.

The standard solution seems to be as figure 2. The output is simply rectified, filtered and used to reduce the gain G in proportion to the output level. I think this model covers all stabalisation techniques using thermistors. lamps etc (give or take some nonlinearity).

An obvious step on from this, to give tighter amplitude regulation, is fig 3, where an integrator is used. I've just drawn this in case anyone want's to "point to" it.

The main confounding factor here seems to be that the rate-of-change of the output amplitude depends not only on the gain G, but also on the oscillation frequency. Because of this, it seems to me that you would need some kind of proportional-derivative control loop, where the derivative part took care of making the product H x G exactly 1 (so that each cycle was exactly the same as the last) and then the proportional part could adjust this to swing the output level towards a set point. It doesn't sound very likely in practice though.

The bottom line here is that I'd be interested to hear how those of you with a better understanding of control systems than me (and that's most of you!) would go about designing this kind of oscillator for minimum distortion and minimum settling time.


  • Fig3.png
    6 KB · Views: 230
  • Fig2.png
    5.8 KB · Views: 235
  • Fig1.png
    2.4 KB · Views: 221
That was a long post... but there's more!
Here are a couple of theoretical circuits illustrating the idea.

Cir1 shows the frequency response of my bandpass filter, and Cir2 connects this as an oscilator.
Note that in Cir1 the gain remains at exactly -0.5 as the frequency is varied. Ths means that in Cir2 the total loop gain is 1.005 at all frequencies, but the rate at which the amplitude increases gets higher as the frequency goes up (or the delay goes down).


  • Out2.png
    7.8 KB · Views: 230
  • Out1.png
    7.4 KB · Views: 227
  • Cir2.png
    9.1 KB · Views: 229
  • Cir1.png
    8.6 KB · Views: 221
Well... I've been thinking about this for several days and not been able to get my head around it. Then directly after I posted this question, I went to bed and it clicked.

My thinking is this:
As mentioned, in order to stabalise the level (so that the amplitude is the same from cycle to cycle) we need to look at the derivative of the output amplitude. This gives an amplitude error per cycle, which can be used to step up or down the gain G accordingly (because when we start we have no idea where G might end up, only if it is too small or too large). That is to say, we must integrate the error signal. But in that case we've just go back to where we started, a signal proportional to the output amplitude!

In order to assure acceptable output level flatness as the frequency is swept, we just need to ensure that there is sufficient gain at A that the change in output need only to be small in order to change G by 1/dH (where dH is the change in H as the frequency is swept, or drifts with temperature etc). This of course presents its own problem, in that a large gain at A also amplifies the ripple, degrading the distortion performance.

The problem then comes that we've already got 90 degrees lag between the control signal and the output amplitude, caused by the effective integration of G around the oscillator loop. Adding more lag with smoothing after the rectifier reduces the phase margin and spoils the settling. Does this sound right so far?
This explains why the simple rectifier scheme in fig2 is so common, and why a sample-and-hold approach can work so well.

I think I understand this a bit better now, although I think there is one more matter to address in order to get an ideal solution. That's that a given change in G (call it dG) will produce a different error signal (different change in output amplitude) depending upon the absolute level of the oscillation at the time. ie, if the output is 10V and dG is 0.5, the error signal is 5V. If the output is only 1V then the same dG gives an error of only 0.5V.
Of course, for small changes this is probably unimportant, but I think that the ideal approach would be to use a logarithmic conversion, wouldn't it?

Please point out the holes in my reasoning - I'm sure there are plenty!
If anyone can express this problem in a formal mathematical way, that'd be really interesting to see, too.
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips