EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: jj5 on May 13, 2024, 12:09:22 am

Title: Help with modeling multivibrators in LTspice
Post by: jj5 on May 13, 2024, 12:09:22 am
Hi there. I wonder if someone can help me, I am quite lost.

What I am trying to do is model a system of two multivibrators in LTspice. On the output I am expecting to see an audio frequency driving a piezoelectric buzzer, but the simulation just seems to show a constant voltage of 9V.

I wonder, can anyone explain what is wrong with my model? Following is a screenshot and the LTspice file is available here (https://www.jj5.net/file/2024-05-13-100221/Maxitronix-20in1-09-2.asc).

(https://www.jj5.net/file/2024-05-13-100221/Screenshot_20240513_100147.png)
Title: Re: Help with modeling multivibrators in LTspice
Post by: ledtester on May 13, 2024, 02:07:19 am
I first just tried getting the two-transistor astable multivibrator to work in ltspice and here's what I had to do:

1. Use a real transistor model (e.g. 2n2222) instead of the generic one
2. Specify an initial condition on one of the caps
3. Add the "uic" option to the transient analysis directive.

#2 disrupts the symmetry in the circuit so that it will start to oscillate.

To set the initial voltage on a cap see this post:

https://www.eevblog.com/forum/beginners/ltspice-what-does-ic-v(c1)10-actually-do/msg5497798/#msg5497798 (https://www.eevblog.com/forum/beginners/ltspice-what-does-ic-v(c1)10-actually-do/msg5497798/#msg5497798)

or you can set the initial voltage of a node on one side of the cap using the .IC V(...)=... directive.

Another way to disrupt the symmetry is to make one of the cap values slightly different from the other.

Note that the .asc file attached below is flawed in that it attempts to set the initial cap voltage using .IC V(C1)=... which seems to be quietly ignored by ltspice.

... and the LTspice file is available here (https://www.jj5.net/file/2024-05-13-100221/Maxitronix-20in1-09-2.asc).

It's better to upload the asc file as part of your post.
Title: Re: Help with modeling multivibrators in LTspice
Post by: MathWizard on May 13, 2024, 02:21:59 am
I'll usually start the external sources at 0, if some circuit won't osc, but I'll have to remember to try setting some cap voltage or inductor current, if that doesn't work.
Title: Re: Help with modeling multivibrators in LTspice
Post by: jj5 on May 13, 2024, 03:22:56 am
I got it working! Thanks! :D

This is the first time I have successfully conducted a non-trivial SPICE simulation, so for me this is milestone.

I have attached a screenshot and my .asc file.

Thanks again!
Title: Re: Help with modeling multivibrators in LTspice
Post by: ledtester on May 13, 2024, 11:54:24 pm
As for what you should use for the .IC directive, you might want to following along these discussions:

https://www.eevblog.com/forum/beginners/having-trouble-simulating-two-multivibrators-in-ltspice/ (https://www.eevblog.com/forum/beginners/having-trouble-simulating-two-multivibrators-in-ltspice/)

https://www.eevblog.com/forum/beginners/ltspice-what-does-ic-v(c1)10-actually-do/ (https://www.eevblog.com/forum/beginners/ltspice-what-does-ic-v(c1)10-actually-do/)
Title: Re: Help with modeling multivibrators in LTspice
Post by: jj5 on May 14, 2024, 03:26:39 am
Excellent. Thanks again! For the record I made a video about this over here:

https://www.youtube.com/watch?v=h64N0l887Ps (https://www.youtube.com/watch?v=h64N0l887Ps)