SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By danvm
#146597
I don't know what the problem is, but opamps hate me. I have gotten one to function as a square wave oscillator, not what most would consider a 'normal use' for an opamp. threw it together on a breadboard worked perfectly the first time.

Now here's where the problem lies: I've tried hooking one up as an error amp, put 2 volts in, output of my regulator is slammed against the positive rail.

Hooked one up as a buffer, most basic opamp circuit there is, put in 2 volts. Output is either locked against vcc, or it's bouncing off the rails.

Currently working on a 1.25-16 volt power supply project which I have an arduino controlled DAC hooked up to a opamp as a reference and then to my output regulator adjust pin as an error amp/voltage gain. I needed some active error correction and voltage gain and thought "I'll just throw an op amp in there". Not once has it worked for me. I'm a little dissapointed and frustrated.

Insight appreciated.

Edit: I sjould probably add that im not new to electonics and I understand how op amps should work, and by all rights they should, but in the 2 years I've tried, I've never had one do what its supposed to.
By AndyC_772
#146605
Eh? The op-amp inputs are the wrong way round, that's all.

Also, the LM317 is quite slow to respond, so there is a risk of instability. Try fitting a small capacitor (say, 1nF) between the output of the op-amp and the -ve input if it oscillates.
By danvm
#146608
Wait, seriously? I did some poking around and found a number of references that show the +input being used for feedback.

@SpinDrah: my feedback is where the + hits the voltage divider.
By SpinDrah
#146611
thats not feedback, what you have there is a comparator, you are putting two voltages into an op-amp without feedback.

the way i look at an op-amp is the output is always trying to get that neg input to match the pos input.
By rrpilot
#146615
danvm wrote:Wait, seriously? I did some poking around and found a number of references that show the +input being used for feedback.

@SpinDrah: my feedback is where the + hits the voltage divider.
You may have seen it with a PMOS or PNP transistor in the feedback loop which in that case provides the 180 degree phase shift and you could set up the terminals like you have. Don't feel bad, I work with these a decent amount and still make silly mistakes here and there. What you have in your circuit is positive feedback which in most cases will run the output to one of the rails.
By AndyC_772
#146634
danvm wrote:Wait, seriously? I did some poking around and found a number of references that show the +input being used for feedback.
Seriously.

Trace your circuit through, and think carefully about what an op-amp actually does. The output of an op-amp is driven up towards the positive rail whenever the non-inverting (+) input is more positive than the inverting input (-), and towards the negative rail when the inputs are the other way around.

Normally we apply some arrangement of components around the op-amp which cause the inputs to change when the output does. That's what feedback is, and it can be applied to either or both inputs. It's certainly not the case that one input is always the signal and the other is always the feedback terminal.

The gain of the op-amp is extremely high, so even the slightest difference between the voltage at the two inputs is normally enough to send the output all the way to one of the supply rails. This is sometimes useful on its own (it's a voltage comparator), but we often want something which behaves more linearly and progressively.

In your circuit as you have it right now, let's suppose that for whatever reason the voltage at the output of the LM317 starts off a bit low. This means the voltage at the +ve input is a bit low, so the output voltage of the op-amp tends to decrease. Because of the way the LM317 works, this tends to make its output voltage decrease, which is exactly the opposite of what you want to happen. An output voltage which is too low already tends to become even lower, and an output voltage which starts off too high tends to become even higher. This is positive feedback.

Now reverse the inputs to the op-amp and think through the analysis again...

Suppose the output of the LM317 is a bit low. This now means the (-) input is more negative than the (+) input, so the output of the op-amp starts to go more positive. The output of the LM317 therefore becomes more positive, which now is exactly what you want to happen in order to correct the error.

As the output voltage increases, the voltage at the (-) input also increases, getting closer and closer to the voltage at the (+) input. The system will stabilise at the point where the voltages at the two input terminals of the op-amp are exactly equal, and the output of the LM317 is at the level you set with the DAC.
By nickersonm
#146638
SpinDrah wrote:thats not feedback, what you have there is a comparator, you are putting two voltages into an op-amp without feedback.
The feedback is through the regulator - AndyC explained it well. Danvm just has the inputs reversed for this application.