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

Gold Member
2022 Award
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.

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.

The LTspice schematic that I created

On simulating, this is the output I got:

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.

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:".

Gold Member
2022 Award
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):

Which time step is too small?

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.

Gold Member
2022 Award
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.

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
Wrichik Basu
Gold Member
2022 Award
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.

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.

Wrichik Basu