LTspice is a very popular simulation tool and even used for general schematic capture. But it is a tool that I just can't abide. It is so awkward and so poorly supported, if you are doing anything other than the most basic, simple things it is very hard to use.
Today's problem is trying to use an external model. This is a recurring theme with me. The various instructions on trying to connect a model to a simulation are so arcane and cumbersome, often providing so much background that the issue being discussed is lost.
So I have a .mod file for a ferrite bead. Surprisingly, they use four resistors, three inductors and a capacitor for their model. Ok, that's transparent to me. I always stumble around trying to merge these things with some sort of a .asy file for a symbol, but I was missing some info and couldn't get the model to connect with the generic ferrite bead symbol. This time I found instruction web page that talked about creating a symbol from scratch that automatically was linked to the model, great! The symbol created is a rectangle.
Ok, so let's copy the graphics of the library symbol to this special symbol. No, not supported in the editor. Ok, a web page says to copy the text between the files. Ok, so which text? I see a rectangle command, that needs to go, and a window command... what is that? More web searching reveals nothing. There is not much info on the web about LTspice file formats and adding "window" to the search does NOTHING to reduce the chaff.
So let's just simulate with the rectangle and worry about making it pretty another day. Where is it? It's supposed to be in ...\LTspice\Lib\Sym\AutoGenerated and sure enough, file manager says it's there. But LTspice can't find it. More googling and it seems even though LTspice just created it, it doesn't know enough to see it, so I have to exit the program and restart!
At this point I've spent over an hour trying to do something simple. I think no small part of the issue is that I tend to use LTspice infrequently so the little gems I learn are often lost by the time I use it again. But this is no simple program to use. I am pretty confident that the primary reason it is widely used is because it is free. That and that reason only.
I'm going out to do some yard work...
Yep.
I spent hours trying to add .asy and .sub to LT's program folder and it never found them, then I noticed it has made a copy of all the components in Users/Me/MyDocuments, adding them there it finds them, but I've only got the LM339 to work.
It's awe-inspiring to think of how great LTSpice could be if they'd only open-source it. Imagine if companies like TI, Analog, and .... well, OK, TI and Analog, could compete on delivering the best parts with the most accurate SPICE models, rather than competing on delivering the most annoying proprietary SPICE simulator.
At some point, I have to think that even ADI will come around to that perspective.
I am pretty confident that the primary reason it is widely used is because it is free. That and that reason only.
Don't look a gift horse in the mouth...
Beware of geeks bearing gifts.
Yes, many bits of LTSpice are not so convenient.
In this case of a ferrite bead, what I do is copy and paste the contents of the model file into the schematic (as a spice directive). Then I can CTRL-right-click the generic ferrite bead or whichever component, and set its "value" to be the subcircuit name or model name. For subcircuit models, the prefix must be modified to be X.
EDIT: Another advantage of this is that you can send your .asc files to others, with no need to also send external models & symbols.
Nothing to it.
I keep my self generated LTSpice symbols and models in their own directory. Makes it easier to avoid muddling them up with the native LTSpice ones.
So, how to do it. First off, find somewhere to keep your symbols and models - I keep mine in a directory called, imaginatively, "SpiceLib". I'm running the Windows version of LTSpice under CrossOver on a Mac so my home directory (where SpiceLib lives) appears as drive "Y:" in LTSpice.
Here's the contents of the "SpiceLib" directory:
Tell LTSpice where these files are:
Use the Draft/Component dialogue to place one of them. Note that top line - you MUST select YOUR component library. If you don't you'll just see the standard locations.
You'll have to create your own symbols. These are best done in LTSpice's symbol editor
with some subsequent editing in a text editor. Watch out for pin naming/order both in the symbol and the subcircuit.
Here are the symbol and model files for the TL071. Note the SYMATTR lines that names the library file to find the component in
and the component subcircuit name. You can put multiple components in one '.lib' file if you so choose but each component needs its own ".asy" file.
:-
TL071.asy
Version 4
SymbolType CELL
LINE Normal -32 32 32 64
LINE Normal -32 96 32 64
LINE Normal -32 32 -32 96
LINE Normal -28 48 -20 48
LINE Normal -28 80 -20 80
LINE Normal -24 84 -24 76
LINE Normal 0 32 0 48
LINE Normal 0 96 0 80
LINE Normal 4 44 12 44
LINE Normal 8 40 8 48
LINE Normal 4 84 12 84
WINDOW 0 16 32 Left 2
WINDOW 3 16 96 Left 2
SYMATTR Value TL071
SYMATTR Prefix X
SYMATTR SpiceModel TL071.sub
SYMATTR Value2 TL071
SYMATTR Description JFET Input Operational Amplifier
PIN -32 80 NONE 0
PINATTR PinName In+
PINATTR SpiceOrder 1
PIN -32 48 NONE 0
PINATTR PinName In-
PINATTR SpiceOrder 2
PIN 0 32 NONE 0
PINATTR PinName V+
PINATTR SpiceOrder 3
PIN 0 96 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 4
PIN 32 64 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 5
TL071.sub
* TL071 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT
* CREATED USING PARTS RELEASE 4.01 ON 06/16/89 AT 13:08
* (REV N/A) SUPPLY VOLTAGE: +/-15V
* CONNECTIONS: NON-INVERTING INPUT
* | INVERTING INPUT
* | | POSITIVE POWER SUPPLY
* | | | NEGATIVE POWER SUPPLY
* | | | | OUTPUT
* | | | | |
.SUBCKT TL071 1 2 3 4 5
*
C1 11 12 3.498E-12
C2 6 7 15.00E-12
DC 5 53 DX
DE 54 5 DX
DLP 90 91 DX
DLN 92 90 DX
DP 4 3 DX
EGND 99 0 POLY(2) (3,0) (4,0) 0 .5 .5
FB 7 99 POLY(5) VB VC VE VLP VLN 0 4.715E6 -5E6 5E6 5E6 -5E6
GA 6 0 11 12 282.8E-6
GCM 0 6 10 99 8.942E-9
ISS 3 10 DC 195.0E-6
HLIM 90 0 VLIM 1K
J1 11 2 10 JX
J2 12 1 10 JX
R2 6 9 100.0E3
RD1 4 11 3.536E3
RD2 4 12 3.536E3
RO1 8 5 150
RO2 7 99 150
RP 3 4 2.143E3
RSS 10 99 1.026E6
VB 9 0 DC 0
VC 3 53 DC 2.200
VE 54 4 DC 2.200
VLIM 7 8 DC 0
VLP 91 0 DC 25
VLN 0 92 DC 25
.MODEL DX D(IS=800.0E-18)
.MODEL JX PJF(IS=15.00E-12 BETA=270.1E-6 VTO=-1)
.ENDS
Yes, many bits of LTSpice are not so convenient.
In this case of a ferrite bead, what I do is copy and paste the contents of the model file into the schematic (as a spice directive). Then I can CTRL-right-click the generic ferrite bead or whichever component, and set its "value" to be the subcircuit name or model name. For subcircuit models, the prefix must be modified to be X.
EDIT: Another advantage of this is that you can send your .asc files to others, with no need to also send external models & symbols.
I think I'll try this. Seems like the path of least resistance.
I'm a bit frazzled from any number of things not going well for me the last few days so I want simple. One of the biggies is I am trying to port my phone number from Google fi (bad provider, literally no human support) to ATT only to find that I just missed the deadline. Seems they are cutting off 3G support and my smart phone won't be functional with them in 12 months, so I can't transfer it now. For some reason 3G seems to include ATT 4G as well which my phone supports. You have to have LTE capability to continue to work. Grrrr... I'm taking it out on LTspice.
I am pretty confident that the primary reason it is widely used is because it is free.
I'm very sure that is the reason. The UI of LTspice is archaic at best. A couple of days ago I have given Microcap 12 a try and that seems to be more easy to drive (but I must say I have some experience using the simulation part of Orcad).
So, how to do it. First off, find somewhere to keep your symbols and models - I keep mine in a directory called, imaginatively, "SpiceLib". I'm running the Windows version of LTSpice under CrossOver on a Mac so my home directory (where SpiceLib lives) appears as drive "Y:" in LTSpice.
Tell LTSpice where these files are:
For reasons known only to Mike Engelhardt, the macOS version of LTSpice doesn't have this nifty search path option. You have to embed the library reference directly in the schematic. Piffle.
So, how to do it. First off, find somewhere to keep your symbols and models - I keep mine in a directory called, imaginatively, "SpiceLib". I'm running the Windows version of LTSpice under CrossOver on a Mac so my home directory (where SpiceLib lives) appears as drive "Y:" in LTSpice.
Tell LTSpice where these files are:
For reasons known only to Mike Engelhardt, the macOS version of LTSpice doesn't have this nifty search path option. You have to embed the library reference directly in the schematic. Piffle.
Or any of several other features (like "edit simulation command") which is why I run the PC version under WINE/CrossOver on a Mac. The only thing to be said in defence of the macOS version of LTSpice is that it produces smoother and cleaner looking graphics.
I am pretty confident that the primary reason it is widely used is because it is free.
I'm very sure that is the reason. The UI of LTspice is archaic at best. A couple of days ago I have given Microcap 12 a try and that seems to be more easy to drive (but I must say I have some experience using the simulation part of Orcad).
I used to be pretty bent out about the UI of the schematic editor and waveform viewer, but it doesn't bother me so much now. I actually prefer the editor to KiCAD. The big thing is the whole importing models thing more than anything else. I really dread having to do that because it's always a struggle.
Maybe I need to bite the bullet and take a day or two and do enough research to write my own tutorial. Then it would stick I expect and if it didn't I could return to my notes and gripe about how poorly the author explained everything!
I second pigrew's suggestion. Two big advantages are 1. you can share with other's with just the .asc file (like he said), and 2. when you open your file years later, you'll say, "Oh yeah, that's how you can do it". I've used libraries, but this method is self contained and avoids memory lapse problems.
One thing I find odd with ltspice, is the apparent lack of community contributed ltspice models available on github/gitlab.
I needed and after a lot of searching found a 74hc.lib. This library was created by and accessible to members of a now defunct ltspice yahoo group. But it is quite difficult to find on the open web.
I was wondering if there was some license restriction or other reason that means it should not be posted to github/gitlab? It just seems like a waste, that useful community code is not shared more freely.
One thing I find odd with ltspice, is the apparent lack of community contributed ltspice models available on github/gitlab.
I needed and after a lot of searching found a 74hc.lib. This library was created by and accessible to members of a now defunct ltspice yahoo group. But it is quite difficult to find on the open web.
I was wondering if there was some license restriction or other reason that means it should not be posted to github/gitlab? It just seems like a waste, that useful community code is not shared more freely.
The group is not defunct, just moved to more hospitable hosting. I would have hoped the group owner would have been thoughtful enough to have left a forwarding address on the Yahoo group main page.
https://groups.io/g/LTspice
LTspice is like Photoshop: extremely deep, and extremely hard to learn to drive - but once you're there, it is pure awesomeness!
One thing I find odd with ltspice, is the apparent lack of community contributed ltspice models available on github/gitlab.
I needed and after a lot of searching found a 74hc.lib. This library was created by and accessible to members of a now defunct ltspice yahoo group. But it is quite difficult to find on the open web.
I was wondering if there was some license restriction or other reason that means it should not be posted to github/gitlab? It just seems like a waste, that useful community code is not shared more freely.
The guy who ran the old Yahoo! group is an analog circuit design engineer and my guess is that he either doesn't know about gitlab or github, or doesn't know how/the best way to put the contributed component models and symbols into a repository.
What he was doing with the old group worked well enough, I think.
I am pretty confident that the primary reason it is widely used is because it is free.
I'm very sure that is the reason. The UI of LTspice is archaic at best. A couple of days ago I have given Microcap 12 a try and that seems to be more easy to drive (but I must say I have some experience using the simulation part of Orcad).
I used to be pretty bent out about the UI of the schematic editor and waveform viewer, but it doesn't bother me so much now.
IMHO the way the schematic editor works has been copied / taken from a much older program to draw circuit diagrams. I just can't remember which one after 3 decades.
One thing I find odd with ltspice, is the apparent lack of community contributed ltspice models available on github/gitlab.
I needed and after a lot of searching found a 74hc.lib. This library was created by and accessible to members of a now defunct ltspice yahoo group. But it is quite difficult to find on the open web.
I was wondering if there was some license restriction or other reason that means it should not be posted to github/gitlab? It just seems like a waste, that useful community code is not shared more freely.
The guy who ran the old Yahoo! group is an analog circuit design engineer and my guess is that he either doesn't know about gitlab or github, or doesn't know how/the best way to put the contributed component models and symbols into a repository.
What he was doing with the old group worked well enough, I think.
The real problem with the files at the support forum was quality and organization. It was a bit like touring the junk yard... I mean recycle center. There are all sorts of nuggets, but not so easy to find. Whatever you did find was of uncertain origin or even purpose. There are a number of libraries for the 4000 series CMOS devices each intended for a particular purpose, but with pretty much universally no documentation. So of questionable utility.
Also like a junk yard... I mean recycle center, there is just an overwhelming quantity of files to deal with.
There were actually two losses in that group recently. Analogspiceman and Helmut Sennewald both passed away around a year ago. I recall Helmut was always supportive and helpful. A very good egg. A lot like the folks here.