What's wrong in my LTspice simulation of an Op-Amp integrator circuit?

  • #1
Wrichik Basu
Insights Author
Gold Member
2022 Award
2,021
2,153
I am doing an online course on op-amps. The specific video I am talking about is this one (skip to 24:25). Here, the professor has derived the expression of the op-amp integrator circuit, and in the next slide, he tells that we can create a triangular wave from a square wave using this integrator circuit. He showed us the circuit below, and said that if we simulate using those particular values of resistance and capacitance, we will get the graph as shown on the right.

1622982370945.png

A snapshot from the video

I don't have a function generator at home, so I cannot do this experiment, and hence decided to simulate it with LTspice. I downloaded the Pspice model of LM741 op-amp from the https://www.ti.com/product/LM741/%E2%80%94#design-development##design-tools-simulation, included it in the schematic, and created the circuit shown below. Here, of course, we ignore the input bias currents and the offset voltage.

1622981573688.png

The LTspice schematic that I created

On simulating, this is the output I got:

Op-amp_Integrator.png

Output of simulation. Green line is the output of the pulse generator V3,
and the blue line is the output of the Op-Amp, labelled Vout.

As you can see, the square wave almost matches what the Prof. had shown. But the output does not match: in the Prof's slide, the output wave is oscillating about 0, while in my case, it is oscillating about 5V.

Can anyone point out the mistake in my simulation?

A zip file containing the .asc file of the schematic and the model of the Op-Amp can be downloaded from here. Please remember to change the Spice directive to the location of the LM741.MOD file in your computer in case you want to carry out the simulation yourself.
 

Answers and Replies

  • #2
Baluncore
Science Advisor
12,045
6,160
Can anyone point out the mistake in my simulation?
The constant of integration is in the history, or how the simulation started.
You must set the initial conditions with; .IC V(out)=0 and .tran 10m uic

Select "uic" in the .tran command by ticking the "Skip Initial operating point solution:" box.
You do not need "startup" so untick "Start external DC supply voltages at 0V:".
 
  • #3
Wrichik Basu
Insights Author
Gold Member
2022 Award
2,021
2,153
The constant of integration is in the history, or how the simulation started.
You must set the initial conditions with; .IC V(out)=0 and .tran 10m uic

Select "uic" in the .tran command by ticking the "Skip Initial operating point solution:" box.
You do not need "startup" so untick "Start external DC supply voltages at 0V:".
Okay, so the current directives are .tran 10m uic and .ic V(Vout)=0. But I am getting this (and the graph is a disaster):

1622999402670.png

Which time step is too small?
 
  • #4
Baluncore
Science Advisor
12,045
6,160
The internal simulation step time is selected to give stable results. Maybe there was oscillation somewhere. I expect it is due to a problem with the stability of the 741 op-amp model.
Replace your 741 with a standard OP07 or similar to partition the problem.
Lower your power supplies to something safer, like ±12 V.
Check your grounds are in place.
 
  • #5
Wrichik Basu
Insights Author
Gold Member
2022 Award
2,021
2,153
The internal simulation step time is selected to give stable results. Maybe there was oscillation somewhere. I expect it is due to a problem with the stability of the 741 op-amp model.
Replace your 741 with a standard OP07 or similar to partition the problem.
Lower your power supplies to something safer, like ±12 V.
Check your grounds are in place.
Changing power supply to ±12 V didn't work. Using OP07 causes the simulation to take a long time. It took 1 minute to compute 50μs. After that, I stopped the execution.
 
  • #6
Baluncore
Science Advisor
12,045
6,160
Remove the .txt extension and try these LTspice .asc and .plt files.
 

Attachments

  • OA_Int_1.plt.txt
    281 bytes · Views: 114
  • OA_Int_1.asc.txt
    1.3 KB · Views: 111
  • Love
Likes Wrichik Basu
  • #7
Wrichik Basu
Insights Author
Gold Member
2022 Award
2,021
2,153
Remove the .txt extension and try these LTspice .asc and .plt files.
Thanks a lot, that works. The only difference between your and my circuits is that I kept the old LM741 disconnected instead of removing it completely. Once I removed that one completely, my schematic started working too.
 
  • #8
Baluncore
Science Advisor
12,045
6,160
The only difference between your and my circuits is that I kept the old LM741 disconnected instead of removing it completely.
If LTspice had known it would have complained about the lack of ground on the model. It was probably fooled by internal current sources and sinks that referenced ground within the model. Those would be very high impedance which means that voltages on the internal nodes would be all over the place, making simulation very slow and indeterminate. When a component is disconnected, but remains in the simulation, drop ground symbols on all external connections to speed the simulation.
 
  • Like
Likes Wrichik Basu
  • #9
Tom.G
Science Advisor
Gold Member
4,688
3,439
Be aware that in the 'Real World' you will need a DC feedback path from the OP-AMP output to its '-' input, in parallel with the capacitor.

This is because the OP-AMP is not ideal and has a small amount of offset, resulting in some output voltage even when the inputs are identical. The end result is there is a small ramp voltage at the output whose slope (time constant) depends on the effective input offset voltage (6mV for the 741), circuit input impedance, and the capacitor value.

Cheers,
Tom
 
  • Like
Likes Wrichik Basu and DaveE
  • #10
Wrichik Basu
Insights Author
Gold Member
2022 Award
2,021
2,153
Be aware that in the 'Real World' you will need a DC feedback path from the OP-AMP output to its '-' input, in parallel with the capacitor.
Yes, I know that. In fact, the Prof. also covered this in his subsequent lectures. Without that DC path, the op-amp would saturate.
 

Suggested for: What's wrong in my LTspice simulation of an Op-Amp integrator circuit?

Replies
6
Views
1K
Replies
3
Views
450
  • Last Post
Replies
26
Views
1K
Replies
11
Views
677
Replies
15
Views
2K
Replies
13
Views
728
  • Last Post
Replies
4
Views
427
Replies
9
Views
2K
Replies
6
Views
765
Top