LTSpice op amp help - Page 1
Forum section: electronics / beginners

author: injb
author_rank: Regular Contributor
timestamp: April 25, 2020, 04:31:17 pm
content: Can anyone help me to understand the output of the first op amp in this circuit please? It's the blue trace, labelled "second_stage_out".What confuses me is that I'm expecting a sine wave here. That's what I get in the real life circuit that this is copied from. The real life waveform does start to clip if I increase the input signal amplitude above a few volts, but it never looks like this weird square wave that I'm seeing in LTSpice.The first stage is an OTA (it's a CA3080 in real life). The op amp is supplied with a 12v supply in real life, with a 5v bias for the noninverting input, as shown.What I'm getting here in LTSpice looks like maybe the op amp is behaving as a comparator. But I've been over the real circuit many times to see if I've left anything out or made any mistakes, and I just can't find anything.

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: April 25, 2020, 04:52:31 pm
content: Hi,I suspect that the problem is with the OTA. The OTA is only partially documented in LTspice.referencehttp://ltwiki.org/index.php?title=Undocumented_LTspiceThere are lots of parameters to set to get it to match a real OTA.What is the OTA that you are trying to simulate?Can you share the real schematic around that OTA?Regards,Jay_Diddy_B

author: injb
author_rank: Regular Contributor
timestamp: April 25, 2020, 05:41:58 pm
content: Quote from: Jay_Diddy_B on April 25, 2020, 04:52:31 pmThanks! It's a CA3080 OTA. I've attached the schematic around the IC - the only thing that wasn't shown in my LTSpice circuit was the power/ground connections and the 0.1uf cap across them.I did try using a CA3080 model that I found (http://forum.designsoftware.com/index.php?topic=1000.0). With this model, I get a slightly better waveform out of the op amp (but still not accurate) but the amplitude is down to a few millivolts, which is nowhere near real life. The LTSpice OTA model gets me roughly the correct amplitude, but the wrong shape

author: injb
author_rank: Regular Contributor
timestamp: April 25, 2020, 11:37:24 pm
content: I decided to play around with the custom CA3080 model I linked to above and I made an interesting discovery. The problem with that model, as I mentioned before, was that although the waveform was closer to the true shape, there was almost no signal coming out of it - just a few mv instead of the hundreds of mv I was seeing in real life.Anyway I don't know much about Spice, but I decided to take a look and see if the person who posted that model just made a mistake that I could spot. After staring at it for a few minutes, the programmer in me realized that it's just a list of components and the connections between them, followed by the definitions of those components. And there are only 3: one of each type of BJT and a diode - how simple! And clearly the actual circuit is just the one taken from the CA3080 datasheet:But each one has a long list of parameters that I don't understand. Could some of those be inappropriate? Then a thought struck me: maybe those components can be declared without custom parameters - maybe there are sensible defaults? So I commented out the transistors and replaced them with NPN() and PNP(). It still wasn't quite right, so I did the same for the diode, and boom! It suddenly started behaving almost exactly like the real thing!So now my theory is that the person who made this model entered the circuit correctly, but got carried away with themselves when it came to customizing the parameters, and specified something that doesn't really match the real thing. Here's my final definition - I've left the original declarations in there, but commented out:Code:* CA3080 Operational Transconductance Amplifier** SPICE (Simulation Program with Integrated Circuit Emphasis)* SUBCIRCUIT** Connections:* INVERTING INPUT* | NON-INVERTING INPUT* | | NEGATIVE POWER SUPPLY* | | | I BIAS* | | | | OUTPUT* | | | | | POSITIVE POWER SUPPLY* | | | | | |.SUBCKT CA3080 2 3 4 5 6 7Q1 8 2 1 QN_OTAQ2 8 3 12 QN_OTAQ3 4 5 8 QN_OTAQ4 7 9 1 QP_OTAQ5 10 1 11 QP_OTAQ6 9 10 11 QP_OTAQ7 7 14 12 QP_OTAQ8 13 12 6 QP_OTAQ9 14 13 6 QP_OTAQ10 15 11 6 QN_OTAQ11 4 15 11 QN_OTAD1 5 4 D_OTAD2 1 10 D_OTAD3 7 9 D_OTAD4 12 13 D_OTAD5 7 14 D_OTAD6 15 4 D_OTA**.MODEL QN_OTA NPN(IS=21.48F XTI=3 EG=1.11 VAF=80 BF=550 ISE=50F NE=1.5*+ IKF=10M XTB=1.5 BR=.1 ISC=10F NC=2 IKR=3M RC=10 CJC=800F*+ MJC=.3333 VJC=.75 FC=.5 CJE=1.3P MJE=.3333 VJE=.75 TR=30N*+ TF=400P ITF=30M XTF=1 VTF=10 CJS=5.8P MJS=.3333 VJS=.75).MODEL QN_OTA NPN()**.MODEL QP_OTA PNP(IS=50F XTI=3 EG=1.11 VAF=80 BF=100 ISE=130F NE=1.5 IKF=1M*+ XTB=1.5 BR=1 ISC=0 NC=2 IKR=0 RC=0 CJC=4P MJC=.3333*+ VJC=.75 FC=.5 CJE=1.4P MJE=.3333 VJE=.75 TR=500N TF=23N ITF=.1*+ XTF=1 VTF=10 CJS=5.5P MJS=.3333 VJS=.75).MODEL QP_OTA PNP()**.MODEL D_OTA D(IS=2P RS=5 BV=40 CJO=3P TT=6N).MODEL D_OTA D()*.ENDSAs you can see I just replaced each one with an empty parameter list. And now I'm getting almost perfectly realistic behavior.Does my theory sound reasonable? I have no idea which parameters might have been steering it wrong, and I probably won't be able to figure that out any time soon. But I don't really need to since it seems to work well with the defaults.

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: April 26, 2020, 01:29:19 am
content: Hi,It is possible that the third party model is wrong.Would you 'should' do is test the model against the CA3080 datasheet. Especially the key parameters.Regards,Jay_Diddy_B

author: injb
author_rank: Regular Contributor
timestamp: April 26, 2020, 12:46:15 pm
content: Quote from: Jay_Diddy_B on April 26, 2020, 01:29:19 amThat sounds like a good idea, but it's a bit beyond my abilities at the moment. Any reading material you can suggest as a starting point?

author: Wimberleytech
author_rank: Super Contributor
timestamp: April 26, 2020, 06:30:06 pm
content: Quote from: Jay_Diddy_B on April 26, 2020, 01:29:19 amYou are correct Jay. The model is wrong. The transistor terminals are in reverse order. The collector terminal is wired as the emitter and the emitter as collector. I am going to modify it and see what happens next.

author: Wimberleytech
author_rank: Super Contributor
timestamp: April 26, 2020, 07:33:35 pm
content: Yeah, that model was FUBAR.I have spent a little time to fix it. I replace some of the diodes with proper bipolar equivalents (where obvious mirrors existed).I put together one of the simulations from the datasheet and get more or less functional operation.The model needs more work, I am sure but this is something to play with. Sorry about the look of the symbol...did not want to take the time to make it pretty.

author: injb
author_rank: Regular Contributor
timestamp: April 27, 2020, 12:35:29 am
content: Quote from: Wimberleytech on April 26, 2020, 07:33:35 pmThanks for taking the time to do this!Strangely, I replaced my model definition with yours and got exactly the same behavior as my modified version. All I did in my modification was to remove all the parameters from the transistors and the diode. So the transistors must have been still backwards, but apparently it doesn't make any difference in my circuit.

author: Wimberleytech
author_rank: Super Contributor
timestamp: April 27, 2020, 12:22:24 pm
content: Quote from: injb on April 27, 2020, 12:35:29 amThat is strange. Try to run the ca3080 test file with your modified version and see what you get.

author: injb
author_rank: Regular Contributor
timestamp: April 29, 2020, 12:44:01 pm
content: Sorry for the delay - I finally got around to testing this. So I do see different results between my model and yours inyourtest circuit, but not in mine. I've attached screenshots showing both your circuit and mine for each test.In my test circuit, the blue trace is taken from the first op amp output - the colors are reversed compared to your circuit (green in, blue out).

author: Wimberleytech
author_rank: Super Contributor
timestamp: April 29, 2020, 12:54:53 pm
content: Not sure what is going on here.Rather than try to make the 3080 subcircuit work, just build a new model. Here is a paper that might help:http://athena.ecs.csus.edu/~matthews/EEE_109/10_21/App_12.pdfGo down to the discussion around figures A28/A29.

author: injb
author_rank: Regular Contributor
timestamp: April 29, 2020, 01:01:19 pm
content: Quote from: Wimberleytech on April 29, 2020, 12:54:53 pmThanks. I am getting pretty realistic results with either model now, but I will probably try building it again from that document out of curiosity.On that note - how do you go about selecting the various transistor and diode parameters? Are the spice defaults way off?