Hooking up transistors in LTSpice

May 27, 2011 154 Replies

Is there a 'pretty' way to make custom transistors in LTSpice? To date I've just made a custom circuit card and hand connected things, leaving a hole in my schematic with the text "here be a transistor".



But that's a little bit crude to be showing off to a customer...


Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html

None of the ones that came with LTSpice fits? You may find some more in the LTSpice Yahoo forum file area.

If you really must design a fancier symbol for the transistor or it's a special one go to -> Help -> Schematic Capture -> Creating New Symbols

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

In partial answer to my own question, I've found where LTSpice keeps its transistor models -- so, can I do a custom one without just appending it to their file?

Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html

You can place a ".model ... " Spice directive in your schematic.

Or you can create .asy and .mod files in the same directory as your .asc file.

Or you can place a Spice directive in your schematic to .include a lib file.

And if it's a whole subcircuit that you want behind a transistor you'll have to assign that transistor the designator X instead of M or Q.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

.INC(LUDE) slows down netlist reading... the whole file is pulled into the netlist.

.LIB(rary) only pulls in the models used

Not in PSpice.

A transistor (with a subcircuit "behind" it) would have as a "template" (for example):

X_Q1 %c %b %e 2N3904

but on the schematic all you would see would be:

[transistor] Q1 [symbol] 2N3904 ...Jim Thompson
| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

I tried that, and LTSpice wouldn't let me assign the transistor number to a package.

I may need to.

Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html

That's another difference I experienced between LTSpice and PSpice. LTSpice ... click the marathon runner symbol... slurrrrrp ... sim runs. PSpice ... click the green arrow ... One Mississippi ... Two Mississippi ... get coffee from kitchen ...

Real men use LTSpice :-)

[...]
Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Not when you need professional looking presentations.

LTspice is faster for things like crystal oscillators, but not noticeably faster otherwise.

But you have been using Crapture, which keeps you in constant danger of losing everything.

(I often draw schematics in PSpice, then simply load the netlist into LTspice.) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

file.

You keep saying that but I did create professional looking presentations with it. Often I just verbatim-copy the plot pane out of it. During a design review in a somewhat darkened room (to accommodate the projector) it actually looks rather cool. At an aerospace client the guys even remarked that they wished they could easily generate such output with their CAD.

Had to. The client wanted it that way and the client is king :-)

PSpice Schematics is incompatible with Capture 16.3, so no choice for me.

I still have to figure out how to do that in Eagle. Since that CAD is highly programmable I should be able to do that. But I am not a code writing specialist and I don't have a son who can do that for me :-)

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Click Help>Help Topics Search Tab Type in Third Party Model Follow Directions

The trick to editing the transistor is CTRL-RIGHT-CLICK

AKA: Doing the same thing over and over, but expecting different results? There's a word for that.

It's easy to think outside the box, when you have a cutting torch.

Ctrl-right-click the transistor and set Value to the model name.

e.g.

Version 4 SHEET 1 880 680 WIRE -176 16 -272 16 WIRE -272 48 -272 16 WIRE -176 48 -176 16 WIRE -336 96 -416 96 WIRE -416 128 -416 96 WIRE -272 192 -272 144 WIRE -272 320 -272 272 FLAG -176 48 0 FLAG -416 128 0 FLAG -272 320 0 SYMBOL npn -336 48 R0 SYMATTR InstName Q1 SYMATTR Value foo SYMBOL current -272 192 R0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR InstName I1 SYMATTR Value 1m TEXT -104 24 Left 0 !.MODEL foo NPN IS=3E-14 NF=1 BF=110 IKF=0.4\n+VAF=1900 ISE=1E-12 NE=1.6 NR=1 BR=7 IKR=0.2 VAR=75\n+ISC=1E-10 NC=1.9 RB=0.4 RE=0.1 RC=0.1 CJC=10.9E-12\n+MJC=0.347 VJC=0.476 CJE=82.6E-12 TF=1.3E-9 TR=2.3E-7 TEXT 4 208 Left 0 !.tran 1u

file.

If we can get a few folks together and put in a few hundred bucks bounty each, we could probably find a FOSS programmer who'd do it. It'd pay for itself pretty fast.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 email: hobbs (atsign) electrooptical (period) net http://electrooptical.net

file.

I don't know Eagle, but from PSpice, you simply merge the netlist into the .CIR file (text editor), then run the .CIR file with LTspice. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

leaving

its

it

file.

Good idea. But let me check first, haven't done it in a while. If I can't find anything I'll post in one of the Eagle NGs.

Not sure what you mean with *.cir, LTSpice calls its files *.asc. But yeah, there should be a fairly easy way to do it. Eagle has tons of scripts, including for software that almost dates back to the Romans. I'll check again if someone has done it in the meantime. The Eagle community is very open in that respect and Cadsoft has provided a special area for sharing scripts and user language programs.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

SCHEMATIC files are *.asc

In LTspice just do File/Open on the .CIR file of interest, then "Run".

Anyone conversant in Spice knows what a .CIR file is ;-)

I doubt you even need a script. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Well, it's been decades since I last type up a SPICE netlist by hand. Back when DOS 3.2 was king.

Just took a look at th LTSpice sim I did yesterday. No *.cir files. Where do they live?

Depends one what's in there. SPICE expects pin numbers to be in a certain order and to adhere to naming conventions.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

I have no idea where Mike hides them, if he uses them at all. I do know that LTspice runs them just fine. And a search finds a bunch of them in the Yahoo zip files... and calls them as type "LTspice netlist file", so installation of LTspice must take that designation (I keep LTspice on a separate machine from PSpice just to avoid such "Open with" conflicts).

You mean Eagle doesn't follow Berkeley traditions ?:-) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

When hooking up transistors in LTSpice, be sure to *not* solder them in.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required