Help with LTSpice: Op-amp astable multivibrator (square wave generator) - Page 1
Forum section: electronics / beginners

author: TimNJ
author_rank: Super Contributor
timestamp: April 06, 2015, 05:46:53 am
content: Hi everyone,I am trying to simulate a square wave generator that uses an op-amp configured as an astable multivibrator, but I cannot get an output and I am struggling to see why not.My current results are attached. It is supposed to be a 1kHz generator. Is LTSpice not capable of this type of simulation?Thanks in advance,Tim

author: Ian.M
author_rank: Super Contributor
timestamp: April 06, 2015, 05:56:46 am
content: Post the .asc spice file so others can check it. You'll need to either rename it to .asc.txt or zip it due to the restricted list of attatchment types accepted here.

author: TimNJ
author_rank: Super Contributor
timestamp: April 06, 2015, 06:03:07 am
content: Thanks. I've attached it.

author: Unknown
author_rank: Unknown
timestamp: April 06, 2015, 06:14:08 am
content: For a start, you've got +V2 going to the positive supply rail of your op-amp - and +V1 going to the negative supply rail. Depending on the particular SPICE version it may ignore the -ve part of your -5v value & take only the absolute value. Best to set V1 to 5v & reverse it....

author: TimNJ
author_rank: Super Contributor
timestamp: April 06, 2015, 06:19:56 am
content: Thanks. I didn't think SPICE cared about that, but I switched the polarity of the source and then made it a positive voltage. Still no output.

author: tec5c
author_rank: Frequent Contributor
timestamp: April 06, 2015, 06:29:20 am
content: What op-amp model are you using? (This shouldn't matter but just to clarify)Another thing, where are you probing? I created your circuit exactly (using the LT1001 model) and I had no problems. See below for results.Hope this helps.Edit: Okay, for some reason the forum isn't allowing me to insert the screen capture. It's now attached.

author: TimNJ
author_rank: Super Contributor
timestamp: April 06, 2015, 06:37:54 am
content: Thanks tec5c,I was using UniversalOpamp2, which I have used for many simulations with no problems. I was probing between the output and ground.I just tried the LT1001 as you did, and surprise surprise...it worked!Wonder what is missing in the UniversalOpamp2 model that makes it not work...Thank you.

author: tec5c
author_rank: Frequent Contributor
timestamp: April 06, 2015, 06:42:33 am
content: Glad you found the problem.I didn't see that you had attached the .asc file to begin with, my mistake. The universal op-amp in LTSpice requires its attributes to be added in. Without looking too much into it, I say there's some specific parameters that need to be added in order for the op-amp to function correctly. Correct me if I'm wrong.

author: TimNJ
author_rank: Super Contributor
timestamp: April 06, 2015, 07:20:20 am
content: Yeah UniversalOpAmp2 seems like it might require some additional configuration. Now, I'm using the LT1001 and it seems all fine and dandy, but when I calculate my values for R1, R2, R3, and C to find the period (T) of the square wave, T winds up being pretty far off from the values I got guessing and checking in LTSpice. If I change the model to a different op-amp, the period (and frequency of course) also gets changed.Why should changing the model affect the frequency of the square wave?Thanks.

author: Refrigerator
author_rank: Super Contributor
timestamp: April 06, 2015, 07:27:26 am
content: Also did you notice how your test goes only up to 10ms while tec5c circuit started up on about 17ms.

author: tec5c
author_rank: Frequent Contributor
timestamp: April 06, 2015, 07:44:59 am
content: Quote from: Refrigerator on April 06, 2015, 07:27:26 amWell spotted, something I missed. Sorry, I did the simulation really quickly.Upon changing the stop time formycircuit to 10ms, there is actually ~20nV increase from 0-10ms. Whereas the universal opamp2, has 0v output for no matter how long you run the simulation.

author: TimNJ
author_rank: Super Contributor
timestamp: April 06, 2015, 07:47:41 am
content: Quote from: Refrigerator on April 06, 2015, 07:27:26 amYes, I noticed that myself after posting that. I changed it to 100ms (which still showed no output).

author: eetech00
author_rank: Regular Contributor
timestamp: April 08, 2015, 02:44:51 am
content: HiSometimes you have to kick start the oscillator by using a "initial condition" statement on the schematic.Notice on the attached schematic I placed a label "N", then used ".IC V(N)=5" to set the initial voltage condition.(hope the graphic looks better on you system, doesn't look very good on mine)eT

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 08, 2015, 03:45:13 am
content: Transient simulations are perfectly noiseless, so after the engine finds the DC operating point, it will perfectly happily sit there forever and ever, even if it is an unstable operating point (as is the case here).You can also set initial condition of the capacitor (setting the node voltage means the same thing*), or use different DC operating point methods in the simulation configuration, e.g., set to zero.*There is a certain advantage to setting the capacitor, even if it may end up being a semantic difference: the capacitor is the only explicit component which stores "state" of the system. That is, the operating frequency is ideally defined only by the capacitor (there are no other time-variable elements), and if you solve the differential equation of a system like this, you must input one other factor, the voltage at t=0, to find a unique solution. Only this voltage matters; all others can be derived from it.The other advantage may be practical; component "models" that include e.g. ESR, ESL, etc. won't set the SPICE capacitor voltage by .NODESET -- because there are nodes inside that you can't see. You then have to enter the initial condition in the model dialog.Tim

author: Marco
author_rank: Super Contributor
timestamp: April 08, 2015, 06:23:20 am
content: You made a metastable nonvibrator.