DC operating point in simulation unexpected - Page 1
Forum section: electronics / projects

author: shadewind
author_rank: Frequent Contributor
timestamp: November 06, 2011, 03:46:42 am
content: Hi,I'm building a simple filter circuit for guitar but when I tried to simulate it, the DC operating points were not as intended. The filtering is completely correct and as expected though.I used LTSpice and here is a picture of the schematic:http://cl.ly/2H2B0f181w0b0K2V0R0RFrom the left to the right we have first the input buffer which is a simple voltage follower biased at 4.5V, half of the 9V supply voltage which is merely implied in this case since I'm using ideal op amps. At DC, this should give the output of the buffer a reading of 4.5V which it indeed does. The second stage is the filter stage itself in an inverting configuration with a unity gain at DC given by the two 4.7 k resistors. The buffer stage operates at 4.5V DC and this is fed into the inverting input. Since the non-inverting input is held at 9V, this would yield an input of 9V - 4.5V and thus an output voltage at the filter of 4.5V.This is not the case since LTSpice tells me it is 13.5V which is 9V + 4.5V, not according to my intutition. Of course, if I do a nodal analysis, the result of the LSpice simulation is entirely correct. The voltage at the inverting input is 9V according to the op-amp laws which causes a current to flow through R2 which must be the same current as the one through R5. Thus, the voltage across them is also the same and the output is therefore 9V plus the voltage drop across R5 which is 4.5V equaling 13.5V.This seems counterintuitive to me but I realize that is what must happen. Can someone put this into words so I can understand intuitively as well?Changing the voltage at the non-inverting input to 4.5V seems to be the solution as far as I can see. This eliminates the potential difference across R2 and this leaves no current flowing at DC which makes the voltage across R5 and thus the output 4.5V, same as the inputs. Is my thinking correct here?

author: Rufus
author_rank: Super Contributor
timestamp: November 06, 2011, 04:17:41 am
content: Not sure how to explain to you what you thought is wrong.A simple inverting op-amp configuration inverts the signal on it's -ve input resistor with a gain set by the ratio of the two resistors. The -ve input pin of the op-amp is called a virtual earth because the huge gain of an op-amp means in any working circuit the two inputs are at virtually the same voltage.The -ve input is called a virtual earth because it is virtually the same as the +ve input which is the real earth, the earth with respect to which input and output voltages are considered.You used +9v as the real earth for that stage which means the input was -4.5v and the gain of -1 produced an output of +4.5v.Remember in any op-amp circuit the +ve and -ve inputs will be at the essentially same voltage, if not the op-amp output will be hard against one rail or the other.Hope that leaves you less and not more confused.

author: shadewind
author_rank: Frequent Contributor
timestamp: November 06, 2011, 10:48:35 am
content: But when I used 9V for the non-inverting input of the second stage, the output was _not_ 4.5V, it was 13.5V. Making a circuit analysis relying on the laws of an ideal op amp where the inputs are the same voltage and no current flows into them, it makes perfect sense since the potential difference across R2 causes the same current to flow through R2 and R5 leaving me with exactly 13.5V when going from the inputs to the output of the second stage through R5.4.5V seems to be the correct value for the voltage at the non-inverting input of U2. Can someone verify?Edit: Maybe that's what you actually meant?

author: jimmc
author_rank: Frequent Contributor
timestamp: November 06, 2011, 03:47:07 pm
content: Yes that is correct and is what Rufus meant.I think your problem might be with realising that Op-Amps have only two supply terminals, they have no 'knowledge' of where ground is and, with the provisos that Rufus mentioned, the output voltagerelative to the inputsis determined by the differential input voltage which tends to zero.Jim

author: Rufus
author_rank: Super Contributor
timestamp: November 06, 2011, 04:26:45 pm
content: Quote from: shadewind on November 06, 2011, 10:48:35 amIt was +4.5v with respect to the 'earth' voltage you put on the +ve input. It is your circuit, you choose what to put there and remember it is the reference for input and output.

author: shadewind
author_rank: Frequent Contributor
timestamp: November 06, 2011, 05:20:40 pm
content: I find it's easier to use circuit analysis techniques until I've learned how to do it intuitively.I also realized that I can use DC coupling between the filter and the last stage as well by simply removing the 0.22 uF cap between them. Can someone verify this?

author: ciccio
author_rank: Frequent Contributor
timestamp: November 06, 2011, 06:14:42 pm
content: I suppose that :first: DC supply voltage is + 9Vsecond : the bias voltage (+4.5 V) is derived from a very low impedance point, e.g. a "virtual ground"If this is correct, being the first three stages DC coupled, the first three outputs will be at +4.5 V only if all the first three non inverting inputs are wired to the +4.5V bias voltage.The second op-amp will not try to make a difference of it's inputs voltage, but to keep it to zero.That means that, if you bias U2 non-inverting input a +9 V, it's inverting input will be forced to +9 V.This input is at the center of a 2 resistor network (R2 and R5).If the one side of R2 is at +4.5V, the junction of R2 and R5 is at +9V, then the other side of R5 (U2 output ) must be at 9 + 4.5 V = +13.5 VThe supply voltage is not enough, so the output will be stuck at +9V and the circuit will not work.Yes, you can simplify the circuit by removing the 0.22 cap in last op-amp input.You can simplify even more by taking the output at U3 (obviously with a coupling capacitor) and using U4, two 100 k resistors, one 1N4148 diode and one electrolytic cap. for building the virtual ground circuitRegards

