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

In summary, the conversation discusses the simulation of an op-amp integrator circuit used to generate a triangular wave from a square wave. The conversation includes discussions on using LTspice and a LM741 op-amp model, troubleshooting the simulation and finding a solution, and the need for a DC feedback path in real-world applications.
  • #1
Wrichik Basu
Science Advisor
Insights Author
Gold Member
2,116
2,691
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.
 
Engineering news on Phys.org
  • #2
Wrichik Basu said:
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
Baluncore said:
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
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
Baluncore said:
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
Remove the .txt extension and try these LTspice .asc and .plt files.
 

Attachments

  • OA_Int_1.plt.txt
    281 bytes · Views: 200
  • OA_Int_1.asc.txt
    1.3 KB · Views: 206
  • Love
Likes Wrichik Basu
  • #7
Baluncore said:
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
Wrichik Basu said:
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
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
Tom.G said:
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.
 

1. Why is my output voltage not changing with time in the integrator circuit?

There could be a few reasons for this issue. First, check if you have properly connected the input and feedback resistors. Also, make sure that the input signal is within the linear range of the op-amp. Additionally, check if the op-amp is powered correctly and that the simulation time is long enough for the output to reach a steady state.

2. Why is my output voltage saturating at the power supply rails?

This could be due to a few reasons. First, check if the input signal is within the linear range of the op-amp. If the input signal is too large, it can cause the output to saturate. Additionally, check if the power supply voltages are set correctly and if the op-amp is capable of handling the desired input signal amplitude.

3. Why is my output voltage showing a high frequency noise?

This could be due to incorrect grounding in the circuit. Make sure that all the components are properly connected to the ground node. Additionally, check if the op-amp model you are using includes noise sources. If so, you can try changing the model or adding a noise filter to the circuit.

4. Why is my output voltage not matching the theoretical calculations?

There could be a few reasons for this discrepancy. First, check if you have used the correct values for the resistors and capacitors in your circuit. Additionally, make sure that the op-amp model you are using accurately represents the real-world behavior of the op-amp. Finally, check if any non-ideal effects, such as input offset voltage or input bias current, are affecting the output.

5. Why is my simulation showing unrealistic results, such as negative output voltage in an integrator circuit?

This could be due to incorrect component values or incorrect op-amp model. Check if you have used the correct values for the resistors and capacitors in your circuit. Additionally, make sure that the op-amp model you are using accurately represents the real-world behavior of the op-amp. If the problem persists, try using a different op-amp model or adjusting the simulation settings.

Similar threads

  • Electrical Engineering
Replies
3
Views
801
Replies
7
Views
1K
  • Electrical Engineering
Replies
6
Views
1K
  • Electrical Engineering
Replies
6
Views
1K
  • Electrical Engineering
Replies
9
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
34
Views
2K
Replies
14
Views
2K
  • Electrical Engineering
Replies
24
Views
6K
  • Electrical Engineering
Replies
6
Views
1K
  • Electrical Engineering
Replies
4
Views
2K
Back
Top