Author Topic: Oscillating op-amp circuit  (Read 710 times)

0 Members and 1 Guest are viewing this topic.

Offline Alex_BakerTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
Oscillating op-amp circuit
« on: January 19, 2025, 11:06:06 pm »
I am working on building a constant current source for a transistor curve tracer that I am building. This circuit works in concept, I tested it in LtSpice. The problem is that it wants to oscillate at about 1.6MHz.

Using what I have learned from school I know that I want to reduce the gain at high frequencies, which I can do by adding a capacitor in parallel with R5. This only gets me so far though, I can't seem to fully damp the oscillations with this method.

If there are some solutions to this problem, or if my methods here are fundamentally flawed, I would appreciate the feedback!

note: In the uploaded schematic the bypass caps are not grounded, this is only a schematic error.
 

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 726
  • Country: 00
Re: Oscillating op-amp circuit
« Reply #1 on: January 19, 2025, 11:23:45 pm »
This will help.

https://www.eevblog.com/forum/blog/eevblog-1609-composite-amplifier-tutorial-practical-demo/

Don't forget that the transistor is also an amplifier and the bandwidth must be much larger than the bandwidth of the servo amp. The solution is compensate the servo amp.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 15240
  • Country: de
Re: Oscillating op-amp circuit
« Reply #2 on: January 20, 2025, 09:06:50 am »
The 2nd amplifier in loop with additional gain makes oscillation likely. A bit surprising that it did not oscillate in the simulation, but it is still boarderline and parasitic capacitance and details in the model can make the difference. Chances are one would want an additional capacitor as direct FB of the outer amplifier and a resistor in front of the other OP's signal to the feedback.

The transistor should be fast enough for the LM358. So no problem there.
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2150
  • Country: au
    • Halestrom
Re: Oscillating op-amp circuit
« Reply #3 on: January 20, 2025, 10:41:58 am »
> constant current source for a transistor curve tracer

This circuit looks quite complex.  Is the transistor Q1 the DUT?  If not then where is the output?

If useful I can suggest simpler constant current source circuit using an LM358, a single resistor, a single pot and no need for a split-rail power supply.    But I might be completely misunderstanding what you want to build.

Offline Alex_BakerTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
Re: Oscillating op-amp circuit
« Reply #4 on: January 20, 2025, 03:36:00 pm »
Thanks for the input Wales.

In this circuit Q1 is not the DUT, it is only a pass transistor. R6 is a load resistor representing the base-emitter current path of an npn transistor, I know this is not a good approximation of a base-emitter junction, but I figured for a good constant current source it shouldn't matter.

I am not sure what circuit you are talking about but your point makes me realize that Q1 may not be necessary, I think the op-amp itself can source the small currents I am attempting to control.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 15240
  • Country: de
Re: Oscillating op-amp circuit
« Reply #5 on: January 20, 2025, 03:52:53 pm »
The transistor is not necessay, but it is also not the problem and a good idea if the current gets higher than some 5 mA. It reduces the heat produced in the OP-amp this way helps with precision.

There are simpler ways to make a current source with a single OP-amp. The classic ciruit is the Howland current source. A detailed description is here:
https://www.ti.com/lit/an/snoa474a/snoa474a.pdf
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2150
  • Country: au
    • Halestrom
Re: Oscillating op-amp circuit
« Reply #6 on: January 20, 2025, 07:23:08 pm »
In this circuit Q1 is not the DUT, it is only a pass transistor. R6 is a load resistor representing the base-emitter current path of an npn transistor, I know this is not a good approximation of a base-emitter junction, but I figured for a good constant current source it shouldn't matter.

I am not sure what circuit you are talking about but your point makes me realize that Q1 may not be necessary, I think the op-amp itself can source the small currents I am attempting to control.

Ahah, thankyou :)

You can probaby remove U1B and the transistor, then connect the output of U1A directly to where the transistor's emitter is.  I think -- I'm tired and rushing to get ready for work, so I might have missed something :P

Offline Alex_BakerTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
Re: Oscillating op-amp circuit
« Reply #7 on: January 20, 2025, 09:20:58 pm »
There are simpler ways to make a current source with a single OP-amp. The classic ciruit is the Howland current source. A detailed description is here:
https://www.ti.com/lit/an/snoa474a/snoa474a.pdf
I ran this circuit in LtSpice and it appears to work very well, thank you! I will also test it on a breadboard when I get the chance.
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2625
  • Country: gb
  • Recovering Electrical Engineer
