Some LTspice Dirty Secrets

I've avoided some topics to get you up and running quickly. But let's quickly review some “dirty secrets” before we get into the more advanced uses of LTspice.

SPICE Values

I've avoided talking about “multipliers” and “units” so far because I knew you were in a hurry (let's be honest). But you should know how SPICE handles component values before we go much further.

Implied Units

Wherever a value is required, there are implied units involved. For example the units for resistance is always ohms. For capacitors the units are Farads and for batteries they are Volts. You can probably think of some more. If you want to specify a value in these units, only a number is required. For example, a resistor of 47 ohms can be specified with the simple value “47”.

Unit Multipliers

For your convenience SPICE recognizes certain textual unit multiplier designations after a number. For example, you've already defined a resistor has having the resistance of 20k (ohms). So SPICE recognizes that the “k” following a number, multiplies it's value by 1000. K or k both mean the same- there is no distinction between upper or lower case.

Unit Names

You must be careful to make a distinction between:

  • unit multiplier names, like “k” for kilo
  • and the unit names themselves (like ohms)

Value Specification

For your convenience, SPICE also permits you to specify the electronic unit names after the optional unit multiplier. Here are some examples:

  • 20kohms (20k)
  • 4.7uF (4.7u)
  • 63mV (63m)
  • 14giggleKnorfs (14g)
  • 73.5knocks (73.5k)

The brackets above show the values actually used by SPICE. The unit names like ohms that follow - F (farads) or “V” (volts) are totally ignored by SPICE. In fact you could define a resistor as having 20kVolts and SPICE won't mind. It won't make much sense to your reader but SPICE only cares about the “20k” in that example. For a resistor, SPICE already knows the units are ohms.

The 2nd last example of “14giggleKnorfs” highlights the fact that SPICE will ignore text after the number it doesn't understand. So if the text does not match a known unit multiplier designation like “k” or “meg”, then it is silently ignored. But note that it does know “g” as a multiplier, so it will use that and ignore “iggleKnorfs”.

The very last example shows that SPICE would use the “k” in “knocks”, so be careful.

General Format

The general SPICE format for a value is this:

<number> <multiplier> <units>

Only the <number> and the <multiplier> if used, is involved in defining a component value. The units are implied by the type of value needed for the component (ohms, farads, volts or amps etc.).

SPICE Unit Multipliers

Here are the unit multipliers you should use:

Multiplier Name Power
k kilo x103
meg mega x106
g giga x109
t terra x1012
m milli x10-3
u micro x10-6
n nano x10-9
p pico x10-12
f femto x10-15

The multiplier that gives everyone trouble is the m (milli) vs the meg (mega). Capital M is still a “milli” unit designation! So beware. You must specify “meg” or “MEG” or “Meg” if you mean mega. If you are troubleshooting your circuit, look for this mistake!

The Netlist

Another dirty little secret is the “Netlist”. In the beginning, there was no schematic capture for SPICE simulations. In fact many still do not support schematic capture. Fortunately LTspice does. Using your Simple2 schematic, select menu “View” and then select “SPICE Netlist”. A window will open showing you text like this:

* C:\Program Files\LTspiceIV\Simple2.asc
V1 N001 0 9V
R1 N001 N002 100k
C1 N002 0 47uF
.tran 0 32 0 .001 uic

This shows you the “Netlist” that LTspice is using behind the scenes to feed to the SPICE simulation engine. This engine doesn't work with schematics but rather a netlist that describes the components and their connections.

Lines starting with an asterisk are comments and are ignored. Lines starting with a dot are SPICE directives (commands). The remaining lines describe parts and wiring. Connections are known as “nodes”. Nodes can have names like “N002” meaning node 2. The node “0” is special and indicates the ground node. The line describing the battery looks like this:

V1 N001 0 9V

This indicates that battery named “V1” is connected at the “+” end to node N001. The “-” end of the battery is connected to ground (node “0”). Finally, the battery's voltage is “9V” meaning 9 volts.

You probably won't need to know about the Netlist much in the beginning. If you create new parts or subcircuits, you may need to dig into this subject more deeply. The LTspice help file has plenty of information about this, but for now just be aware that this stuff is going on behind the scenes.

Bill of Materials

If you stay up all night and design that monster-effect guitar pedal, you'll need a bill of materials at some point to start a mail order. LTspice can produce that parts list from your schematic. You produce it by clicking on menu “View” and then select “Bill of Materials”. At this point you can choose “Paste to clipboard” or “Show on Schematic”.

If you choose “Paste to clipboard”, you can paste the parts list into a word processor or text editor. Using our Simple2 schematic, it's bill of material looks like this:

--- Bill of Materials ---

Ref.    Mfg.    Part No.  Description
R1      --      --        resistor, 100K
C1      --      --        capacitor, 47uF

In this example, we only have two parts: R1 and C1. However, for larger projects, this is an extremely handy feature to have.

The alternative is to have it show at the bottom of the schematic. If you choose this and decide later that you don't like it, it can be turned off again.

Circuit Sharing

This step isn't absolutely necessary to do but is one that might save you some grief if you plan to share your circuits with text-only forums like USENET. Newsgroups like are great places to discuss electronic design. But when sharing content in these types of forums, it must be text only.

Netlist Options Most of your circuits saved so far like Simple1.asc are text only (ASCII text). However, by default, LTspice likes to change the “u” in “uF” for capacitors to a “mu” character. This looks nice but creates trouble in the newsgroup forums. Any circuit that has this “mu” character will likely not post successfully1), or otherwise not get distributed everywhere. That is that it may partially succeed, adding to the “I see it”, “I don't see it” confusion that this generates in the forum.

For this reason, I recommend that you change an option in LTspice. Once done, you'll never need to do it again.

Start up LTspice with no circuits open, you click on the “Tools” menu and then “Control Panel”. You should see a dialog box like the one at right.

You'll likely need to click on the tab named “Netlist Options”, if it is not already showing.

Click in the yellow circled check-box shown “Convert mu to 'u' [*]”. Checking this option will prevent LTspice from changing any “u” in “uF” to the special mu character, in your future *.asc files. This also fixes the same problem in Netlists that LTspice generates that you might share with someone using a different SPICE simulation package.

Click “OK” at the bottom right.

Next Ok, enough reading and theory! Let's move on to AC Analysis.

questionmark.jpg Comments or questions? Click here.

Electron Coaxing Techniques and Notes (start)


1) depends upon newsgroup reader used
ltspice_dirty_secrets.txt · Last modified: 2011/05/03 06:13 by ve3wwg
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Install DokuWiki web hosting