Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ltspice op amp simulation

Status
Not open for further replies.

normad

Member
im sorry if this is a question asked a thousand times before but im new and i tried reading the old threads but couldnt find an answer..
what im trying to do is to simulate an ideal op amp model to better understand active filter concepts.. but my lt spice simulation is giving a "unknown subcircuit called" error.. what does this mean?

i will attach the ltspice file.. please look through it if you have time :)

thanks
 

Attachments

  • Draft4..asc
    1 KB · Views: 2,626
You have the inverting input of the opamp connected to ground so the negative feedback is shorted and is completely useless.

You have the non-inverting input of the opamp biased at ground through the signal generator. Then its AC signal causes this input to go below its negative power supply voltage (0V) which might destroy the opamp.
 
i see :) i thought having a positive supply would amplify only the positive part..
i fixed all of that but still i get that error :confused:
 

Attachments

  • Draft4..asc
    1.3 KB · Views: 1,271
Opamp2 is the symbol you use when you want to simulate a model from another mfr.
For an ideal op amp need to use the opamp symbol, and add the directive ".lib opamp.sub" to the schematic.
Change the resistors to more reasonable values.
It generally makes sense to use 1V for the stimulus, so you can plot gain directly. The ideal op amp can handle any amplitude signal, so the voltage is not relevant to the model.
You won't need power supplies.
For some reason, my notebook computer will not allow me to upload .asc files.
 
If you want an opamp to amplify only the positive part and use a single supply then use an inverting amplifier circuit. The input signal will be positive and negative AC voltage swings but the inverting input pin of the opamp is always at 0V. It is inverting.

Your circuit with the dual polarity supply has the negative supply connected backwards. Correcting its polarity does not fix the error.
 
These are the things I had to do to make the simulation run:

Change the opamp from the generic (symbol only) "opamp.asy" to "UniversalOpamp2.asy" because it has an underlying simulation model, which the other one does not. The first figure shows what happens if you put the cursor on U1, and right click the mouse. The window that pops up shows you the default parameters of the opamp model. Note that this is a pretty "hot" opamp. 10MhZ, high gain, low input bias, rail to rail, etc.

Because you want to run the opamp on a single supply, I had to bias the non-inverting input halfway between GND and +15V using R3 and R4. That also requires the addition of the input coupling (DC blocking) capacitor C2, otherwise the 7.5V bias would be shorted to DC ground through the source.

It looks like you want a gain of 2 in the non-inverting configuration ((1+R1/R2)=2). However, the 10Ω resistors are much, much too low in resistance. The Universal OpAmp can only source 25mA, so it can not drive resistors that low... I raised the feedback resistors R1 and R2 to 100K, keeping the gain at 2. I also had to use a capacitor to ground the feedback network for AC, but let it float at DC so that the bias around the opamp is not disturbed.

Before simulating in the Frequency Domain (.AC) , it is a good idea to use DC analysis (.DC) to check if the circuit is biased correctly. If you skip this step, the .AC analysis might not show you what is going on. I named some of the relevant nodes so you can see what the .DC analysis shows:

Now that I see the two inputs and the output biased to 7.5V, it is ok to go ahead and do the .AC analysis. Note that by putting in the two DC blocking capacitors, we introduced a low-frequency roll-off. If ~10Hz roll-off is a problem, make C1 and c2 bigger. Note that because this is such a "good" opamp, you cant even see a roll-off at 100kHz. A "real" opamp might begin loosing high frequencies at 100kHz. Note the 6db gain; i.e. a gain of 2.

Finally, I also did a time-domain (.TRAN) simulation by inserting a +-3V 1000Hz signal source. Note the gain of 2, and the offset due to the 7.5V bias.

Note that to really check out a design, it is necessary to do all three analyses..., .DC, .TRAN, and .AC.
 

Attachments

  • Draft..4a.png
    Draft..4a.png
    25 KB · Views: 3,581
  • Draft..4b.png
    Draft..4b.png
    31.7 KB · Views: 3,852
  • Draft..4c.png
    Draft..4c.png
    30.6 KB · Views: 2,395
  • Draft..4d.png
    Draft..4d.png
    28.8 KB · Views: 4,319
  • Draft4..asc
    1.5 KB · Views: 1,025
Last edited:
You really don't have to jump through all those hoops to test active filters. Follow my suggestions in post #4.
In fact, if you really want an ideal op amp, use a voltage controlled voltage source ("e" element). You can either set the gain to a huge number like 1e9 and apply feedback to get the desired closed loop gain, or you can just set the gain to the desired closed loop value. In your example, you would make the gain=2.
The "e" element has infinite input impedance, zero output impedance, and infinite bandwidth, so it does not modify the response of an active filter like a real op amp (or the universal op amp) does. This isn't always a good thing, but it is sometimes nice to study one thing at a time.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top