A few opamp questions - Page 1
Forum section: electronics / beginners

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 16, 2021, 08:04:10 am
content: HiI have a few general questions about opamps (see numbers on the attachment):1) How to determine the appropriate value for C9 - is it simply a 1st order filter, with a cut-off freq of 1/(2*Pi*R1*C9) ?2) is a simple buffer. Would 3) work identically as a buffer? If I follow the basic opamp theory, 2) has a gain of 1+0/infinity=1, and 3) has a gain of 1+22k/infinity=1. I guess "infinity" actually means a few MOhms or GOhms, so as long as the feedback resistor is a lot smaller than that it should be the same as a buffer, correct?4) is the same as 3) ? What happens if I put a 16R load on the opamp, will the opamp be driving 16R or 26R?5) Same question as for 1), how to determine the appropriate value for C10? (or: does C10 do anything here?)6) If I have a single-ended signal and want to make it into a differential with identical output impedances (for an audio "balanced" signal f.x.), can I keep R22 and R33 in the feedback loop or do I need them out of the loop?I know the answers do depend of the situation though, so if it helps here is the situation:* I am dealing with audio signals* All input signals are ac-coupled to the half-way point VCC/2 (called Half-VCC)* All the opamps are the same and get GND and VCC on their power supply pins* The output load can vary from very low impedance (headphones, about 32ohm) to high-impedance (about 50k) - the load is mainly resistive but (long) cables can add a capacitive load as wellThank you in advance!Simon

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 16, 2021, 08:28:36 am
content: Quote from: simonlasnier on February 16, 2021, 08:04:10 amYou have to know needed f3 ("cut-off") frequency, so you'll find C9.Quote from: simonlasnier on February 16, 2021, 08:04:10 am2), 3) and 4) all are buffers. They are very similar and differ in details, but all are buffers.With a 16R load 2) and 3) will have 26R load, and 4) will have an equivalent to a 16R load.2) and 3) have 10 R output impedance and 4) has close to zero impedance.Of cause, any opamp doesn't like capacity at its output so 2 and 3 are much more stable in general than 4.Quote from: simonlasnier on February 16, 2021, 08:04:10 amThe answer depends on f3 frequency (depends on C10 valua) if it will be a buffer or a low-frequency filter.corrected because I was inattentive. A cap doesn't work there at all.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 16, 2021, 08:34:27 am
content: Thanks for the reply Vovk_Z. Let's say f3=20kHz. How would you calculate the capacitor values then (in particular for 5))?Another way to ask about 5) could be: how to limit the bandwith of a non-inverting opamp configuration?

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 16, 2021, 08:39:18 am
content: It depends on why do I need a capacitor there? If it is a power amplifier which is unstable without that cap I would find with experiment the minimum needed to circuit was stable. You may find the average value for that cap in typical circuits.For 'average' power amp, f3 for 5) is somewhere about 500 kHz (+-) typically.- corrected because I was inattentive.We may need that cap 50/50. It depends on an actual load (and load wiring), depends on source impedance, etc.I used LM6172 as a headphone amplifier and there was no need in C10 at all. (It was 2)/3) circuits).

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 16, 2021, 08:48:04 am
content: If we are talking about 2) and 3) then I may say that both are far from the best option. 0R can be too low for a maximum possible performance and 22k can be too much. The feedback resistor (0R or 22k at your pics) has to be close to the source impedance value (in general). So it may be something like 100R...1000R. But there are few opamps insensitive to this value.

