Starting with SPICE



Categories: Simulation spice Tags: Simulations starting with spice

This time this tutorial is more specific on Electronics. However any one who likes to play with circuits can use it. SPICE is simulation program which simulates the circuit on form of net list. As this is a beginners topic so I will introduce some basics of net list and then we will simulate it.

You can simulate the net lists presented here with any of free or commercial SPICE simulator. However the circuits presented here will be tested with LTSpice, a simulation tool from Linear Technology Inc. It is a very good, fast and powerful tool. It works on Windows PC. The best part of story is its a free tool so that everyone reading it can use it.  If you are using a Linux PC then you can use ngSPICE. It is also a free tool. Figure below shows a LTSpice window.


So a net list can be described as a textual form of an electrical circuit. A net list is basically an ASCII file containing the nodal description of circuit. It can be created using any text editor. LTSPICE comes with schematics capture program which lets you create the circuit in graphical form and converts it into net list form for simulation. Generally the netlists are more or less portable between simulators with some changes. Here we will use text editor to create the netlist so that we can better understand the components of a basic netlist. This will also develop debugging capabilities in reader.

So lets start with a basic circuits, which is a basic RC network.

RC Network

So this circuit consists of 3 nodes. First node is where R1 and Vin are connected. Second one is Vout i.e. where resistor and capacitor are connected. Third one is ground. Ground is considered as zero potential node.

Lets start with netlist. While writing netlist we generally follow a basic syntax as follow :

<device name>  <node1> <node2> <properties/value>

So following this convention for our first element Vin (voltage source). So we get

Vin         2 0  SIN( 0 5 50 0 0 0 )

So here Vin is device name. Device names give indication of its type. Like device names starting with V will be voltage sources. Starting with R will be resistors and so on. We will come across various devices as we move on. Vin is connected to node 2 and 0. Node 0 always represents ground. We can specify names for nodes also, as we will see in next statement.

C1          Vout 0 1U
R1          2 Vout 1K

Notice the node name Vout here. This is name give to output node. we could also use number as we did earlier. Putting this all lines together and saving as .cir file completes the creation of our netlist file.

For now we have just put only circuit description in our CIR file. Now what we are missing is control statement. Control statements decide the behavior of simulation. For example if it is a DC simulation or AC simulation or Transient one. There are a lot of other things that control statements can do.  For now we being in start-up tutorial we wont go into too deep.

So we are using .TRANS control statement which tells simulator that it is a transient simulation. This control statement has following syntax.


We have used a 2n step and simulated for 20m seconds of time. So I assume now you can place required control statement in your CIR file. Open that file in LTSPICE and click on run symbol. The output shown will be identical to one shown in above LTSPICE window.

If you were a careful reader then you must have notice that that I missed syntax for Voltage source. That is because I am planning to devote a whole article on sources in SPICE. Happy simulating.