Image of eBits Academy protocols illustration

Circuit Simulator – Introduction to LT-Spice

  • March 08, 2023
  • |
  • Jonas Rothausen

Introduction

So you want to develop your first circuit? Time to learn simulation! The ability to simulate circuits is an important tool for electronics makers because it lets us test and analyse our designs before building prototypes. This matters for both time and money. In a simulation, you can set up your circuit and test whether it theoretically works as expected. A widely used program for this (for analogue simulations) is LT-Spice. Let’s take a look at what it is all about.

 

LT-Spice

Remember when we learned about circuit analysis in this blog? In that blog, we worked a little with the circuit in Figure 1 and made a few calculations.

Figure 1: A circuit with voltage source V1 and two resistors, R1 and R2.
V1 = 9 V
R1 = 2 Ω
R2 = 3 Ω

When we introduced this circuit, we calculated the voltage drops around the closed loop. Now we will simulate it and hopefully get the same results!

But wait. This LT-Spice thing... How do you use it? Worry no more: I will explain every step, and you will be simulating circuits in no time! LT-Spice is a free program ready for you to download. The first step is to draw the circuit in the program with all the correct components and sources. To do that, open the program and start a new project.

- Click 'File' in the upper-left corner

- Select 'New Schematic' (or use Ctrl+N)

We should now have a blank page ready for drawing our circuit.

We start with our components and voltage source.

The two resistors can be drawn in the program by pressing r. Rotate components by pressing Ctrl+R. Right-click the resistor symbols to adjust their values.

 To add the voltage source to our circuit, press F2. The 'Select Component Symbo' window appears (you can also find resistors here—in fact, all components you want to simulate with can be found in this window). Search for voltage and select the voltage source; see Figure 2. Right-click the voltage-source symbol to adjust its voltage.


Figure 2: LT-Spice Select Component Symbol window (press F2). This window adds components to a simulation.


The last thing we need is ground. To insert ground, press g.

You can always click the scissors icon in the top menu to remove anything you have drawn in the program that you no longer want.

Now we have everything needed for our circuit and just need to connect it together. Press F3 to connect your components and sources. Then drag the mouse between the points where you want connections, holding down the left mouse button.

Once all connections are made and the values for our two resistors and voltage source are entered, we should have something like Figure 3.

Figure 3: Circuit drawn in LT-Spice.

To simulate the circuit you have drawn, click the running-man symbol, run, in the top menu.

The 'Edit Simulation Command' window appears; see Figure 4. Do not worry too much about all these settings yet. We only need to enter a Stop time value. The duration does not matter much now either, so we can enter 1, for example. We have now asked the program to simulate our circuit over 1 second; see Figure 4.

Figure 4: LT-Spice 'Edit Simulation Command' window.

Then click OK, and a graph appears either below or above your circuit. This graph displays the values from our simulations (see Figure 6, which includes this graph).

To measure the voltage across resistor R1, drag the mouse from A to B—see Figure 5.

Figure 5

The component you drag the mouse across is the component whose voltage you measure. To measure the voltage across R2, drag the mouse from B to C. A measurement appears on your graph showing the voltage across the given component over one second.

This simulation trace has a colour and a name on the graph. You can change the colours of all traces displayed on the graph by right-clicking their names. Voltage names on your graph start with V, and current names start with I.

To measure current through a component, click the component you want to measure. Another current measurement appears on the graph. (Note that the left vertical axis measures voltages and the right axis measures current, or vice versa.)

We should now have something like Figure 6.

Figure 6

The calculations we made in this blog, where our circuit originally came from, agree with our simulations. This means we have drawn the circuit in LT-Spice and measured the voltages and currents correctly. We now understand the very basics of circuit simulation in LT-Spice!

In other words, we can now simulate circuits to test how they work in theory. That is the purpose of circuit simulation. It is easy to imagine how useful this is, especially when working with large, complicated circuits with many components. LT-Spice lets us test the circuit quickly, but it is important not to rush: if an error somehow appears in the drawn circuit, the simulations can be misleading. So double-check your circuits when simulating!
Fortunately, LT-Spice is a fairly intuitive program that you will quickly get to grips with, letting you design many circuits of your own. Circuit simulations can also help you understand how different components affect circuits by adding or removing components or changing their values. Circuit simulation is a fantastic tool and a must for any electronics maker!

Leave a comment

Please note, comments need to be approved before they are published.