Op amp oscillating like crazy… - Page 1
Forum section: electronics / beginners

author: CountChocula
author_rank: Unknown
timestamp: September 16, 2023, 03:22:19 am
content: I am—perhaps too naïvely—trying to build an amplifier that can be programmed to provide between 2.0x and ~3.3x gain to a 1MHz signal that is 500mV p-p (ideally up to 10MHz, but the frequency seems irrelevant to the problem at hand). The idea is to use a 4051 multiplexer to tap into a string of series resistors to control the gain. I am, for the moment, ignoring the fact that the 4051 introducessomeresistance into the equation, which I don't think should be a problem here. The circuit is mounted on a custom PCB that I had made.What happens is this: when I use the first two taps, the thing works and provides the expected amount of gain at the output of the op amp. As soon as I get into the third tap, all hell breaks loose and the amplifier oscillates at something like 11MHz. I tried changing the value of C18 experimentally from 10pF to 10nF but it doesn't seem to make much of a difference. Can someone please help me understand what might be going on? Thanks!—CC

author: TimFox
author_rank: Super Contributor
timestamp: September 16, 2023, 03:38:42 am
content: You need to specify a lot more of the problem.1. What op amp?2. What resistor values?3. Very important: how much capacitance appears from the inverting input of the op amp to ground?

author: Kim Christensen
author_rank: Super Contributor
timestamp: September 16, 2023, 03:40:10 am
content: 4. Post a schematic.5. Post a picture of the PCB.

author: CountChocula
author_rank: Unknown
timestamp: September 16, 2023, 03:41:53 am
content: Gah, somehow the schematic didn't get posted, I'm sorry. Let's try this again.

author: Kim Christensen
author_rank: Super Contributor
timestamp: September 16, 2023, 04:35:00 am
content: Hmmm... wouldn't having C18 make it less stable? I'd think a small capacitor (a few pf) across pins 2&6 would make more sense.

author: DavidAlfa
author_rank: Super Contributor
timestamp: September 16, 2023, 04:53:15 am
content: 10uf input cap for 1MHz signal?100nf should be more than enough (xc=1.6ohms).The way RV is connected varies the load on the input signal. Better to connect the potentiometer between input and gnd, and connect the cursor to the amp.

author: magic
author_rank: Super Contributor
timestamp: September 16, 2023, 06:13:25 am
content: Try to use one feedback resistor and switch different values of R2 into the circuit.

author: dietert1
author_rank: Super Contributor
timestamp: September 16, 2023, 06:32:42 am
content: I'd guess at the very high GBW product of the selected amplifier the chain of 100R resistors together with the small input capacitance of each MUX input forms a phase shifter that causes instability at some point - as observed.At 11 MHz a 90° phase shift is about 22 nsec. The phase shift caused by C18 can be up to 100 pF * 300 Ohm = 30 nsec. C18 should be deleted.Anyway one would prefer to connect the MUX output to the negative opamp input in order to switch current free, in order to take the MUX resistance out of the voltage division.Regards, Dieter

author: iMo
author_rank: Super Contributor
timestamp: September 16, 2023, 07:35:25 am
content: I would try to remove the C18, put 10n in parallel with the input 10u (you want to go from audio freqs to 10MHz with your DDS it seems), and I would insert a 50ohm resistor directly to the opamp's output. Also the input divider (10k/4k7) should be made of lower values, like 1k/470, imho..

author: Terry Bites
author_rank: Super Contributor
timestamp: September 16, 2023, 10:09:56 am
content: Imo and others have spotted your problem. Loose C18, its gift to the instability monster.You can reduce gain errors casued by Ron issues using the attached topology.Only opamp bias currents flow in the analog switch. Ron*Ib is very low. Say 1mV with your mux and opamp.Think about using a lower Ron and/ or Ib part if thats too much.Or use a high speed fet input opamp and using the 1717 as an output buffer. See AD app noteSave yourself a lot of pain with an oven ready VGA or PGA. Check out the MAX3522B.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 16, 2023, 10:44:57 am
content: Before reading comments, C18 also immediately drew my suspicions.As for the MUX, at the very least mirror it, so pin 3 of the mux is directly connected to the inverting pin of the opamp. The reason for doing this is that the resistance of the MUX switches changes with the voltage on the switch (referenced to GND), and when the MUX is on the other side of the resistors, the voltage on the switches change less, and the change of the switch resistance wit voltage causes distortion of the signal.But the circuit posted by Terry Bites is even better because no current flows through the switches, (except for the very tiny opamp bias current), and the switches are also not in the path of the gain determining resistor string. So that topology both avoids the distortion, and improves gain accuracy.