author: pwlps
author_rank: Frequent Contributor
timestamp: February 16, 2021, 09:14:21 am
content: 1) From the basic opamp theory the gain is -(C9||22k)/22k so you can easily calculate it yourself5) It wont act as a lowpass because there is no current through C10 so basically C10 does nothing for the gain here. The simplest way to limit the bandwidth in a non inverting configuration is to add an RC lowpass before the AO. You can also put a filter in the feedback loop but this will always result in a gain greater than one in a non-inverting configuration, seehttps://www.electronics-tutorials.ws/opamp/opamp_3.htmlfor the formulas.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 16, 2021, 10:51:03 am
content: @Vovk_z: Ok nice to know - I found some more reading about it here:https://electronics.stackexchange.com/questions/56727/what-is-the-purpose-of-a-resistor-in-the-feedback-path-of-a-unity-gain-buffer@pwlps: yes for 1) - understood, it makes sense, thanks.About 5) what I want is to reduce the bandwidth of the opamp itself, not simply filtering the signal.Actually the reason why I want to add a bandwidth limiting cap is because I've got oscillations around 2MHz. The datasheet of my opamp says this (attached, and full datasheet here:https://datasheet.lcsc.com/szlcsc/1809211219_Gainsil-GS8634-SR_C157705.pdf).How to find the right values for Rf, Cf and Riso?Thank you

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 16, 2021, 10:52:59 am
content: Also I would really appreicate if someone could answer that question?Quote from: simonlasnier on February 16, 2021, 08:04:10 am

author: pwlps
author_rank: Frequent Contributor
timestamp: February 16, 2021, 11:57:04 am
content: Quote from: simonlasnier on February 16, 2021, 10:51:03 amSeehttps://www.analog.com/en/analog-dialogue/articles/ask-the-applications-engineer-25.html.Apparently the circuit from the datasheet is rather for inverting configuration ("In-loop compensation" in the article) but they discuss other compensation schemes as well. You can't really calculate the optimum values because you don't know the exact transfer function of the AO and especially the open-loop output resistance. I don't have experience with such compensation circuits but you might try some values of R0 of order of the output impedance given in the datasheet.There is another interesting topology :https://www.analog.com/en/analog-dialogue/articles/creative-compensation-enables-tiny-amplifier.html.

author: pwlps
author_rank: Frequent Contributor
timestamp: February 16, 2021, 12:07:58 pm
content: Quote from: simonlasnier on February 16, 2021, 10:52:59 amIt will be 26R in both cases. The difference between 3 and 4 will be in the phase shift of the feedback path when you add a capacitive load.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 16, 2021, 12:27:54 pm
content: Thank you pwlps, also what I thought about the 26R. I'll investigate the phase shift, but my "capacitive" loads will be very low, only from the capacitance in the cables so a few pF.About Rf, Cf and Riso:* The two links you sent do not seem to work?* The datasheet says the open-loop gain (AOL) is >90dB at ambiant temp, with a 400 Ohm load.* It does not give the open-loop output impedance but gives 3 Ohm for a unity gain at 200kHz

author: pwlps
author_rank: Frequent Contributor
timestamp: February 16, 2021, 01:55:04 pm
content: Quote from: simonlasnier on February 16, 2021, 12:27:54 pmIt was because the dots at the end were within the urls, sorry for that, now I have corrected the urls.QuoteYes I would start trying a few ohms for Ro.That said look at the second article, they give an example with real values (fig.3).

