I recently compiled and posted a project on Hackster.io describing how a Theremin (an electronic musical instrument) can be built with the Analog Discovery 2, the Analog Parts Kit, and a beverage can. I wanted to be able to break down the circuit into smaller stages so I could understand what was going on and so I could help readers understand as well. However, what I considered to be the “first stage” turned out to be quite a conceptual challenge for me, and it is still putting me through the ringer.
Deep thinking. Picture from: https://www.flickr.com/photos/archer10/11713640484
This stage was presented to me as a “Variable-Frequency Oscillator.” A small op amp circuit with 3 resistors and a capacitor, this generated an oscillating output. The fixed capacitor was placed in parallel with a beverage can and a hand-held wire for the Theremin effect. I asked myself “what is the input to this stage, how does this op amp generate an oscillating output with only DC voltage supplies, and what’s the function of this capacitor?” This is when I fell down the rabbit hole.
Follow the white rabbit. Picture from: https://www.flickr.com/photos/valkyrieh116/311526846
The parallel capacitance formed by the beverage can and the handheld wire changed the frequency of the output. That was noticeable using an oscilloscope and supported the variable-frequency title. But why was there an oscillating output to begin with? Here is a schematic for the circuit I was using:
What I have gathered in attempt to understand the cause of this oscillation is that it still seems like magic and really does reflect the fact that every circuit component is imperfect in its own little special way (just like all of us). In theory, or ideally, the plates of the capacitor would be the exact same in every way, the resistor values would be the exact same in every way, and the transistors in the integrated circuit would be exactly the same in every way. The positive and negative voltages applied to the op amp would be exactly equal and opposite and applied at the same exact instantaneous moment and the environment would have no bearing on functionality. However, as you may be expecting, this is not reality.
Hashing it out before reality puts you in your place. Picture from: https://www.flickr.com/photos/bryanalexander/17182506391
Tiny imperfections and variations among like components, in conjunction with environmental electrical and magnetic noise, are the driving forces to this oscillator. Since instantaneous voltage changes are impossible, and the signal path to bias the circuit will vary between the two supplies, one plate of the fixed capacitor will begin to favor one of the voltage supplies and start charging towards that value.
Now what happens is a magical juggling act. The charging capacitor biases BJT transistors that are in the op amp that passes either a positive or negative voltage to the output. However, when the capacitor charge gets close to the value of one of the power supplies, this causes a switch-like behavior in some of the op amps transistors, rebiasing, and causes the capacitor to begin discharging and recharging towards the other power supply value. This continues to flip-flop on it’s own, hence the astable title. The oscillating output is characteristic of a square wave. Here is a screen shot of the oscillation in Waveforms:
There are also monostable and bistable multivibrators where one or two of these states are externally controlled. I can not fully explain this phenomenon with the op amp circuit, but some easier to understand examples of discrete multivibrator circuits exist online with better explanations. I will need much more time to think about this before I develop a confident understanding. This is some crazy cool physics! Check out these pages for tutorials that helped me begin to wrap my mind around this phenomenon, they use the same discrete circuit: