Home

Oscillators

Oscillators always fascinated me. To me, these systems that self-oscillate were all surrounded by mystery. Why do they want to do that? Why don’t they have a peace with themselves? Somehow, I felt, oscillators must have a will on their own. These little rebels of the nature.

When we look around, we see many oscillator examples, some natural some men produced: heartbeat, earthquakes, some musical instruments, your car engine… Some of them have exact and precise periodicity while others look messier.

There is a small tree in front of my office window. There are probably hundred leafs on it, but this particular one is special. Even on a slight steady wind it starts weaving vigorously, contrasting itself from any other leaf on that tree. I often find myself looking at it, mechanically.

What is an oscillator? Not caring about fancy definitions, I would say that oscillators are systems that produce periodical unsteadiness in otherwise steady environment. If all inputs to a system are kept steady, but the output still shows periodicity, then we may be dealing with an oscillator. Boundaries of an oscillator are therefore determined by the fact that all inputs to it are steady and that at least one output shows periodicity while minimal number of elements is embraced. Primary ‘energy sources’ are not, according to this definition, part of the oscillator but are certainly needed for the oscillator to work.

Some systems have natural tendency to oscillate – like pendulum for example. The simple pendulum starts with energy stored inside it and then converts it from kinetic to potential and vice versa in periodical manner. Inevitably, the real-word pendulum wastes its energy and cannot sustain its amplitude. In this article, however, I am only interested in oscillators that can accept its ‘energy’ from outside in a ‘steady form’ and produce oscillations out of it. This is what I am considering a ‘charming oscillator’ – it can use energy from outside sources, not only energy previously stored into it. Such oscillator’s oscillations do not dampen. An example is a pendulum clock – its pendulum replenishes any lost energy in every cycle (the energy comes from a weight or a spring).

While studying them, I used to divide oscillators into two groups, although there is no strict boundary. In the first group I put what I call ‘relaxation oscillators’. These are low-order systems that contain non-linear elements. Many relaxation oscillators appear to be steady (or very slowly changing) for some comparatively long time, and then suddenly they change their state in ‘a blink of an eye’.

In the second group I put oscillators that continuously change their output in sine or other smooth manner. Any erratic movement is unknown to them. These are higher-order systems that don’t actually need to contain non-linear elements in order to work. (Did I mention that I like linear systems much more than non-liner ;).

Making a relaxation oscillator

As a heart of our relaxation oscillator we will use a bistable. A bistable is a system that has ‘two stable states’. As any system, it has input(s) and output(s). To build a relaxation oscillator we will use very simple bistable that only has one single input and one single output.

‘Two stable states’, what does it mean? In fact, what is a stable state of a system, anyway? First, obviously, if you keep inputs to a system steady (non-changing), the output of a system must also eventually reach the state of steadiness. Second, if you apply a tiny and momentary change (fluctuation) to input(s) of the system, its output(s) must also eventually return to the previous steady level. These two tests reveal a steady state of a system.

What about bistable’s ‘two stable states’? This is, I would say, wrong usage of words. More correct statement would be that a bistable has ‘two sets of stable states’. This actually means that:
- you can somehow put the bistable into one or another ‘mode’; that is you can choose what set of steady states will the bistable produce.
- for same input(s) value(s) the bistable can have two different stable output(s) states, depending on what set of steady states is currently active.

Obviously, the bistable has memory of some kind because it remembers what set is active.

To make a bistable the following components are needed: a summation unit, an amplifier and a non-linear element (a limiter).

The bistable works by employing the positive feedback. The positive feedback ‘pushes’ the bistable into any of its two stable states. The positive feedback causes the bistable to act as bistable. The limiter (non-linear element) is used to limit the positive-feedback effect.

We will try to plot an input output diagram of this simple bistable. We are plotting the diagram point-by-point by providing input value, and then reading the output value after it stabilizes. If we start from low input values and then increase them step by step, the result my look like on the diagram below.

Cool, because our bistable suddenly changes the output level once the input increases above certain value. But the real surprise comes if we now start decreasing input values using the same steps. The combined result might look like.

By making our steps really small, we can make the following input-output diagram of a bistable.

As it can be seen on the input-output diagram, it is very easy to divide the ‘curve’ into two separate sets. The bistable jumps from one set to the other one when the input value reaches certain levels. There is histeresys present – the jump-up and the jump-down levels differ.

Sure, not all bistable systems have such ideal input-output characteristics. Some are less ideal, like the one on the example A below.