author: pwlps
author_rank: Frequent Contributor
timestamp: February 16, 2021, 05:14:15 pm
content: On a side note your GS8634 might not be the best candidate for this app (driving capacitive loads) as they say explicitly in the datasheet. Instead of compensating the opamp you might search for "unity gain stable" opamps designed to be able to drive capacitive loads without complex compensation networks. For example to drive coaxial lines (although it was at higher frequencies) I was using the LT1813 or LT6220/21/22 and did not have any issues (in inverting configuration just needed a small 5-10pf capacitor in parallel with the feedback resistor as suggested in the datasheet). For audio frequencies you don't need such a high GBP (it can make tests on breadboard difficult), but I don't have any reference in mind.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 16, 2021, 06:07:07 pm
content: I read the two articles, very informative!Fair point about the opamp. But let's say I only use the opamp in inverting configuration, then it's easy like you said I just add a cap on the feedback loop, I can reduce the bandwidth a lot (since I only need <20kHz) and it works.I am still wondering a few things regarding that 10 Ohm on the output. It has 3 functions: 1) improve the stability, 2) in case of a short (plugging the jack cable f.x. creates a short), and 3) to set the output impedance when driving differential signal.I am wondering (see my first post and* whether I'll get higher voltage / more power into low impedance headphones (say 16Ohm) if it is inside the feedback loop or not?* and if it is inside the feedback loop and I am sending a differential signal (f.x. a balanced audio line output), will the two lines be of equal impedance? About this I made a diagram 7 (attached) similar to 6 but more complete.Thank you!

author: Terry Bites
author_rank: Super Contributor
timestamp: February 16, 2021, 08:38:26 pm
content: q1 yesq2 you dont need a resistor in the feedback loop of buffers. Its a hang-over from days gone by when precision opamps were crap. This resistor can cause stability issues.q3 an opamp hasfiniteopen loop gain and it changes with frequncy AKA Gain Bandwidth Product. GBW from data at unity gain this is very high but not infinite, see dasheet for your opamp.q4 The opamp output impedance is increased by R28 ohms. Not many opamps can drive 16R or 26R without severe complaint.q5 C10 has no effectIf you need a balanced drive your circiut will work as shown. Well, if you have good resistor matching else you will have a common mode error that the FX input may not be able to handle.Just because the opamps output impedance is low don't assume it can provide the load current. Pick the right opamp for the job and read your data sheets!Download a circuit simulator like LTspice or Microcap12. evenhttps://www.circuitlab.com/if you have to. See the effect of your ideas with real opamps. The perfect opamp is unobtanium.Tip. see Daves' video on drawing schematics.

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 16, 2021, 09:23:33 pm
content: Quote from: pwlps on February 16, 2021, 09:14:21 am+1. I was wrong in my first answer (I was inattentive).

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 16, 2021, 09:27:48 pm
content: Quote from: simonlasnier on February 16, 2021, 08:34:27 am5) is a buffer. So if opamp is chosen right (it is unity-gain stable) and if PCB is done right (opamp has decoupling caps near) so it has to be stable.

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 16, 2021, 09:34:21 pm
content: Quote from: simonlasnier on February 16, 2021, 06:07:07 pmInverting configuration is usually much more stable than non-inverting and definitely doesn't need caps between inv. input and output. That may rather make things worse. Just give an adequate decoupling.

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 16, 2021, 09:39:16 pm
content: Quote from: simonlasnier on February 16, 2021, 06:07:07 pmIt is a very strange circuit.I am sure it'll be much effective if you just explain what is your task? The right answer is definitely much simple than that on your circuit....Oh, I see: " (headphones, about 32ohm) up to 50k".I would use two non-inverting LM6172 in parallel. The circuit is very simple. What gain do you need?Another option is to make a circuit as it is in known headamps with a single power.For example, m3

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 17, 2021, 11:22:10 am
content: Thank you both for your replies.@Terry: funny you mentioned simulating because I just bought a subscription to circuitlabAnd regarding the output current the opamp should handle min 50mA, that should mean I can send a 1Vrms signal into 20 Ohm, correct?Regarding "If you need a balanced drive your circiut will work as shown. Well, if you have good resistor matching else you will have a common mode error that the FX input may not be able to handle." - are you saying that it will work whether the 10R resistors are inside the feedback loop or not?And do you think having the 10R resistor in the feedback loop will increase the power output into 32 or 16 ohms load?@Vovk_Z: the circuit is basically 2 non-inverting in parallel, the first one has a 2nd order filter.

author: pwlps
author_rank: Frequent Contributor
timestamp: February 17, 2021, 06:28:48 pm
content: Quote from: Vovk_Z on February 16, 2021, 09:34:21 pmNot necessarily true that it "doesn't need caps between inv. input and output. ", first it depends on the resistors, the lower the resistor values the more stable it is. For high-speed opamps you need low resistor values and/or a cap in parallel with the feedback resistor.examples:https://www.analog.com/media/en/technical-documentation/data-sheets/18134fa.pdfpage 11https://www.analog.com/media/en/technical-documentation/data-sheets/622012fc.pdfpage 15I can't see in which circumstances it would "make things worse".

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 17, 2021, 06:38:22 pm
content: Thanks pwlpsI have been doing simulation and it really helped, circuitlab is great!I got the answer to a few of my questions:* Having the 10R resistors in the feedback loop makes pretty much no difference (as I expected with a heavy load (16R fx) the opamp is already saturating so the voltage will not go higher, and with a light load 10 ohm makes no difference of course).Regarding the circuit 7) and the balanced output: I measured with circuitlab the difference between the two outputs (called LeftOut and RightOut in the attached daigrams), both the difference in magnitude and the difference in phase.* I get a phase difference because of the second filter but only on the high frequencies which are already highly attenuated* I also get a few mV difference in magnitude, but I realized that should not matter much, as long as it is not in the low frequencies (which will mean sending DC or "close" to the load), correct? At 1Hz the difference is less than 1uV.PS: the circuit for those diagrams is pretty much the same as 7) except I reduced C22 (cap on the second opamp) to 12pF and I moved the 10R resistors out of the feedback loops

