Quick question about LTSpice

Discussion in 'General Electronics Chat' started by jean28, Jan 30, 2013.

  1. jean28

    Thread Starter Member

    Sep 5, 2012
    76
    0
    Hey guys quick question about LTSpice. How do I change the characteristics of an NPN 2N2222 transistor in LTSpice?

    I tried right clicking it and then selecting "pick new transistor" but I can only choose different transistors and none of them have the characteristics that I want.

    Is this possible in LTSpice or should I try another simulator like Multisim?

    Thanks.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    Each of the model files is an ordinary text file so you can modify them if you want to. You can also import models from various manufacturers and add those models to the standard library. The help files and the yahoo group can guide you through the process.
     
  3. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    Alternatively, you can use the .model directive for a single transistor instance, though I don't recommend it. This allows you to change the parameters for a single transistor. Use the .model for each transistor you need to change. Otherwise, either import the model for your transistor or create a new transistor model with the parameters of your particular transistor. If you need more help, I'll need to get to my computer at home on which I run LTSpice.
     
  4. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    1. Place an NPN on the schematic.
    2. Right-click on the symbol, then select Pick New Transistor
    3. When the list of transistors opens, highlight the entire line for 2N2222 by left-clicking on it..
    3. Copy it to the clipboard with ctrl-c.
    4. Cancel the models window, then cancel the Pick New Transistor window.
    5. Click on the .op icon on the tool bar, and paste the model you just copied into it (ctrl-v).
    6. Edit the name of the model (I used my2N2222) and the parameter you want to change the value of (I changed Bf to {beta}), then click OK.
    7. Place the new model on the schematic.
    8. Edit the name of the NPN (right click on NPN) to match the name of the model you just created.

    If I described all that correctly, you're ready to go.:D
    Open the attached .asc file to see what I did.
     
    Last edited: Jan 30, 2013
    JetBlue, tubeguy, W4GNS and 2 others like this.
  5. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    Does that mean BF is now a parameter?
     
  6. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Yes indeed. You can change it with a .param or .step param directive.
    Of course, you could just edit the numerical value of a parameter in the .model statement.
     
    Brownout likes this.
  7. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    I think each model of a transistor should have minimum and maximum specs in addition to "typical" specs. Then when you do not know how to design a circuit properly the SIM program will show you that your circuit will work only sometimes.

    SIM programs are a crutch. "Look boss, the Sim says my designed circuit works". But it doesn't say that it works only 'sometimes'.
     
  8. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    A simulator CAN be a useful tool.
    Suppose I want to know the sensitivity to beta of a simple collector-feedback bias circuit. I can do the math, and it's pretty simple, admittedly. Still, I like pictures, plus, the simulator may be faster, in many cases, than doing the math. A graph makes some things clearer for me than a table of numbers. OK, for this example, probably all I need is the minimum beta calculation, but it still makes the point. I vary the beta, I see what happens to the collector voltage. The simulator did the math for me. It's the same math you would have done by hand with a couple of values of beta, but it also takes into account other parameters that I'll bet you would ignore, like beta change vs Vce and Ic and change in Vbe vs Ib (try doing that by hand). Yeah, I know, those are second order effects, but my point is, the simulator does the math. Sure, the ultimate test is a breadboard, but I like to design circuits and play with them. Very few get as far as breadboards. The ones that do have a lot of potential subtle bugs already worked out of them, thanks to the simulator.
    PS very few of the circuits I design are audio-related. Most of them contain a lot of (intentionally) nonlinear circuits. You and I are from very different backgrounds.

    OK, I'm off my soap box.
     
  9. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    Calculators are a crutch also. Do you not use them? :rolleyes:

    Simulators are a very good tool to help verify a proper design. You can readily use worst-case values for resistor, capacitor values, and transistor gains to see the effect they have on the circuit operation. Some Spice programs have Monte Carlo programs to vary all the parameters at random to see the overall effect on circuit operation.

    You can breadboard your circuit and say "See, it works." but that's also not proof that it doesn't just work "sometimes" since your breadboard doesn't contain worst-case components.
     
    Brownout likes this.
  10. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    Teachers are not teaching anything today.
    Most kids use only "typical" models in a SIM and think that it will work with ANY transistor with the same part number.
     
  11. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    If "most kids" do that it's the fault of the teacher not the tool. You don't blame the tool for its misuse.
     
  12. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    Kids do not understand about the hFE of a transistor which is a minimum of 100 and a maximum of 300 for a 2N3904 transistor for example. They wrongly think the hFE will change from 100 to 300 while the transistor is operating. They do not know that each transistor is different, even if many have the same part number. They do not know that some weaker transistors will have an hFE of 100 and some stronger transistors will have an hFE of 300 and others will be in between.

    The kids need to learn how we design a circuit so it works perfectly with any transistor even if the hFE is 100 , 200 or 300 for the part number 2N3904 for example.
     
  13. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Should SPICE models have optional fields for ranges to test on each component? That would slow down analysis by huge amounts once more than a few components with variable parameters needed to be taken into account. I'm referring to the standard library components, rather than modifying each one to step through ranges in sim.

    It would be nice to have a circuit perform exactly as in the simulator, but people new would probably be more confused by that than helped.
     
  14. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    Any analysis method involves compromises. No one is ever perfect, as pointed out by some very insightful people on this very thread. It's important to remember that simulators are only tools, they can be useful or un-useful.

    The old guys are just pissed-off because they didn't have simulation softare :)
     
  15. tubeguy

    Well-Known Member

    Nov 3, 2012
    1,157
    197
    Or great forums like this !!
     
  16. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    Possibly true. Some that had to do it the hard way, think everyone should still do that. I would have given an eye tooth to have even an HP-35 when I was in college but the best available was a slide-rule (which cost at least a couple hundred US bucks in today's dollars). But I'm certainly glad I had computers available for simulation, word processing, etc. later on. It eliminated much of the design drudgery and made my work immensely easier as compared to the first years.
     
    Ron H likes this.
  17. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    My sentiments exactly.:)
    Technology would not be where it is today without simulators.
     
  18. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    True. But the only reasonable way to determine how the circuit likely operates with the parts at their tolerance limit is with simulation. It's not really practical to cull actual parts to find those at their limits for breadboard testing.
     
  19. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Back to the original question in post #1, I found a wiki containing undocumented LTspice features.
    For another way of running sims on transistors with modified parameters, see AKO Aliases.
    There are lots of useful tips in this wiki. I think the ability to simulate a circuit with various transistor part numbers could be useful. See Stepping a Model.
     
Loading...