The example ‘A’ is a bistable – it has two separate sets of stable states. I said it is less ‘ideal’ because it is not possible to determine what set is currently active only by looking at the output level, but it is possible to deduce the active set by looking at both, input and output simultaneously. The example ‘B’ is not a bistable, but it still is a system with histeresys. There are no separate sets of stable states in this system. Even if we make an ‘artificial’ division of this curve into two parts, there will be ‘problematic’ points (at division borders) around which we won’t be able to easily tell to what set do they belong. The example ‘C’ doesn’t contain histeresys and is also not a true bistable.

There are two important properties of the bistable and we will use them both to make a relaxation oscillator
- histeresys
- separate sets of stable states.

Making relaxation oscillator out of bistable

Having a bistable, is already 75% job done. Especially if the bistable has such input-output curve that it is possible to conclude what state is active only by looking at its output value.

Then we make an oscillator by following algorithm: If the bistable is in one state, slowly adjust its input in such direction that it will eventually tip into the other state, and vice-versa.

Okay, what does it mean ‘slowly adjust its input’? It means that we never change the input value suddenly (stepping it), but gradually instead. Obviously an ideal element of doing this would be an integrator then. Integrator’s output changes gradually. What I am suggesting is doing the following:

The integrator takes output value of the bistable (gained by minus A), integrates it and feeds it to the bistable input. We used negative gain ‘-A’ because the integrator must act in the way to tip bistable into the ‘other state’. The value ‘A’ determines the frequency of this relaxation oscillator. The gain A and the integrator make the ‘timing element’ of our oscillator.

The ‘timing element’ doesn’t have to be a pure integrator. The important thing is that it eventually (but not immediately) reaches levels high enough to tip the bistable over. A low-pass filter of some kind will usually do. A delay line would be an unusual choice.

What if, instead of bistable, we used a histeresys system as it was shown on example ‘B’? In this case, our integrator will not ‘know’ in what direction to move the system input once it reaches any of two meeting points. This might be overcome by using some sort of inertia, but higher order systems are needed (and it is questionable whether we may call it a relaxation oscillator).

What if instead of bistable, we used a system shown on example ‘C’? As there is no histeresys, the frequency would be infinite, invariable of the gain ‘A’.

A charming op-amp based relaxation oscillator is shown on the picture below. Note the simplicity. Note also that both, feedback to inverting and to non-inverting input are used. Also note that the non-linearity is found in the op-amp itself (limited output level).

Another example, made from discrete transistors, is shown below. Note the symmetry of this circuit.

People like to make oscillators from electronic components because electronic components have characteristics that are close to ideal (are very refined) and are easy to work with.

A geyser example

Never in my life I had a privilege to watch a geyser in nature. This is unfortunate because geysers seem quite cool. Still, I dare to take a geyser as a relaxing oscillator example here. Amusingly, the word ‘relaxing’ makes sense when you look at a geyser, isn’t it?

A geyser is a natural-occurring oscillator that is powered by water and heat. If both are supplied to the geyser at a steady rate, the geyser may even oscillate with regular periodicity. Here we need to look carefully at every phase of the geyser cycle.

During its inactive phase the geyser is plugged by weight of the water column in its narrow neck. The plug water remains cooler than the water found down below in the geyser’s belly because the narrow piping doesn’t allow for easy mixing. As heat is constantly supplied, the water below gets hotter and hotter. It actually surpasses 100 degrees Celsius without being converted to steam because of the high pressure.

As temperature inevitably rises, at one point steam bubbles will finally begin to form in the geyser belly. The volume increase will push some water-plug water out of the vent. This results in pressure reduction and therefore even more steam is formed… The geyser will enter vicious positive-feedback phase where lot of steam is generated in quite short time.

Soon thereafter, however, the steam bubbles will reach the output vent and the geyser will start exhausting steam at the same or higher rate than it is generated. This will end the positive-feedback phase, but will by no means end the discharge phase of the geyser. The steam (and water) discharge continues until there is enough pressure inside to discourage ‘fresh’ water entry into the geyser fissure. The discharge, however, gets less fierce over time.

At one moment, after the pressure drops enough, the fresh water enters resulting in pressure build up and temperature decrease. This effectively stops the discharge – again by positive feedback.

Therefore, we isolated four phases of a geyser cycle:
1. water filling and heating
2. start of boiling. Steam bubbles generated abruptly (positive-feedback)
3. boiling continuation – steam is exhausted at higher rate than produced
4. boiling shutdown – cold water enters and stops boiling (positive feedback)

Phases 2 and 4 include positive-feedback effects. How can we say if there is a positive-feedback in place in any process? This is difficult. I usually ask myself the following question: does the process self-accelerate? If the answer is yes, then there is evidence of a positive feedback.

Phases 1 and 3 are also puzzling. These are not positive-feedback phases, but are not stable either. These phases tend to ‘slide’ with time. Whenever something ‘slides’ with time, one might suspect some integrative process.

