from IPython.core.display import HTML
def set_width(width):
display(HTML(f"""<style>
.container {{ width:{width}% !important;
min-width:800px !important; margin: 0 auto}}
.jp-Cell {{ width:{width}% !important;
min-width:800px !important; margin: 0 auto}} </style>"""))
# Set container width to X% of the fullscreen
set_width(50)
intro LTSpice#
This intro supports labmanual 1C, and 3A (freq. analysis)
installation of LTSpice on your laptop#
⏳ Estimated time: 20 min
LTspice is a circuit simulator made available by the company Linear Technology, which is part of Analog Devices now. It allows to quickly draw a schematic with general or specific components and simulate the circuits to perform DC, AC and transient analysis (=response to a step function). Simulation results are presented in a graphical way.
LTspice v24 can be downloaded from: https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html:
The windows version also runs on Linux under the Wine package.
Go to the website of LTSPice; download and install the program.
Use LTSpice to build the simulation#
In LTSpice you will often use the top tool bar. Follow the steps below to simulate the (stacked) voltage dividers you saw in Anticipate.
If you are working on MAC, your UI will look completely different. To access the menu, rightclick with your mouse. You should be able to access all the components below by navigating in the subsections of that menu.
Drawing, positioning and editing components#
You need components:
Press “R” or Left-click the resistor icon
move the resistor symbol to the drawing area
left click again to create R1
In case you want to rotate the resistor, use the rotate 90 degrees and/or mirror option. You can also use ctrl+R. Note that:
the rotation is only in the clockwise direction
for rotating an existing element, first click rotation, then click the element
if you loose overview, hit space to zoom to full extent
Edit the component’s value by:
Move the mouse over a resistor until the cursor changes into a “hand” symbol.
Then right-click to open the edit menu.
Set/Change the resistor value
Note: You can use the following prefixes: f/F (femto), p/P (pico), n/N (nano), u/U (micro), m/M (milli), k/K (kilo), meg/MEG (mega), g/G (giga), t/T (terra). So for a 1 kΩ resistor type 1k, and for 1Ω simply 1.
Moving components
left-click the move icon.
Position the “hand” cursor over the component and left-click. Now the component can be moved.
Click again to fix the new position.
Press ESC/right-click to stop moving components.
Note: any wire connections to the component will be broken. To have the connections move with the component: use the drag command (icon).
Placing the Voltage source#
After placing the resistors, let’s make it into a circuit. The advantage is that you can simulate, in order to see which voltages an currents exist in the circuit (and eventually tell something about your overall replacement resistance).

Click the component icon, type “volt” in the selection window and the selection will jump to voltage. Confirm by pressing OK.
Drag the voltage-source symbol to the desired position and left-click to place. Note: to change the polarity or the orientation of the source, left-click the rotation icon one or more times before placement.
Press ESC to stop placing voltage sources. Setting voltage source values
Hover the cursor over the voltage source until the “hand” cursor appears. Then click right to open the edit menu. Set: DC-value to 0 V and the series-resistance to 0.
AC Voltage source (for transient analysis)#
Right-click on the voltage source and make the following (advanced) settings:
Select which function you want (often sine or block wave (PULSE))
set the Tperiod. For example use 20 us (=microseconds). For a block wave use 50% duty cycle (ton= 10 us, automatically leading to toff= 10 us).
Set the rise and fall times to a low value like .1 us.
Set the number of periods to simulate at for example 4.
Set Von to for example 1.
AC Voltage source (for AC analysis)#
Right-click on the voltage source and make the following (advanced) settings:
A Sine wave
In this case: with a frequency of 1 kHz, amplitude of 1 V and a total of 10 cycles.
For the small-signal AC analysis set the AC-amplitude to 1 V as well.
Placing the ground connection#

Each circuit needs a potential reference (0V), all voltages will be calculated with respect to this point. This is done by placing a ground symbol.
Left-click the ground icon
Move it to the right postion and left-click again.
Press ESC to stop placing grounds.
All ground symbols are connected to each other!
Don’t forget to put the negative pin of the voltage source to ground as well.
Interconnecting the components#

Once the components are (more-or-less) in the desired position and orientation you can draw the interconnecting wires.
Left-click the wire icon.
Left-Click on a connector-point (small square) of one component to start a wire.
Left-Click on a connector-point of another component to complete the wire
Note: Only horizontal or vertical line segments can be drawn. When connection points are not on one line, the connection must be build up from horizontal and vertical segments. You can define corner points by clicking anywhere on the diagram.
Labelling Nodes#

In order to help interpretation of results it is good practice to label the important nodes in the network. Otherwise LTspice does automatic naming, which is often unclear.
Right-Click on each of the blue lines on top and choose “Label Net” from the pop-up menu.
Name them VA, VB respectively and connect the text-symbol that appears to the line.
Note: do not use duplicate names, LTSpice will not be able to distinguish these labels (and identical names on components will return an error)
Saving your schematic#
If you want to use your schematic later, you need to save it. Click on File>Save as and rename your file when saving.
Hint: save each schematic you simulate under a different, and easy to recognise name.
Saving graphics#
You can save your LTspice schematics and graphic results as graphics by selecting the corresponding windows and follow the menu: “Tools” > “Write image to .emf file”. Or use Windows snipping tools, or just print screen.
Tip: Normally the graphs have a black background which is OK on screen but inconvenient on paper. You can change the background to white by setting the Color preferences:
Choose from the menu: Tools > Color Preferences
Select the Schematic Tab and set Selected Item = Background and set all three colors to 255, see figure.
Select the WaveForm Tab and do the same.
Running an analysis#
There are different type of analysis. When you use a DC source and resistors, the current and voltages in the circuit will also be constant, hence you can use DC- analysis (‘DC on pnt’).
For AC sources, you might be interested in the signal versus time (‘transient’), or versus frequency (‘AC analysis’).
DC-Analysis#
Follow the menu: Simulate > Edit Simulation Cmd.
In the pop-menu select the tab “DC op pnt” (DC at point) and click OK.
Left-click in the drawing area to drop the command “.op”
Click the RUN icon to start the simulation, the solution (currents and voltages) are shown in a pop-up window, similar to the above one
From the currents and the nodes you can derive the total current, total voltage and therefore total resistance.
If you want to better recognise which node is where, you should name them.
Transient Analysis#
Transient simulation#
Change the simulation settings through: Simulate > Edit Simulation Cmd
Select the Transient tab (leasing to an intensity vs. time display)
set the total simulation time to e.g. 100 us;
and the maximum steps to make to a large value, e.g. 1000 (see figure)
Display#
After running the simulation, you see an empty graph. Measure the voltage(V) or current(I) by attaching a probe; you get the icon by hoovering over the line or component on your scheme.

AC analysis (Bode plot)#
AC analysis simulation#
In Simulate > Edit Simulation Cmd > AC Analysis tab, set the following settings
set type of sweep to decade.
set number of points to 100.
set start frequency to 10.
set stop frequency to 1 Meg.
remember to delete your previous simulation settings(on the scheme) or comment them out!
Display and cursors#
After running the simulation, you see an empty graph.
Show Vout.
If you do not want to see the phase, right click on the phase label (at the right side of the graph) and switch it off.
Right-click the label V(vout) at the top of the graph(in the Waveform window).
In the pop-up window set “Attached Cursor:” to 1st and click OK.
In the graph, a set of hairlines(two crossed lines) will apear, together with a new window giving the signal values.