EBN Practical 1 Tutorial
EBN Practical 1 Tutorial
This tutorial serves as a guideline to installing and using the LTspice circuit simulation software that
will be used for Practical 1.
This guideline will describe the steps to install LTspice and how to build and simulate a simple circuit.
The guidelines were written using the Windows version of LTspice, but the steps followed should be
similar for the Mac version of LTspice.
1. Installing LTspice
1. Download the Windows or Mac version of the LTspice installation file from following link:
https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html
The file is approximately 50 MB.
2. Click on the downloaded file LTspiceXVII.exe to install LTspice.
3. Read the licence agreement and click on Accept to accept the licence agreement.
4. Select the correct Executable Version if you know this information. This should be automatically
selected for you but if LTspice is not working, reinstall LTspice and change this setting.
5. Click on Install Now and wait for the installation to complete.
6. When the installation is done, LTspice should launch automatically. If it does not, you can launch
it by clicking on the LTspice XVII shortcut in the start menu.
1. If LTspice is not already open, launch it by clicking on the LTspice XVII shortcut in the start menu.
You should see the toolbar in Figure 1 at the top of the LTspice window. This toolbar and the drop-
down menus contain all the tools you require for using LTspice.
2. Before you can start building a new schematic, first create a new schematic in one of the following
ways:
2.1. Click on File → New Schematic.
2.2. Press Ctrl + N.
Page 1 of 22
2.3. Click on the New Schematic icon shown below in Figure 2:
You will be presented with a blank grey schematic that you can use to build your circuit on.
3. Save your schematic by clicking on File → Save As and selecting the File Name and location to save
the schematic to.
The Select Component Symbol window shown in Figure 4 will open. You can use this window to
select and place components onto the schematic.
Tip: To navigate back, click the Up One Level icon (folder icon) indicated in Figure 5 or click the [..]
folder. Try to navigate the directories and make sure you are comfortable with the interface.
3. To add a DC voltage source, select the battery component in the [Misc] folder and click OK. Click
anywhere on the schematic to place the component. You can place multiples of the selected
component by clicking more than once. When you placed one component, right-click to stop
component placement. Your schematic will contain a battery and should like Figure 6.
Tip: You can zoom in or out of the circuit by pressing Ctrl and rolling the mouse wheel.
Tip: You can pan the schematic by clicking and dragging anywhere on the schematic.
Note: Usually you would use the sources named voltage and current (find them in the home
directory shown in Figure 4) since they can be set up to be a range of source types including DC,
AC, pulse, and exponential. The sources are shown in Figure 7. The battery (Figure 6) is exactly the
same as the voltage component (Figure 7 left) mentioned with a different symbol. You can choose
which one to use in your circuits. The battery will be used for the example.
Page 3 of 22
Figure 7: Voltage and Current sources.
4. Right-click on V1, the label of the DC source in Figure 6. You will see the window shown in Figure 8
which can be used to rename a component. Change the name of the DC source to VS and click OK
(remember this name it will be used later).
Note: Two components may not have the same name or else the simulator will not know which is
which and will result in an error.
Note: It is not required to rename components but it is very useful when building larger circuits.
5. Right-click on V (at the bottom of the component), the value of the DC source in Figure 6. A window
similar to Figure 8 will open which can be used to set the value of a component. Change the value
of the DC source to 12 V by entering 12 without any unit and click OK. The DC source should look
like the one in Figure 9.
Note: When you right-click on the symbol there is a button labelled Advanced. Clicking this button
will grant you access to a range of component parameters where you can set it up to be an AC, DC,
or other source type.
Note: You may use SI prefixes such a “100m” for 0.1 V or “5k” for 5000 V when entering a value.
Do not enter the unit (V) or any other combination of letters except for an SI prefix.
6. Place three resistors onto the schematic as shown in Figure 9. You can do this by clicking the
Component button (Figure 3) and selecting the res component (you might have to go up one
directory (see Figure 4)).
Tip: You can rotate a component by pressing Ctrl + R while placing a component.
Tip: You can move a component by pressing F7 and clicking the component you want to move.
Tip: You can delete a component by pressing Delete and clicking on the component.
Page 4 of 22
Figure 9: DC source with three resistors.
Tip: You can use keyboard shortcuts to make using LTspice easier. For example, to place a resistor
you can press R on the keyboard. You can see more shortcuts by clicking on the Edit drop-down
list as shown in Figure 10.
7. Change the values of the three resistors to 10 Ω. You can do this by right-clicking the value (R) of
each resistor in Figure 9, entering 10 in the popup window, and clicking OK. Your circuit should
look like Figure 11.
Page 5 of 22
Figure 11: DC source and resistors with values defined.
8. To connect components together and complete the circuit, you need to place wires. You can place
a wire by pressing F3 or by clicking the Wire button shown in Figure 12.
Place the first wire by clicking the top node of the DC source indicated by the red cross in Figure
13. Drag the wire straight upwards and click to make a right turn. Drag the wire horizontally and
connect it to the left node of the top-most resistor (R1). Your circuit should look like Figure 13.
Tip: You can cancel wire placement by right-clicking and delete incorrectly placed wires by pressing
Delete.
9. Connect all of the components in your circuit as shown in Figure 14.
Page 6 of 22
Figure 14: Circuit with all components connected.
10. Before the circuit can be simulated, a ground reference is required. You can place a ground by
pressing G or by clicking the button shown in Figure 15.
Place the ground below the circuit and connect it to the bottom node of the circuit. Your circuit
should look like Figure 16.
Page 7 of 22
Figure 17: Simulation drop-down list.
2. Select the kind of simulation you want to run. As a start, we are only interested in the steady-state
DC node voltages and loop currents thus a DC operating point simulation will suffice. To set up the
simulation, navigate to the DC operating point simulation type by clicking on the DC op pnt tab in
the Edit Simulation Command window indicated in red in Figure 19.
Note: You can choose different simulation types by navigating through the tabs. You will see the
spice simulation command (blue box in Figure 19) change as you select different simulation types
and change parameters. You can experiment with different simulation types on your own by using
the user interface or by modifying the simulation command manually. You might need to do some
Googling to understand some of the parameters.
Page 8 of 22
Figure 19: DC operating point tab.
3. Click OK to close the Edit Simulation Command window. You will see that some text now follows
your cursor. Click somewhere on your schematic to place the text. This text is the spice simulation
command that was also displayed in the blue box of Figure 19. This text will provide the software
with all the parameters required to run the simulation. Your schematic should look like Figure 20
(note the simulation command in the bottom left).
Tip: It is useful to understand how to interpret the parameters of the simulation command. This
will make debugging your circuit and simulation much easier in the future.
4. To run the simulation, click on the Run button indicated in Figure 21.
5. Close the simulation result window (Figure 22) by clicking the X at the top right. You will now have
the option to click on a node in your circuit to display the voltage at that node. Click on all the
nodes to display their voltages. Add an additional voltage indicator above R3 as indicated in Figure
23. Your schematic should look like Figure 23.
6. To display a current on the schematic, right-click on the 4 V label indicated in Figure 23 to open the
window shown in Figure 24. Clear the indicated text box.
Select the current you want displayed by selecting it from the list. In this case, since the 4 V label
is in the branch containing R3 (see Figure 23), select the current through R3 by clicking I(R3). I(R3)
will appear in the text box as shown in Figure 24.
Page 10 of 22
Figure 24: Displayed Data window.
Tip: You can enter more complicated expressions into the textbox of Figure 24. As an example, you
can display the power dissipated in R3 by entering V(n002)*I(R3).
Note: For most simulation types (excluding DC operating point) you can add a current
measurement by clicking on the body of a component. Similarly, power dissipation can be
measured by pressing Alt and clicking on the component.
7. Click OK to close the window in Figure 24. You will now see the current through R3 as shown in
Figure 25 (The polarity of the current in your circuit might differ).
8. Looking at the circuit layout and the polarity of the voltage source VS in Figure 25, it is clear that
the current will flow from top to bottom through R3. So why is the current value negative? We can
find the answer to this question by navigating to View → SPICE Netlist as shown in Figure 26.
Page 11 of 22
Figure 26: View drop-down list.
The SPICE Netlist window in Figure 27 will be displayed. Looking at the row for R3, we can see it is
connected from node 0 (ground) to node N002, and has a value of 10 Ω. This means that the
resistor R3 has its positive reference connected to ground, and its negative reference to node N002
(the 4 V node). The simulation is assuming that we chose the current polarity as indicated in Figure
28, and hence the negative current value we observed (current is flowing down through R3, but it
was assumed that current flowing up is positive).
Page 12 of 22
-
The problem can be fixed by flipping R3 so its positive terminal is connected to node N002.
Alternatively, you can interpret the results taking note of the assumed current direction.
Tip: To flip the resistor: first select it using the Move hand (F7) then rotate the resistor twice
(Ctrl+R).
In Figure 29, the simulation was repeated after flipping resistor R3. This was done to show that
flipping the resistor gives the expected results. You can try this for yourself and confirm that the
resistor is connected correctly by looking at the netlist as in Figure 27.
1. The first step for setting up the simulation is to edit the simulation command. The process is similar
to what was done for the DC operating point simulation. Go to Simulate → Edit Simulation
Command (see Figure 17) to open the Edit Simulation Command window (see Figure 18). Navigate
to the DC sweep tab to set up a DC sweep simulation.
2. Fill in the text boxes to set up the following simulation that was also described earlier:
Page 13 of 22
Sweep the VS source, linearly, from 0 V to 12 V in 0.5 V increments.
The Edit Simulation Command window should look like Figure 30.
Note: You can see that if you give components proper names when building your circuit, setting
up the simulation is much easier and you are less likely to make a mistake.
3. Click OK to close the Edit Simulation Command window. You can then place the simulation
command text anywhere on the schematic. Your schematic should look like Figure 31.
Note: You will see that the previous simulation command is still present and has changed from
“.op” to “;op”. This indicates that the DC operating point simulation is no longer the active
simulation. You can remove the old simulation command if you desire.
4. Click on the Run button (Figure 21) to run the DC sweep simulation. A blank graph window will
open in the LTspice window as shown in Figure 32.
Page 14 of 22
Figure 32: LTspice window after DC sweep simulation.
5. To add a trace (measurement) to the graph, you need to click on the node you want to measure.
Click on the node at the positive side of VS as indicated by the red cross in Figure 32. A trace
representing the voltage of VS will appear in the graph window as shown in Figure 33.
Tip: The names of the traces are shown at the top of the graph window in the colour of the trace.
In Figure 33, the trace is called V(n001), where N001 is the node name. In this circuit, the voltage
of node N001 is the same as the voltage of VS.
Tip: You can delete a trace by pressing Delete and clicking on the trace name.
Note: Because we are sweeping and measuring VS, the X (sweep value) and Y (measured value)
values of the graph will be exactly the same. This confirms that the simulation is working as
expected.
Page 15 of 22
6. To measure the current through R3, click on resistor R3. A trace should appear in the graph window
named I(R3) as shown in Figure 34. You will see that the voltage and current values of the Y axis
are displayed on the left- and right-hand sides respectively.
Note: You can also add a power dissipation measurement by pressing Alt and clicking on the
component.
7. The last measurement we want to make is the voltage across R1. To do this, we need to find the
voltage difference between the nodes on either sides of resistor R1, as indicated by the green and
blue crosses in Figure 35. Since the voltage polarity is not given, the green side is assumed to be
the positive voltage terminal.
Find the node names at the green and blue crosses in Figure 35 by hovering the cursor over the
nodes and observing the node names at the bottom left corner of the window. Remember the
names (N001 and N002 in the example) and which one is the positive terminal (N001 in the
example).
8. To add the trace representing the voltage across R1 to the graph, right click anywhere on the graph
and click on Add Traces as shown in Figure 36. The Add Traces to Plot window shown in Figure 37
will be displayed.
Page 16 of 22
Figure 36: Add Traces.
9. In the Add Traces to Plot window shown in Figure 37, click on the voltage at the positive node
identified before (V(n001) in this example) to add the voltage to the expression box indicated in
the red box. Then type a minus (-), and click the voltage at the negative node (V(n002) in the
example). Your expression should look like the one in Figure 37. Click OK to close the window and
add the trace to the graph. A new trace representing the voltage across R1 will appear in the graph
window as shown in Figure 38 (red trace).
Page 17 of 22
Figure 38: Graph window with voltage measurement across R1.
10. Looking at Figure 38, what is the voltage across R1 when VS is 4.3 V? You can see that it is difficult
to take accurate measurements from the graphs. We can use cursors to get very accurate readings
of the X and Y axes.
Add a cursor to the R1 voltage trace by clicking on the trace name indicated in Figure 38. A cursor
will appear on the selected trace (red trace in this example) as well as a Cursor window displaying
the cursor values as indicated by the red block of Figure 39.
Click and drag the cursor to the point on the X axis where VS is 4.3 V (use the Cursor window to
accurately align the cursor). Using a cursor, you should find that the voltage across R1 is 2.87 V
when VS is 4.3 V.
11. Click on the trace name again to add a second cursor to the graph of Figure 39. Your graph window
should now look similar to Figure 39. A second cursor allows additional measurements such as the
difference between two points on the trace and the slope of the trace.
Page 18 of 22
6. Practice Questions
Test your understanding of LTspice by doing the following exercises. The memorandum to the
questions can be found in Section 7 for you to assess your own answers.
1. Draw the circuit schematic of Figure 40 in LTspice as shown in Figure 41 and simulate the circuit using
a DC operating point analysis simulation. Answer the questions below.
Page 19 of 22
2. Draw the circuit schematic of Figure 42 in LTspice as shown in Figure 43 and simulate the circuit
using a DC operating point analysis simulation. Answer the questions below.
a. What is the total current in the circuit?
b. What is the voltage at point 2 of R2?
c. What is the voltage at point 2 of R3?
(a)
3. Complete a DC Sweep simulation for Figure 43 sweeping the voltage source V1 from 0 V to 10 V in
steps (increments) of 1 V. In a single graph, measure and plot the current through R1, R2, and R3
individually.
Note: The graph should have three separate traces or lines, one for each measurement. For each
measurement trace that is added in LTspice, a new line is plotted in the schematic window.
Note: You can turn on the grid of your figure by using Ctrl + G or by clicking the Plot Setting menu
and selecting Grid.
4. Complete a DC Sweep simulation for Figure 43 sweeping the voltage source V1 from 0 V to 10 V in
steps (increments) of 1 V. In a single graph, measure and plot the voltage across R1, R2, and R3
individually.
Page 20 of 22
7. Answers
1. Question 1
a. What is the total current in the circuit? 750 mA
b. What is the voltage at point 1 of R1? 12 V
c. What is the voltage at point 2 of R1? 9V
d. What is the voltage difference across R1? 3V
2. Question 2
a. What is the total current in the circuit? 666.67 mA
b. What is the voltage at point 2 of R2? 5V
c. What is the voltage at point 2 of R3? 5V
3. Question 3
Page 21 of 22
4. Question 4
Page 22 of 22