Jump to content

Designing a sine wave generator with a quad opamp chip I have lying around "lm324", and while studying this topic

 

(below: schematic I'm trying to understand, particularly the + and - labels)

http://www.learningaboutelectronics.com/images/Function-generator-circuit.png

I keep stumbling across the terms Inverting Voltage and +v-v, and ground. Typicaly in electrical engineering + refers to positive, and ground or - refers to negative.

 

Reading the opamp circuit diagram below, the + and - inputs look like both positive polarity. Where do I get or generate the Vcc for pins 4 and 11 above?

Figure 1: Operational Amplifier Schematic

 

While you are at it, where do I get the Mathematic Models to decide on resistor values?

 

Link to comment
https://linustechtips.com/topic/1465772-opamp-engineering-confusion/
Share on other sites

Link to post
Share on other sites

Ground is the reference level, negative is lower than the reference level, positive is higher than the reference level.

 

Now we can look at this at a couple of levels, let's start out with the easiest way to interpret an operational amplifier:

You have two terminals, and the voltage you apply between them is multiplied by something around 1 million. The plus and minus terminals indicate how the opamp looks at its inputs, it'll subtract the voltage from the negative terminal from the one applied at the positive terminal. And it will generate the new output voltage in respect to ground (the reference). You can assume that ZIn is by all intents and purposes nearly infinite, making it an ideal volt meter, and Zout is almost zero, turning the output into an ideal voltage source. So you don't really need to know the mathematical models or resistor values for simple circuits like this.

 

Now you have your circuit there, you have three stages: a relaxation oscillator, an integrator turning a square wave into a triangle wave, and an integrator turning a triangle wave into a sine wave.

 

Relaxation oscillator

Because the output of the operational amplifier is an ideal voltage source, you can just assume that all the wires that are attached to it are independent. So the 100kOhm/22kOhm resistor going to the opamp's + terminal willy apply 22 kOhm / (100 kOhm + 22 kOhm) * Voutput (about 0.2 Voutput) to that terminal.

On the negative terminal we have a variable resistor charging or discharging a capacitor (1 µF), so the opamp's negative terminal voltage will slowly increase during charging (at an exponentially decreasing rate.

Now the big issue is, are we charging or discharging? Imperfections in the opamp will cause it to sway one way or the other, possibly even the colour of sandals that Linus is wearing that day might have an influence on this, so for the sake of simplicity let's assume that everything starts at 0V and the voltage applied to the positive input terminal is 1 µV larger than the one applied to the negative terminal of the opamp due to little gremlins (this ain't an unrealistic value to be clear). The opamp sees this input and will generate an output of about 1V (1 µV * Gain-Bandwidth Product for LM324 = 1 µV x 1000000 = 1V), this in turn means that the positive input opamp terminal voltage will rapidly increase to 0.2V, while the negative terminal will lag behind because that capacitor needs to be charged through that large resistor, so now the opamp wants to supply 0.2V * 1000000 = 200 kV, but it is limited by the positive supply voltage. Let's assume the positive supply voltage is 10V, so positive input terminal now reaches +2V, and the negative input terminal's voltage slowly starts to increase. Because the difference between the two remains so large, the opamp keeps supplying 10V on its output. The voltage on the capacitor, and the negative input terminal keeps increasing as a result. And assuming my brain works on a Sunday morning, that means that the negative input terminal will reach 2V in about 20ish milliseconds. At that point the negative output becomes larger than the positive output by a couple of millivolt, again the opamp tries to amplify that but it runs into the limited supply voltage on the lower side (let's take -10 V). So the positive terminal input now becomes -2V. The capacitor starts to discharge through the 100 kOhm variable resistor to -10V, so after a short while (ain't going to try this one without a calculator) it'll reach this value, and the opamp will switch around again because the positive input voltage became higher than the negative one. So what happens is that the opamp will repeat either +10V or -10V on its output continuously at roughly a constant rate.

Now I urge you to not read the wikipedia page for relaxation oscillators, since it was written by folks who want to show "ZOMG I'M SO GOOD AT MATHZ" instead of providing a reasonable explanation. You can find good explanations on how it works on multiple electronics websites and in pretty much all books that cover basic opamp oscillators.

 

Integrator

The signal from the relaxation oscillator goes to an integrator circuit. Due to the aforementioned mathz, this circuit acts like a mathematical integrator. And if you integrate a constant voltage, you get a line that ramps up or down depending on the sign of the voltage. Now in practice this works because the opamp inputs have quasi infinite resistance. So the current flowing through the 10 kOhm actually goes towards the capacitor, slowly charging/discharging it depending on the voltage applied by the opamp's output (terminal 7) with respect to its input. But a simple way to look at it is that you're applying a constant voltage to the capacitor and charging it, so it'll go up proportionally over time, creating a triangle wave on the output of the opamp. The reason they put a resistor of a similar value between the positive terminal and ground is to ensure that the opamp's input stage is evenly "biased", that reduces the offset error on the input.

 

Second Integrator

This one repeats this by integrating the line segments into something parabolic, which due to the non-idealities is almost a sine-wave.

 

You can find a reasonable explanation of these things here (only skimmed through them so not sure how detailed it is):
https://www.electronics-tutorials.ws/opamp/op-amp-monostable.html
https://www.electronics-tutorials.ws/opamp/opamp_6.html

 

 

Now in terms of how good LM324 opamps actually are (datasheet: ti.com/lit/ds/snosc16d/snosc16d.pdf1 - equivalent circuit on the first page):

  • Input resistance is quite high, for an LM324 you're looking at a 20 to 50 nanoampere flowing into the terminals in a practical circuit like this when applying a couple of volts to the inputs. So that gives you tens to hundreds of megaohms of input resistance. So it's quite safe to ignore that when you're not using megaohm-sized resistors. For added fun, this opamp will actually output current from its input, not draw current in.
  • The output resistance will depend on the output voltage. But given that you just have transistors there directly to the supply rails it's going to be quasi zero, and the current will be limited what the transistors can take, not by the resistance.
  • A modern LM324 has an input offset voltage of about 1 - 5 mV in practice, depending on the circuit it's put into. This can go either way and might vary depending on the circuit you put it in. This is because you're kind of throwing off the differential pair amplifier (Q1 through Q4) at the input.
  • Amplification is given by the "gain bandwidth product" (GBW value in MHz). To avoid getting into defining bandwidth and why this is a reasonable approximation, we basically found out that amplification x bandwidth of an opamp is pretty much a constant value. For an LM324 this value is 1 MegaHertz, which is pretty average but not bad. So an LM324 can amplify a 10 Hertz signal by 100 000, or a 1 kilohertz signal by a factor of 1000. If you try to make it do more, weird things will happen.

Measuring these values is by no means trivial, and they're not constant! This is also why the manufacturers will rarely mention them, and it's also why most serious analog circuit designers have a fancy high-end bench multimeter that measures things like nanovolts and nanoamperes. But in practice for most hobbyist applications, you can just assume opamps are ideal blocks that have infinite amplification and no appreciable weirdness.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×