KiCAD Simulation OpAmp Voltage Follower

Hi Everyone,

I’m using KiCAD 8 and am new to using KiCAD simulation. I’m ultimately trying to get a differential amplifier to work. However, the output voltage is not matching what I expect. So, I tried making a very simple voltage follower and even this somehow does not output the voltage I’m expecting. How on earth can the output of this OpAmp. be 10mV less than the input and not equal?

Here are the simulation results:
Note: Codel model file loading path is /Users/robertfichera/Library/CloudStorage/OneDrive-Personal/Circuits/PROJECTS/KICAD_SIMS_EXAMPLE1/
Note: Compatibility modes selected: ps lt a
Circuit: KiCad schematic
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Reference value : 0.00000e+00

No. of Data Rows : 1

Simulation results:

I(v2): 0A
I(v.xu2.voff): 0A
I(xu2:in+): 0A
I(xu2:in-): 0A
I(xu2:vcc): 0A
I(xu2:vee): 0A
I(xu2:out): 0A
I(v5): 0A
I(v1): 0A
I(e.xu2.eout): 0A
I(e.xu2.elow): 74.9968fA
I(e.xu2.ehigh): -4.945pA
P(v5): 0W
V(+25mv): 25mV
P(v1): 0W
V(net-u2—): 64.9968mV
V(net-u2-+): 75mV
V(+5v): 5V
P(v2): 0W
P(xu2): 0W
V(xu2.lcc): 5V
V(xu2.lee): 0V
V(xu2.2): 64.9968mV
V(xu2.int): 64.9968mV
V(xu2.inoff): 65mV
Background thread stopped with timeout = 0

You can praise the simulator. (and/or the model you used).
Everything is working as designed. What you are seeing is the offset voltage of the opamp, and for generic opamps, an offset voltage of 10mV is perfectly normal for a jelly bean opamp such as for example an LM358. Do note that the polarity and amplitude of this offset voltage will be different for each physical opamp you buy.

For learning how opamps work and their properties, limits and peculiarities the book “Opamps for Everyone” a.k.a. SLOD006B is an excellent reference.

Any idea then why this is not outputting 2 * (150 - 25) = 250? why is the output so low?

This has nothing to do with how KiCad works. The simulation is doing it’s thing and it is working correctly.

For a differential amplifier (R2/R3) has to be equal to (R1/R4).

You will not be able to make a properly working circuit out of this (either in simulation or breadboard) without understanding how opamps work. You can buy 10’s of thousands of different opamps, and they are all different because it simply is not possible to build an “ideal” opamp. So you have to know which deviations are acceptable in your application, and to know that, you have to know how opamps work.

I understand how opamps work. I understand my OpAmp won’t perform ideally. What I am trying to understand is why, on even a fundamental level, the schematic I made does not work. The output is not even close to twice the difference between the two inputs. You’re saying that is an inherent deficiency about opamps?

Please post your complete, zipped project here.

Last time:

V3 is defined as 150mV.
V_P is half of that, so 75mV
V_M is 65mV because of the 10mV offset of the opamp.
R1 has a current of (65mV - 25mV) / 50k = 800nA
R4 has a voltage over it of: 800nA * 100k = 80mV
Output voltage is thus 65mV + 80mV = 145mV

Are you still sure about that? First you did not know about the offset voltage, and now you had problems with a bit of division and multiplication. There is a lot more to opamps then seeing some circuit and applying some formula. Just the imbalance of the resistors you used shows you do not understand a differential amplifier well yet.

You’ve got a working spice simulation, you’ve got a pointer to a good reference about opamp theory. Now mix in some brainpower and experimentation. Change some resistors or input voltages and observe what happens. Try to understand why it happens.

You should add PWR_FLAG to the GND and Vss connections. You will note that your op-amp is drawing exactly zero current in the simulation (because the simulator does not think it is powered).

Nope. PWR_FLAG is for ERC not for simulations.

Nope. There is (145mV - 65mV) over R4, and the 800nA for that is coming out of the output of the opamp. But it is curious there are 4 labels around the opamp with 0.00A. I am guessing that supply current is not modeled properly for this opamp.

1 Like

Yes I am still sure about that. I am a hobbyist trying to learn as I clearly pointed out in my original question. Your condescension is not appreciated and unwelcome. Obviously you have personal experience working with these. You don’t need to throw that around through arrogance and snark against someone who is genuinely trying to learn. Maybe this comes naturally to you. It doesn’t to me.

I’m not being condescending or arrogant. I am just pointing out false claims. There is absolutely nothing wrong with admitting you’re a beginner or do not understand things well. It did not come to me naturally either. It took me weeks or months (part time) before I really understood such details.

The problem is you claiming:

If I was arrogant, I would have closed this thread after your opening post with a single remark of “off topic”, because this whole forum is for learning to work with KiCad, and not for learning electronics. There are better forums for questions about general electronics and how opamps etc, work.

I you want (can stand) a snark remark:

No, you did not. What you wrote was:

… then some explanation of what you want to be your end result.

and then:

And that is not a remark anyone would expect from someone who claims to know how opamps work.


Overall, I’m happy to help, or else I would not have read your topic and typed these posts. But I do not like false claims, because those lead to false assumptions on our side, and therefore make topics more difficult to answer.

You’re happy to help but quick to judge.

Again:
I’m not judging.
I’m mostly highlighting some contradictions and bouncing your own words back.

I am guessing you’re still pretty young and have not dealt much with criticism yet. A mistake that I see lots of people make is.

  1. They hear or read something.
  2. They interpret that in some way.
  3. They give a meaning to that interpretation.
  4. They react according to their interpretation.

And all along the line they did not even realize that the message got horribly warped between steps 1 and 4. And continuing along that line. There are also translation steps on the other side. From forming a thought to putting that thought into words and typing it.

If you read back this thread, is there anything I wrote that I “judged you”? And even if so, what do you think my intention with that same sentence might have been?

If you’re using the built-in op amp model with default sim parameters, then you may not have noticed that the default voltage offset is 10 mV.

Bingo! That’s the piece I was missing! I set Voff = 0 and now it works as expected. Thank you for your straightforward response.

Now this makes me wonder. How much do you actually know about opamps?

I will defend @paulvdh here. I think that he is being blunt and straightforward. It has been difficult to work with him at times, but he “knows his stuff” and I agree with his opinion in this case.

Generally speaking with resistances and voltages that are reasonable, you should assume negligible input (bias/offset) current into the op amp, and use simple resistor voltage division to calculate the voltages at the op amp inputs and op amp output.

For me your second sentence means that you know about OpAmp imperfections (with input offset among them).

If you read carefully what paulvdh write you could have discovered it earlier:

And I understand him not telling it second time to not be perceived as rude.

These “assumptions” you keep making and snarky little quips only prove my earlier point.

It would have helped it you gave a decent response instead of repeated personal attacks.

This reminds me of another running thread, about someone who somehow fails to see he can’t connect a fuse, because there is no power input connector: Fuses always break the circuit Kicad 8

The question has been answered. You can pm sfnagle if you want, but he probably would not have given the answer without the previous posts in this thread.

I’ll lock this thread now to prevent further escalation.
(I am NOT a moderator, but I do have some superpowers as a level 4 user)