Your First LTspice Schematic

Let's Start! Let's get started! Start LTspice and a window should open up looking like this:

Start a New Schematic

From the “File” menu, select menu item “New Schematic”. The background may change colour at this point and the menu bar fills in with more options.

Drawing Your Circuit

Now you are ready to draw your circuit. Press function key F2 (this is the equivalent to selecting menu “Edit” and then menu item “Component”). Remember the F2 key because you will use it often.

The F2 Dialog Box

After pressing the F2 key, a component selection dialog box pops up:

Items appear in the window in the lower half. The names within square brackets indicate directory names of more components. For now, double-click on “[Misc]” to descend into the Misc directory of components.

Selecting a Component

As soon as you click on “battery” (once), you see it's symbol displayed in the upper left of the dialog window. A little description is also given to the right of that.

Click the “OK” button below.

As long as your mouse is in the main schematic window, you will see the outline of the component moving with the mouse:

The symbol moves with your mouse until you (left) click. However, before you do that, you have the option of typing Control-R on the keyboard to rotate the part. If you press Control-E instead, the part is mirrored (flipped). We don't need to do either, but you might want to try these features out. Rotate or flip the component as many times as you can be amused.

Now (left) click once you've found a spot you want to put the battery. After you do so, move your mouse and you'll see that it is possible to plant more batteries if you need them. If you planted another battery by mistake, then press the Del (Delete) key and using the scissor mouse cursor, (left) click on the component you want to remove (press escape to exit delete mode).

Press Esc (escape) now, if you haven't already done so. This should now give you a cross-hair cursor with your single battery planted on your schematic.

Adding a Resistor

Now let's add a resistor. You can simply type “R” for this, or click on the Edit menu and select “Resistor”. Again it is possible to rotate or flip it like before (but we don't need to do that here).

Plant it on your schematic to the right of the battery and again press Esc (Escape):

We're almost done.

We need some wiring and to define the battery voltage and resistor value. Let's do that now.

Drawing the Wiring

The easiest way to do this is to press F3 (equivalent to clicking Edit, then select “Draw Wire”). This is another key worth remembering.

After pressing F3, you are in wire drawing mode. Click (left) where a connection is to start and click again where it ends. You can click at the points where you want a corner. Click Esc when you're done drawing.

If you make some mistakes that you want to delete, press the Del (Delete) key. Then click the segments you want gone and finish with the Esc key. Alternatively, drag the mouse in a rectangular lasso to eliminate regions of stuff.

Press F3 again, if you need to draw more wiring.

When you get done drawing press Esc (Escape) and your circuit should now look like this:

Defining Component Values

Dry Cell We need to tell LTspice how many volts the battery supplies and how many ohms R1 is. So let's do that now.

Define Battery Voltage

Move your cursor to the battery icon and right-click on it. When you do that, a dialog box pops up:

Type in “12V” for 12 volts and leave the “Series Resistance” blank for now (assuming zero ohms series resistance). Once you click “OK”, the schematic will show a voltage for the battery.

Define Resistance of R1

Do the same for R1. Right-click on the resistor icon and give it the value “20k”. Leave the “Tolerance” and “Power Rating” inputs blank for now. The schematic should now look like this:

Saving Your Schematic

Now is a good time to save what you've entered. By default LTspice has already named this circuit Draft7 (perhaps Draft1 in your case). If we want to change the name or the directory it is saved in, click on “File” and then select “Save As”.

Let's name it “Simple1”.

Defining Ground

We need one more thing in the schematic before we can simulate this circuit. All SPICE simulations must have a Ground connection configured. So let's draw a Ground connection now.

Type “G” to create a ground “component”. Place it under the bottom wire and then draw a wire (using F3) between it and the Ground. Press Esc when you're done drawing.