Re: Oscillating op-amp circuit
« Reply #8 on: January 23, 2025, 05:28:10 pm »
I'd be inclined to build a free standing current source rather than integrating it into the measurment amp.
It could be a good idea to put a limit on the CCS bandwidth as shown.
The current source will run out of compliance puff as it nears the opamp input and output ranges.
 

Offline Alex_BakerTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
Re: Oscillating op-amp circuit
« Reply #9 on: January 23, 2025, 05:48:09 pm »
Thanks for the suggestion!

I think the howland current pump will work very well for my needs, its bandwidth can be limited by a small capacitor in parallel with the feedback resistor, preventing overshoot and ringing.
 

Online EggertEnjoyer123

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: us
Re: Oscillating op-amp circuit
« Reply #10 on: January 24, 2025, 02:17:28 am »
I think you can fix your original circuit by replacing U1B with an integrator.

Making U1A slower is counterproductive because it makes the feedback signal slower, so U1B is reacting to delayed information. Intuitively, if you are driving a car and the speedometer is delayed by 10 seconds, you would find it hard to maintain a fixed speed compared to if your speedometer updated in real time. Adding a capacitor to U1A basically does that and makes the feedback signal slower. If you're the driver of this car (like U1B), and you couldn't look out the window, then you would slam on the gas until the speedometer read 40mph (your target speed). By that time you're probably actually going at 100 mph. Then you would see that your speed keeps going up so you slam on your brakes, and the car reaches 0 mph. However, your speedometer is delayed so you would see it go to 100 mph and then down again. Once it reaches 40 mph and keeps going down you would slam on the gas again, and the result would be that you keep on oscillating between 0 mph and 100 mph instead of converging on 40 mph. If we got rid of the 10 second delay, you would probably be able to maintain 40 mph easily (though if you drove like U1B in this circuit you would slam on the brakes when the speed reaches 40.001 mph and slam on the gas when it reaches 39.999 mph, and your speed would still be unstable).

The scientific explanation is that op amps have a pole at very low frequencies in the single digit Hz range. The open loop transfer function of your system is the product of U1A and U1B's transfer function. Adding a capacitor to U1A adds 90 degrees phase shift after the pole frequency formed by the RC network. Let's assume the pole is at 1 kHz. Then at 10 kHz the phase would be pretty much 90 degrees, and the attenuation might only be 20 dB (I am just making up numbers here but the logic is the same). U1B in open loop would have a response similar to the image below (this is a different op amp but it's the same idea). You can see that U1B probably has a pole around 1-10 Hz, and therefore the phase is 90 degrees at 10 kHz. So at 10 kHz the phase is basically 180 degrees (and probably a little over because of random parasitics), which means it oscillates if the gain is high enough (180 degrees means the negative pin of the op amp sees the opposite movement of the output, so it will always try to move the system away from stability). U1B is basically open loop so it has a lot of gain (60dB from the image). The loss from the RC circuit is not enough to outweigh the 60 dB gain of U1B so it oscillates.

Making U1B an integrator means that it still has a 90 degrees phase shift, but at a certain frequency, the gain is under unity. As long as nothing else in your circuit has a pole around that frequency, your circuit is safe and won't oscillate. Maybe U1A has a pole at 1 MHz, but by the time the frequency goes to 1 MHz the gain of the integrator is basically zero, so there is no way your circuit can oscillate even if it can reach the 180 degrees phase shift.

« Last Edit: January 24, 2025, 02:47:10 am by EggertEnjoyer123 »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20533
  • Country: gb
  • 0999
Re: Oscillating op-amp circuit
« Reply #11 on: January 24, 2025, 11:36:55 am »
The problem with a Howland is it requires well-matched resistors. A solution to this is to use a differential/instrumentation amplifier IC, which has precision, matched resistors built-in.

Here are a couple of examples. The gain of the amplifiers is 1, therefore I = VIN / R1


* Howland diff amp.asc (1.53 kB - downloaded 35 times.)

* Howland intrumentation amp.asc (1.26 kB - downloaded 4 times.)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf