Electronic – Unijunction transistor in LTspice

ltspicetransistors

I would like to simulate a simple oscillating circuit involving an unijunction transistor. I do not find such component in LTspice so I figure I need to import one.
Could please show me step by step on how to do it ?
I googled LTspice UJT , and there is this text file:

*Programable Unijunction Transistor pkg: TO-226AA
.SUBCKT X2N6027 1 2 3
************** K1 G K2
Q1 2 4 3 NMOD
Q2 4 2 1 PMOD
.MODEL NMOD NPN(IS=5E-15 VAF=100 IKF=0.005 ISE=1.85E-12 NE=1.45
+ RB=10 RE=0.5 RC=0.5 CJE=3.5E-11 VJE=0.75 CJC=1.1E-11 VJC=0.75 TR=4.76E-8
+ TF=16N VJS=0.75 )
.MODEL PMOD PNP(IS=2E-15 VAF=100 IKF=0.005 ISE=1.9E-12 RB=10 RE=0.5
+ RC=0.5 CJE=3.5E-11 VJE=0.75 TF=1.6E-8 CJC=1.1E-11 VJC=0.75 TR=5.1E-8
+ TF=16N VJS=0.75 )
.ENDS X2N6027

I saved this text file and named it 2N6027.sub . But it didn't show up in component selector. What can I do with this text information ?

Best Answer

You can create a symbol, then link the subcircuit to it via the symbols attribute properties. Save the symbol and subcircuit in the sub and sym folders of your LTSpice installation directory, and you should be able to select it (restart may be required)

I will try it out here and update with more details if necessary (also note that the help files have a section on adding your own components)

Okay, here's a step by step of the process:

  1. Save the file with a .sub extension, e.g. 2N6027.sub and place it in your sub folder in the LTSpice install directory:

    UJT1

  2. a. Create a symbol for the UJT - to make it simpler I opened the NJFET symbol, edited it accordingly and saved it as 2N6027 - I placed in the "Misc" folder, though you can put it in one of the other folders if you like:

    UJT2

    b. Adjust the attributes of the symbol to include a reference to the .sub file. The prefix must be X for a subcircuit, and the model name must be the same as given in the file itself, which is X2N6027:

    UJT3

    c. Make sure the pin numbers in the symbol (right click to see the info) are in the same order as in the file. Leftmost is pin 1, and so on, so right click and alter each pin number if necessary (and name if desired):

    UJT4

  3. Try in it a simple circuit, if it doesn't complain about missing files and seems to work okay, then you're done (note I haven't actually checked whether the component works as it should, you will have to make sure of that. If it doesn't have a look for another model and repeat the above process):

    UJT4

    UJT5