Make sure when you draw the circuit lines that they “link up” to the components (i.e. there is no tiny space between the line and the component). This isn't often a problem but can be a factor later if you find that LTspice doesn't simulate your circuit properly (or doesn't start). You might need to zoom in and zoom back out with the mouse wheel if you need to check this. Alternatively, you can just delete the wire and redraw the connection if you suspect a problem.

Connections from a component to another line should connect to it with a “connecting dot”. Likewise a line connecting to another line should connect with a dot. The exception is when you extend an existing line by continuing it. In LTspice lines cross without connecting (show no dot) but are considered connected when there is a dot.

In the diagram below, you can see that the ground “component” is connected to the bottom line with a connected dot. Think of it as a blob of solder.

The finished diagram should look like this:

Press Control-S to resave the circuit again (or click “File” and then select “Save”).

Simulation

Ok I lied. There is one more step.

We need to tell LTspice what type of simulation to perform, how long it should proceed with the simulation and when to start collecting data for the graphs etc. It sounds like a lot but LTspice makes this simpler than it sounds.

Defining the Simulation

Click on menu “Simulate” and then choose “Edit Simulation Command”. You should see the following dialog box open:

Enter the following three values and leave the rest of the inputs blank (default):

  1. Set stop time to 1 (seconds)
  2. Set Time to Start Saving Data to 0 (seconds)
  3. Set Maximum Timestep to 0.1 (seconds)
  4. Click “OK”

At this point your mouse will be carrying around with it some text describing that simulation command (a .tran command). Simply plant it on your schematic somewhere out of the way at the bottom with a mouse (left) click.

Run the Simulatation

Finally! Let's run the simulation.

Do one of the following to start the simulation:

  • Click the running man icon in the menu bar below Hierarchy.
  • Or click menu Simulate, and then choose item “Run”
  • Or right-click the background and then choose item “Run”.

Your simulation should be quick for this circuit. But if you ever need to halt it early, you can Halt the simulation by pressing Control-H (or right-click and select “Halt”). Sometimes you'll configure a long simulation run but stop it after the event you wanted occurs.

Simulation Results

After the simulation completes, you should have a graph subwindow (in addition to the original schematic subwindow). The graph shows blank at this point and this is normal.

To plot something like the current flowing in R1, move the mouse cursor over the resistor R1 (in the schematic window of course). The cursor will turn into a current sensing icon with an arrow. Click (left) on R1 to cause a plot to appear for it's current in the graph subwindow.

Depending upon the size of your windows and subwindows, you may need to move them around and/or zoom. If you need the LTspice windows reorganized, click on the menu bar item “Window” and then choose an organizing item like “Tile Horizontally”.

The graph shows us here that the simulation showed a steady just under 0.7 mA of current. Let's check that:

  • 12 volts divided by 20k ohms ⇒ 0.6 mA.

If you want to see this more accurately in the graph, then use the mouse to drag a rectangle over the area of interest. After zooming in a few times this way, you can see that the simulation agreed:

The result was 600 uA exactly (0.6 mA).

To zoom the graph all the way back out, right-click on the graph window and then choose “Zoom back to fit” (or type Control-E).

Measuring Voltage

If you click the wire just above R1, you will get a voltage measurement between that point and the Ground. It shows up in Blue below:

The top of the graph is the legend of plots by colour. “V(n001)” indicates the voltage at Node 001 is shown in the blue plot. The “I(R1)” shows the current in R1 in the yellow plot.

Current is shown on the right axis, while the voltages are shown on the left axis. The horizontal axis at the bottom shows the point in time (seconds). For our simple circuit the graphs are not that exciting yet. But we'll get there soon!

Resetting Your Graph

As you'll eventually discover, there is quite a bit of functionality in the graphing window. For now, just make note of this one little trick.

Sometimes when you get a lot of plots showing on your graph, you might want to start over with just one plot again. Using your probe you can double-click on a wire. The double-click clears the graph and then shows the voltage of that point. This can be very convenient.

Congratulations!

Success? Yea! Let's review your successes here. Now you can:

  1. start and save a new schematic
  2. place battery and resistor components in your schematic
  3. draw the wiring of the circuit
  4. wire your circuit to ground (don't forget to do this!)
  5. define one kind of a simulation run
  6. run the simulation
  7. measure current in a component
  8. measure voltage from a point in the circuit relative to ground
  9. zoom in on your graphical plots and zoom back out again
  10. The mouse wheel zooms in and out

Now might be a good time to resave your work again in case you want to come back to it.

You are now ready to move onto more interesting simulations!


Next The next topic is Resistor Capacitor Circuit.


questionmark.jpg Comments or questions? Click here.


Electron Coaxing Techniques and Notes (start)


Up

ltspice_first_schematic.txt · Last modified: 2011/04/30 21:55 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