author: dietert1
author_rank: Super Contributor
timestamp: September 16, 2023, 11:21:23 am
content: The selected opamp is "uncompensated", i.e. unstable without a feedback capacitor as shown in the datasheet, Fig. 54.Regards, Dieter

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 16, 2023, 01:05:04 pm
content: Datasheet claims LM7171 is stable with a gain of 2 so it's probably only partially decompensated. But those high speed opamps can be temperemental. This probably won't work on a breadboardThere is also a quite different way.If you upgrade the AD9833 for an AD9850, then you get a (DC) current input that can be used to set the output amplitude, an this works down to very low levels.

author: dietert1
author_rank: Super Contributor
timestamp: September 16, 2023, 01:24:19 pm
content: Quote from: Doctorandus_P on September 16, 2023, 01:05:04 pmThe datasheet paragraph 7.5 has the answer to OPs question. He can save his prototype board by taking away C18 and instead adding the compensation capacitor.Regards, Dieter

author: iMo
author_rank: Super Contributor
timestamp: September 16, 2023, 01:31:36 pm
content: Something like this..

author: Zero999
author_rank: Super Contributor
timestamp: September 16, 2023, 01:48:29 pm
content: Quote from: Terry Bites on September 16, 2023, 10:09:56 amOr a digital potentiometer, rather than that multiplexer and all of those resistor.s. The 74HC4051 has an on resistance of 40Ω with a +/-5V supply, so won't be any more accurate.

author: iMo
author_rank: Super Contributor
timestamp: September 16, 2023, 02:02:48 pm
content: ~20y back I got 2 kits from US for the 9851 + video opamp and there is a digital potentiometer on the board as well. Not populated in my case, however. I cannot find the schematics anymore, but I will post a shot at least..PS: DDS-60 kit fromhttps://amqrp.org, DS1804 potentiometer in the video amplifier..

author: ledtester
author_rank: Super Contributor
timestamp: September 16, 2023, 03:42:14 pm
content: Quote from: iMo on September 16, 2023, 02:02:48 pmI remember that kit. That was back when it was a lot easier to get free samples of chips.

author: BrianHG
author_rank: Super Contributor
timestamp: September 16, 2023, 03:49:22 pm
content: Fiddling with an opamp feedback path, length and values, is a recipe for problems all over the board. Try to keep it to the 2 fixed resistors, as close as possible to the opamp with a fixed gain of 3.3x. Use your gain divider switch to attenuate the input from 1:1, to 2.0:3.3 to get your programmable gain.If you do not need low frequency, like down to 1hz, IE a range of 100khz and up, maybe using an NPN transistor switched resistor divider where you can select between 4 parallel resistors using 4 cheap NPN transistors to the GND.If your opamp will never clip even at 3.3x gain, then you can also adjust the gain at the output of the opamp if you want it easier to create a constant load input.You can also look at 4 quadrant multiplier mixers if you want a precision voltage input gain control.

author: CountChocula
author_rank: Unknown
timestamp: September 16, 2023, 08:54:57 pm
content: Thanks for the all kind suggestions, everyone. I had already tried taking out C18, but it made things worse—the op amp oscillates around 18MHz regardless of how the mux is set. I will try a compensation cap between the non-inverting input and the output to see if it has any effect, and then I'll make my way down the list of feedback to see if anything has an effect.Thanks also for all the alternative suggestions, like PGAs and such; these are valuable, but they kinda defeat the purpose of learning how to work with these fast op amps, which was one of my objectives with this project. (For context: I had already wired this up with a '358 to validate the basic idea—at much lower frequencies, of course—so I thought it would just scale up with a faster op amp… which is clearly not the case.)I also saw that alternate topology fromAnalog AN—too late for this spin of the board, and it does make the math for the value of the resistive feedback network a bit more complicated, but maybe I will give it a try if I decide to redo the PCB.—CC

author: TimFox
author_rank: Super Contributor
timestamp: September 16, 2023, 09:19:11 pm
content: Quote from: Terry Bites on September 16, 2023, 10:09:56 amI used that circuit 40 years ago, with a CD4052 (original RCA version) mux and a Harris 2510 high-slew-rate op amp.(Two manufacturers no longer with us, but some of their parts live on after them.)As you stated, theRONof the switch does not enter directly into the gain, and the four resistors can be relatively low valued (so long as the amplifier can drive the series string).

author: Benta
author_rank: Super Contributor
timestamp: September 16, 2023, 09:33:29 pm
content: Why the LM7171?The LM6171 is much better behaved, and if you need compensation on the LM7171, probably faster.

author: CountChocula
author_rank: Unknown
timestamp: September 17, 2023, 12:00:16 am
content: Adding the compensation capacitor did the trick! I had to go up to 100pF before it started working, but it's working now. Thanks, all!

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 17, 2023, 12:29:05 pm
content: But did you also remove C18?

author: CountChocula
author_rank: Unknown
timestamp: September 17, 2023, 12:32:41 pm
content: Yes. With the compensation cap in place and no C18, everything seems to be stable. Thanks!