author: pwlps
author_rank: Frequent Contributor
timestamp: February 17, 2021, 07:38:33 pm
content: I don't understand your second graph, is it a difference from the DC value ?(I have been teaching all day so maybe I'm just not fresh enough to understand)

author: Vovk_Z
author_rank: Super Contributor
timestamp: February 17, 2021, 09:25:55 pm
content: Thank you, pwlps, for info.I see today was not my da, I'm too unattentive.

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 18, 2021, 10:03:58 am
content: @pwlps: as I understood the simulation software runs a 1V sine wave on the input of the circuit for each frequency (1Hz to 100MHz).Then the signal is sent through the circuit and the output wave is measured. The signal's amplitude (MAG=magnitude of the complex number=amplitude of the signal) is then measured and converted into dBV, that's the first graph.The second graph is the phase of the output signals, and their difference.The third graph is the difference between the amplitude of the LeftOut and RightOut signals.Ideally we want, between the diffential signals, for all frequencies:* 180 degres phase difference* 0V amplitude differenceWhich I almost have, apart from 4.5mV difference at around 100kHz, and above 50kHz the phase difference (brown line) goes down. My guess is that is good enough?

author: pwlps
author_rank: Frequent Contributor
timestamp: February 18, 2021, 12:04:24 pm
content: Quote from: simonlasnier on February 18, 2021, 10:03:58 amOk I see, it was this one I was asking, I hadn't read your description correctly.QuoteIt looks good indeed. But I wonder how good is the simulation (especially at the highest frequencies) since as I understand CircuitLab uses a simple generic model for opamps (quoted from the documentation: "Op-amps are modeled as single-pole devices in the frequency domain."). Unless that with your subscription you have access to real models ?

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 18, 2021, 06:01:01 pm
content: Yes that's a good point - for example I tried to get them to oscillate (in the simulation) by removing all the filters and adding a huge capacitive load but it did not.I am not sure where the line is between the "real models" and the "single-pole devices", the parameters I have in the model are attached.But in any case it did answer a lot of my questions - so at least now I have a circuit I know has a good chance to work. I'll build it in the few days and measure the outputsThank you for the help!

author: pwlps
author_rank: Frequent Contributor
timestamp: February 19, 2021, 02:49:34 pm
content: Quote from: simonlasnier on February 18, 2021, 06:01:01 pmIt shouldn't with a purely first-order response, the phase margin will stay positive whatever the capacitive load.QuoteI don't even see the offset voltage here ? Anyway it looks like a toy compared to transistor-level models such as those used by LTSpice. Then of course it all depends on what you need, for audio buffers like yours a coarse modelling shouldn't be detrimental I think. But I remember having to find a fast opamp for a photodiode TIA measuring the duration of short light pulses, then it was important to have a real simulation to select the most accurate transient response (and actually I found the fidelity of those models very good). But apparently cheap brands like Gainsil don't publish such models (haven't seen any mention of it in the datasheet) so anyway you have no other choice than trying the real circuit

author: Saimoun
author_rank: Frequent Contributor
timestamp: February 20, 2021, 05:09:42 pm
content: Well I gave LTSpice a go. Actually really like the program, very quick to create circuits, and it's free!But like you said there is no model of my opamp so I have been looking for an equivalent in AD, LINEAR and TI. The closest I could find is the LT1677 (at least in the ones which have a model in LTSpice) which funny enough does not have nearly as much current output as my Gainsil one(in short I was looking for: rail-to-rail, single supply 3-5V, and at least 50mA of current output).Anyways, I have experimented with the values, also adding an extra opamp to try to get more current output with low loads (16ohm), but the difference stays small, and a bit of distortion at maximum volume is ok for my application.