author: shadewind
author_rank: Frequent Contributor
timestamp: November 06, 2011, 11:11:55 pm
content: Quote from: ciccio on November 06, 2011, 06:14:42 pmCould you elaborate on this a bit more? I'm not sure I understand.

author: w2aew
author_rank: Super Contributor
timestamp: November 07, 2011, 01:21:13 am
content: One of the best ways to think about opamp biasing when using proper closed loop negative feedback (as you are), is this. The opamp will attempt to adjust its output towhateverit needs to in order to make the (-) input equal to the (+) input voltage. Simple as that. Let's apply this logic to your 2nd stage:Thus, in your case, with 9V applied to the (+) input, and 4.5V applied to the left side of the 4K7 in series with the (-) input, the opamp will adjust it's output so that the (-) input lands at 9V. This means that the 4K7 input resistor will have 4.5V across it, with the more positive side at the (-) input. Since the (-) doesn't draw any current (ideally), the current through the 4K7 input resistor also flows through the 4K7 feedback resistor, thus putting the output voltage at 9 + 4.5V = 13.5V.I hope this makes it clear why you are seeing what you are seeing....and yes, the correct solution is to change the voltage at the (+) input to 4.5V.Alan

author: shadewind
author_rank: Frequent Contributor
timestamp: November 07, 2011, 01:33:26 am
content: Quote from: w2aew on November 07, 2011, 01:21:13 amYes, this is what I said above although perhaps not as clearly. I just didn't find it intuitive but it made perfect sense when analyzing the circuit.Something that I understand intuitively but not theoretically is the difference between the inverting and non-inverting inputs. Most texts I've read talk about the two laws of the ideal op amp. The first being that no current ever flows into the inputs and the second being that the op amp will always try to make the voltage at the inputs the same. But these laws do not speak to the difference between the inverting and non-inverting input. Shouldn't there be some third law? To be clear, I understand how it works but there should be some third theoretical law to express this.

author: w2aew
author_rank: Super Contributor
timestamp: November 07, 2011, 02:02:42 am
content: Quote from: shadewind on November 07, 2011, 01:33:26 amTwo additional simple rules/properties of the inverting and non-inverting inputs:1) If the voltage at the non-inverting input is higher than the voltage at the inverting input - the output will be high. If the voltage at the inverting input is greater than the voltage at the non-inverting input - the output will be low.2) Assuming the inverting input is constant, the output voltage moves in the the same direction of the voltage change at the non-inverting input (i.e. gain is non-inverting). If the non-inverting input is constant, then the output moves in the opposite direction of the voltage change at the inverting input (i.e. gain is negative/inverting).Practically speaking the open-loop voltage gain of typical voltage feedback opamps is HUGE, so only a miniscule difference in voltage between the two inputs will cause the output to move a lot. Typically, the feedback's action is to make this difference close to zero.Maybe these words help...

author: IanB
author_rank: Super Contributor
timestamp: November 07, 2011, 02:21:56 am
content: Quote from: shadewind on November 07, 2011, 01:33:26 amIf your understanding and analysis of a situation is correct, then intuition and theory should be aligned and both should lead to exactly the same conclusion. On the other hand, if your intuition seems to lead to a different conclusion than your theoretical analysis, then either your intuition or your analysis is incorrect. Then you need to find out which is which. If you are really sure your analysis is correct (especially if supported by a circuit simulation), then your intuition must be wrong and you must correct your intuition.A convenient way of looking at an op amp if you have any knowledge of control theory is that it is a proportional controller with a very high gain. Of the two inputs, one can be considered the set point and the other the measured variable. The control action (forward or reverse) depends on whether you consider the inverting or non-inverting input to be the set point.The interesting thing about a real proportional controller is that the output has a default rest position when there is no error in the input (no difference between the two inputs). This is where perhaps someone can educate me as I am not familiar with what op amps do if you connect their two inputs together. Does the output swing to one of the rails or does it find some middle point? Or does it depend on the device? (Says me thinking I should maybe get out my breadboard and try to find out.)

author: Rufus
author_rank: Super Contributor
timestamp: November 07, 2011, 02:49:48 am
content: Quote from: IanB on November 07, 2011, 02:21:56 amThe ancient LM741C has a typical open loop gain of 200,000 and input offset voltage of +/- 2mV so with inputs shorted the output wants to be somewhere between +/- 400V. If you were lucky enough to find one with the output sitting at 0v it would drift about 3v per degree C.Edit: That would be with inputs shorted and connected to some voltage within the common mode range. Just shorted with no source of bias current for the inputs I'm not sure what the output would do.

author: ciccio
author_rank: Frequent Contributor
timestamp: November 07, 2011, 06:53:40 am
content: Quote from: shadewind on November 06, 2011, 11:11:55 pmThis evening I'll try to post a diagram.Refer to the attached image.Two equal value resistors keep non-inverting input at half power supply voltage. They can have an high value, eg. 100 k, to reduce current drain.The unity gain amplifier will buffer this value at his output and it will be a low impedance source, due to feedback.The capacitor will give a "soft start", will filter out any supply noise and will help in keeping a low impedance source. 4.7 to 10 uF will be OK.The diode will discharge the capacitor versus the supply source (9V) at switching off, preventing a damage to the op-amp input when switching off (without it the input may momentarily be at an highet voltage than the supply pin). An 1N4148 will be OK.Regards