LTSpice Help

I am new to Spice as well as LT Spice.

I have input most of my circuit after spending much time looking for components. I have not run the circuit yet since I have a hole where a unijunction goes.

The circuit additionally uses a triac, scr and transistor.

I found the

*Programable Unijunction Transistor pkg: TO-226AA .SUBCKT X2N6027 1 2 3

for a "generic" (to me) unijunction.

But I have no clue how to make a symbol and connect to the .SUBCKT. Why? Because I do not know the terminology. The .SUBCKT webpage came with instructions to create the "component" but I cannot follow it. Is there a different tool to use?

Hopefully if I get steered in the right direction I can incorporate the unijunction.

I am using a 2N2647 unijunction.

*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

TIA

--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---

Reply to
OldGuy
Loading thread data ...

Please tell me you posted this question to the LTspice 'user's group'

First, models come in from EVERYWHERE, and second, Helmut, the 'moderator', will walk you through creating stuff you need step by step.

Even post your 'attempt' in the temp folder and people will jump in with modifications to your circuit. Thus give you an immediate solution to your simulation and you can learn 'by example'

Reply to
RobertMacy

Here's the pertinent section from an LTspice tutorial...

LTspice symbol creation is rather crude, pretty much the same as the schematic capture user interface :-(

It would be handy if Engelhardt made LTspice import PSpice symbols. It is trivial to make custom symbols in PSpice.

As for a Unijunction model, I haven't been able to find an accurate one. (Yours, above, is just a crude 2-transistor attempt.)

If someone can provide me with a good data sheet, showing good curves of the negative impedance region, I'll try my hand at making a good model. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   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.
Reply to
Jim Thompson

OK so there is a forum. Where? Look I go to forums and find that most are places where people like to chit chat about irrelevant stuff. So I tend not to sign up at forums so I do not get swamped with junk mail or have to listen to the people noise. Not saying that the LTSpice forum is like that but I avoid if I can. So if it is a great forum, how do I link there? (also want to avoid bogus clone forums) Hope you understand.

I have a disconnect. (Yes, I am sure the spice model is very simple and may not work properly but it is all about creating a symbol and placing it into the main schematic. I, with help, can tune it later.

It may be that I am placing stuff in the wrong folders or not properly linking "picture" to spice.

So far I have done this: created a "sketch" of the circuit. called it 2N2647.ASY put it in the SYM folder

Version 4 SymbolType BLOCK LINE Normal -32 33 -32 -32 LINE Normal 0 -16 0 -63 LINE Normal -32 -16 0 -16 LINE Normal 0 16 0 64 LINE Normal -32 16 0 16 LINE Normal -63 0 -80 0 LINE Normal -32 16 -63 0 LINE Normal -39 6 -32 16 LINE Normal -44 16 -39 6 LINE Normal -32 16 -44 16 PIN -80 0 BOTTOM 8 PINATTR PinName G PINATTR SpiceOrder 1 PIN 0 -64 RIGHT 8 PINATTR PinName K1 PINATTR SpiceOrder 2 PIN 0 64 RIGHT 8 PINATTR PinName K2 PINATTR SpiceOrder 3

created a spice model using the code previously shown called it 2N2647.SUB put it in the SUB folder

*Programable Unijunction Transistor pkg: TO-226AA .SUBCKT X2N2647 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 X2N2647

I placed the "picture" on the main schematic. opened the Component attribute editor changed the following InstName 2N2647 SpiceModel 2N2647.sub

Trying to run I get --------------------------- LTspice IV

--------------------------- Missing schematic(s) of the hierarchy:

2n2647

--------------------------- OK

---------------------------

followed by

--------------------------- LTspice IV

--------------------------- Trouble Generating netlist for SPICE run

--------------------------- OK

---------------------------

--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---

Reply to
OldGuy

Found this, from DuncanAmps. His models are usually pretty good...

** From *** ** ** *Default N-Channel Unijunction Transistor .SUBCKT XUJT 1 2 3 DE 1 4 EMITTER VE 4 5 DC 0 HVE 6 0 VE 1K RVE 0 6 1MEG BBB 5 7 I=0.00028*V(5,7)+0.00575*V(5,7)*V(6) CBB 5 7 35P RB1 7 2 38.15 RMOD RB2 3 5 2.518K RMOD .MODEL RMOD R TC1=.01 .MODEL EMITTER D (IS=21.3P N=1.8) .ENDS XUJT

  • Motorola IP=.5U IV=6M VB1(sat)=3 Rbb=6.1K Vob1=3.6: E, B1, B2 .SUBCKT X2N2646 1 2 3 DE 1 4 EMITTER VE 4 5 DC 0 HVE 6 0 VE 1K RVE 0 6 1MEG BBB 5 7 I=0.00028*V(5,7)+0.00575*V(5,7)*V(6) CBB 5 7 35P RB1 7 2 38.15 RMOD RB2 3 5 2.518K RMOD .MODEL RMOD R TC1=.01 .MODEL EMITTER D (IS=21.3P N=1.8) .ENDS X2N2646

...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   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.
Reply to
Jim Thompson

I'm not at all expert in using LTspice, I use it only to run posted designs, or simply draw in PSpice, then import the resulting .CIR file into LTspice and run.

I noted something in the tutorial I posted about needing a .INCLUDE to provide the symbol with a model to use. In PSpice that would be simply a .LIB statement.

...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   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.
Reply to
Jim Thompson

Found it!

General subcircuit declaration (it's behavioral)...

.subckt gen_ujt b2 e b1

  • params:
  • Iv20=6m Ib2m=6m Veb1s=2.5 Ieb20=1u
  • rbb=6.9k eta=.775 Vv=1.33 Vk=10 Ies=50m vf=.7 Kd=1.5e-6 cgtsr=.1
  • x1 b2 e b1 gen_ujtm params:
  • ries={(veb1s-vf)/(ies+ib2m)}
  • rlbv={(Vv-Vf)/(Iv20/1.4+vk/rbb+((Ib2m-vk/rbb)/Ies)*(iv20/1.4))}
  • kd ={kd}
  • Iv20 ={Iv20}
  • rbb ={rbb}
  • Ieb20={Ieb20}
  • eta ={eta}
  • veb1s={veb1s}
  • Ies ={ies}
  • Ib2m ={ib2m}
  • Cgtsr={cgtsr} .ends

A specific device (I haven't found parameters for 2N6027)...

.subckt 2N2646 B2 E B1

  • x1 b2 e b1 gen_ujt
  • params:
;Vob=5
  • eta = .655
  • rbb = 7k
  • Veb1s = 3.5
  • Ib2m = 15m
  • Ieb20 = .005u
  • Iv20 = 6m
  • Vv = 1.77
  • kd = 1.1u
  • cgtsr = .001 .ends ...Jim Thompson
--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   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.
Reply to
Jim Thompson

NEGATORY! I didn't read carefully enough... the subcircuit seems to use circular references. I'll go back and see if I can sort it out.

...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   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.
Reply to
Jim Thompson

Nested subcircuits :-( First uses the next, uses the next...

Makes no sense, but it runs in PSpice. Dead-end reference to subckt "yx" (see below).

Unnecessarily complex. The earmarks of a PhD creating it >:-}

*$ .subckt 2N2646 B2 E B1
  • x1 b2 e b1 gen_ujt
  • params: ;Vob=5
  • eta = .655
  • rbb = 7k
  • Veb1s = 3.5
  • Ib2m = 15m
  • Ieb20 = .005u
  • Iv20 = 6m
  • Vv = 1.77
  • kd = 1.1u
  • cgtsr = .001 .ends
*$ .subckt gen_ujt b2 e b1
  • params:
  • Iv20=6m Ib2m=6m Veb1s=2.5 Ieb20=1u
  • rbb=6.9k eta=.775 Vv=1.33 Vk=10 Ies=50m vf=.7 Kd=1.5e-6 cgtsr=.1
  • x1 b2 e b1 gen_ujt
m params:
  • ries={(veb1s-vf)/(ies+ib2m)}
  • rlbv={(Vv-Vf)/(Iv20/1.4+vk/rbb+((Ib2m-vk/rbb)/Ies)*(iv20/1.4))}
  • kd ={kd}
  • Iv20 ={Iv20}
  • rbb ={rbb}
  • Ieb20={Ieb20}
  • eta ={eta}
  • veb1s={veb1s}
  • Ies ={ies}
  • Ib2m ={ib2m}
  • Cgtsr={cgtsr} .ends
*$ .subckt gen_ujtm b2 e b1
  • params:
  • Iv20=6m Ib2m=6m Veb1s=2.5 Ieb20=1u
  • rbb=6.9k eta=.775 Vv=1.33 Vk=10 Ies=50m vf=.7 Kd=1.5e-6 cgtsr=.1
  • ries=1k rlbv=2k
  • x1 b2 e b1 gen_ujt
m1 params:
  • logrs={log(rlbv/ries)}
  • kimod={((1-eta)*rbb-(vk-veb1s-vf)/ib2m)/Ies}
  • kd ={kd}
  • Iv20 ={Iv20}
  • rbb ={rbb}
  • Ieb20={Ieb20}
  • eta ={eta}
  • veb1s={veb1s}
  • Ies ={ies}
  • Ib2m ={ib2m}
  • Cgtsr={cgtsr} .ends
*$ .subckt gen_ujtm1 b2 e b1
  • params:
  • Iv20=6m Ib2m=6m Veb1s=2.5 Ieb20=1u
  • rbb=6.9k eta=.775 Vv=1.33 Vk=10 Ies=50m vf=.7 Kd=1.5e-6 cgtsr=.1
  • logrs=1 kimod=1
  • x1 b2 e b1 gen_ujt
l params:
  • n={logrs/log(ies*1.4/Iv20)}
  • kimod={kimod}
  • Ie1 ={Ies/pwr(eta*rbb/((veb1s-vf)/(Ies+Ib2m)),1/(logrs/log(ies*1.4/Iv20)))}
  • kd ={kd}
  • Iv20 ={Iv20}
  • rbb ={rbb}
  • Ieb20={Ieb20}
  • eta ={eta}
  • Cgtsr={cgtsr} .ends
*$ .subckt gen_ujtl b2 e b1
  • params:
  • n =.5
  • kimod=.001
  • Ie1 =1u
  • Kd =1.5u
  • Iv20 =6m
  • rbb =7k
  • Ieb20=1u
  • eta =.77
  • cgtsr=.05
  • isval=1.281e-10 cx=1n
  • a=8.66e-4 b=51 Vk=10.0 Vf=.7 Ies=50m Vrev=30
  • dje e1 x dio .model dio D(Is={isval} Rs=1) vmon e e1 dc 0.0 Ec1 ca 0 value={kd*(isval+abs(v(mon)))+cx} v0c x1 x 0 xc1 ca 0 cc e x1 yx
Reply to
Jim Thompson

Open the subckt file in LTspice. Left click on the "subckt" line. A symbol is automatically generated, and the symbol editor opens. You can then edit the symbol as much as you like. Saving the symbol creates a new symbol category, "Auto Generated", if it doesn't already exist.

No need for an .include, or .lib statement. The file name is automatically inserted into the symbol "model file" attribute.

--
"Design is the reverse of analysis" 
                   (R.D. Middlebrook)
Reply to
Fred Abse

That should be right click.

--
"Design is the reverse of analysis" 
                   (R.D. Middlebrook)
Reply to
Fred Abse

"Right" click on the subckt line ;-)

Great! I didn't know that. It even inserts the library call (along with PATH) I was puzzling over... netlist (nothing connected)...

XU1 NC_01 NC_02 NC_03 NC_04 MyLM339 .lib C:\PSpice\SymbolLib\mylib.lib

Much easier than starting from drawing in the symbol editor... you get all the basics automatically!

I like that. The symbol drawing was the main thing limiting my fast response time to "cute" circuits >:-} ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   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.
Reply to
Jim Thompson

I posted a correction right after. Maybe it didn't propagate fast enough.

--
"Design is the reverse of analysis" 
                   (R.D. Middlebrook)
Reply to
Fred Abse

I went off, tried it, posted. Then when I retrieved headers, I saw your correction. ...Jim Thompson

-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Reply to
Jim Thompson

Any tricks to bolden the grid? PSpice, the grid shows nicely (because, in the INI file, you can set the pixel size); LTspice, barely visible. ...Jim Thompson

-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Reply to
Jim Thompson

AND YOU CAME HERE !?!?!

Boy, are you going to have a rude awakening !

Go ahead Jim, show him.

hamilton

Reply to
hamilton

LTspice supports both .include, and .lib.

You can actually .include a URL, (provided it's a valid library file), and LTspice will import it, stick it in /lib/sub, and use it.

There's .ferret, too, that gets libraries off the 'net.

Never tried either, but they're in the manual.

--
"Design is the reverse of analysis" 
                   (R.D. Middlebrook)
Reply to
Fred Abse

Not that I've ever found.

--
"Design is the reverse of analysis" 
                   (R.D. Middlebrook)
Reply to
Fred Abse

Take a look at

formatting link

It's a tutorial that shows step-by-step how to integrate the 2N6027 into LTSpice.

--
Don Kuenz
Reply to
Don Kuenz

Did you try stepping through that? I cannot follow it.

--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---

Reply to
OldGuy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.