But if you read really carefully you noticed one important fact. The geyser works because of some sort of histeresys – the higher pressure is needed to start the eruption (transition from 1 to 2) than it is needed to stop it (transition from 3 to 4). Histeresys often means bistability and there is a hidden bistable somewhere in a heart of a geyser.

Smooth oscillations

We need to consider a possibility to build an oscillator the following way: if we are able to find a system whose output is resembling its input then, maybe, we could connect its output back to its input creating a closed loop that will excite itself. Sounds like a childish fantasy, isn’t it?

Imagine an ideal amplifier. Amplifiers are simple systems. They only have one input and one output where output=gain*input… Whatever signal you produce at its input, it is immediately reproduced at its output, possibly amplified or attenuated.

This gives us an idea to somehow feed amplifier output back to its input creating a ring that will endlessly oscillate. This of course cannot be done ‘just like that’. Connecting ideal amplifier output to the input would be sort of illegal act (except in trivial case when gain equals to 1) and would result in an instant destruction of the Known Universe. Fortunately, there are no ideal amplifiers. A real amplifier will either oscillate or saturate.

There must be no ‘strong’ bond between output and input of an ideal amplifier. The possible solution is a sort of ‘slow’ bond – that is a bound that doesn’t react to a change immediately but with some delay.

The system below has a time-delay element. The element delays the signal for the time ‘T’. The simplest way to make the time-delay element would be to employ a long-enough signal transmission line.

Sneakily enough, we will produce one single period equal to ‘T’ on input…

Now we are getting somewhere. Like an echo, the signal will be repeated over and over again. If the gain is greater than one, oscillations will grow. If smaller than one, will attenuate. The best result is when gain equals to one.

There are several problems with above oscillator:
- a noise will inevitable enter our system. This might distort the signal with time.
- We need to generate the initial signal (one period) carefully as it must contain both, positive and negative part
- It is impossible to make overall gain exactly equal to 1. Therefore, to make it safe, we will aim at gains greater than one. This will eventually drive signal amplitude into saturation (those parts of the signal that were greater than zero will become +max, other –max).

But still, this should oscillate.

To ensure that the signal will have both, positive and negative portions, we had to carefully produce the initial period. We could not rely on noise only. The better design is shown below.

Here we initiate the oscillator with half-period only. The delayed feedback will produce the other half, but negative. The result will be signal with guaranteed positive and negative portions. As a result, we might rely on the internal noise disturbances to seed the signal (no need to generate the half-period from the outside source) although the resulting signal shape is going to be unpredictable. The improved design cannot saturate.

Phase-shifting

Using the time-delay element is clumsy. In addition, such oscillator based on the time-delay element produces square-like periodic signals – similar to a relaxation oscillator. Having a way to generate sine wave would be nice.

Some systems, filters for example, are also able to delay a signal. However, unlike the time-delay transmission lines, such systems do not delay every part of the signal for the same amount. For example, a low-pass filter will delay (phase-shift) high-frequency components of a signal for larger value than low-frequency components. A first order low-pass filter can shift high-frequency components for up to 90 degrees.

On the picture above we have simplest low-pass filter example (an R-C combination). It is known that if feed a pure sine wave at the filter input, the output will also consist of a pure sine wave. However, depending on the frequency, the output signal amplitude and phase will vary.

If we could somehow phase-shift the output signal to 180 degrees (half-period) then we could feed such signal back to input (negatively amplified) and we could hope that some oscillations will occur. Of course, we cannot phase-shift the sine signal 180 degrees with the first-order low pass filter, but by combining three filters in a cascade we should be able to do it (at every step, for example, the signal shifts for 60 degrees).

At some particular frequency, the output sine signal is going to be 180 degrees phase-shifted (delayed) from the input sine signal. Of course, the same signal at this frequency will be greatly attenuated and must be amplified, but this is not a problem.

Okay, let’s close the loop now – let’s make the ring that has the will on its own.

This one oscillates at one single frequency - it produces sine-like signal.

Note that:
- This oscillator oscillates exactly at frequency for which the phase-shift through the RC network is exactly 180 degrees. Any other frequency will not shift for 180 degrees and therefore will not perfectly match – such frequency will not manage to produce the positive feedback, and will therefore fade out.
- The internal noise is enough to start this oscillator working. The noise always exists and contains wide spectrum of harmonic components. One of those components will match the circuit and will be amplified.
- Of course, the overall gain of the circuit at the oscillating frequency must be greater than one.

It is charming how this circuit only prefers one single frequency. It is mysterious what it does to frequencies it doesn’t like… There are of course hundreds ways to create an oscillator, but the positive feedback is always present.

Danijel Gorupec, 2012


See also the Feedback article.
See also the gasoline vs diesel engine comparation article.
See also the power vs torque article that explains what really accelerates your ride.


Home