0% found this document useful (0 votes)
6 views10 pages

ECE321_lab2

2

Uploaded by

Net Frd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
6 views10 pages

ECE321_lab2

2

Uploaded by

Net Frd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

EECE 321 Lab 2: Circuit Simulation with SPICE

Page 1 of 10

Laboratory Goals

❑ Introduce graphical-based SPICE simulation tools


❑ Create diode circuits using PSPICE and Multisim
❑ Simulate output response for the designed circuits

Pre-lab reading

❑ Read the pre-lab introduction below


❑ Visit the Cadence website (maker of PSPICE)
❑ Visit the National Instruments website (maker of Multisim)

Equipment needed

❑ Lab notebook, pen


❑ Workstation PC, with PSPICE and Multisim tools

Parts needed

❑ No electronic parts are needed for this lab

Lab safety concerns

❑ There are no specific safety concerns for this lab

1. Pre-Lab Introduction

SPICE is an acronym for Simulation Program with Integrated Circuit Emphasis. The
original SPICE program was developed at the University of California Berkley in the
1970s. Computer aided simulation is common practice in industry and is a very useful
tool. SPICE is useful way of verifying your lab test results and experimenting with
changes to your own circuit designs. It is also widely used in industry for simulating
designs prior to production Internal numerical accuracy of programs such as SPICE
is very high with errors seldom exceeding 1%.

Integrated circuit analysis is burdensome as the number of electronical devices


increases beyond more than a few. Consequently, SPICE is used to test and simulate
complex transistor circuits. There are several versions of the SPICE software now
available. Aim Spice, PSPICE and Multisim are two versions. PSPICE and Multisim
are graphical simulators, whereas Aim Spice is text based. All SPICE programs are
based on the core SPICE programming.
EECE 321 Lab 2: Circuit Simulation with SPICE
Page 2 of 10

While PSPICE makes extensive use of part libraries, Aim Spice uses text entries.
Circuits may contain passive components such as resistors, capacitors, and inductors,
and active devices such as transistors and diodes as well as independent voltage and
current sources. To write code describing a circuit, nodes must be defined in said code.
With nodes clearly numbered, various elements are then connected between nodes to
specified values. SPICE allows the user to perform various analysis of the circuit such
as nonlinear dc, large-signal time domain (transient), small-signal frequency domain,
nonlinear transient, and linear ac analyses. The dc and transient analysis capabilities
are of greatest interest for digital circuit studies. In addition to performing the differing
analysis types, SPICE also generates graphical outputs for which the various nodes and
inputs can be graphed individually or together. SPICE software is based on the same
logic core in which the code is either manually generated as with Aim Spice or
converted from a graphical representation by the software as PSPICE and Multisim do.
A netlist file is manually written when using Aim Spice, whereas PSPICE generates
the netlist file containing the circuit elements and their interconnections for you based
on the graphical representation.

Despite the accuracy of computer simulation, hand analysis is still necessary. SPICE
simulation is a tool to enhance circuit analysis, but it doesn’t replace hand
computations. For instance, hand calculations are the best method for developing
appropriate simulation time intervals or rise times for a given circuit.

2. Pre-Lab Circuit Analysis

❑ Calculate voltages and currents by hand for the resistive network shown in Fig 1.
❑ Provide plots of the expected outputs for the other circuits in this lab experience.

3. Resistive Network Circuit Simulation

Figure 1 – Circuit Schematic of a Resistive Network


EECE 321 Lab 2: Circuit Simulation with SPICE
Page 3 of 10

PSPICE

❑ Create a folder in My Documents for your PSPICE designs to be stored. Use your
last name in the folder name.
❑ Open the PSPICE application called PSPICE Schematics from the Program Menu
of the Start Button.
❑ We will create our simulations by graphically drawing the circuit. You are now
presented with an empty page to draw the schematic describing the circuit (if a
blank page does not automatically load create one by selecting File >> New)
❑ Save your circuit by selecting the “Save As” option from the File drop down menu
and save the file in your directory as a .sch file
❑ Start placing components by clicking on the get new part icon . The Part Browser
Window will open. This window lets you browse some of the components and do
searches by part name or description. This
❑ To place a DC Voltage Source search for VDC and click on the place & close
button. Then drag and drop to place it.
❑ If you wish to rotate the component, click on it and select ctrl + r
❑ Now you can see the component and a label with the part number and value. To
change the voltage source double, click on the value and edit it.
❑ Now click again on the get new part tool. When the window opens, search for a
resistor, the part name is r. Click on the place button and place all the resistors
shown in Figure 1. Rotate them accordingly and change their values by double
clicking in the corresponding tag.
❑ Finally look for the ground symbol in the get new part window. Make sure to place
an earth ground component.
❑ Now to connect the devices, use the draw wire tool and click on the
corresponding terminals you wish to connect.
❑ To enumerate the nodes double click on the wire and label it. SPICE identifies each
element in a circuit by node numbers and values with ground usually given a zero-
node number.
❑ For this first circuit, we wish to obtain all the node voltages. Hence, we must do a
bias point detail analysis. Confirm that the bias point analysis is properly enabled
by using the analysis setup tool .
❑ Now save your circuit and then go to the Analysis drop down menu and select the
create netlist option from the menu. To view the created netlist, click on examine
netlist from the analysis menu. A new window containing a text description of the
circuit will show up. In future labs we will learn how to simulate a circuit by writing
the netlist directly. After examination, close the window.
❑ In order to run the analysis, click on the simulation button on the upper left side
of the screen. PSPICE AD will open.
❑ The results of the analysis can be seen by selecting the “View Output File” button
or by selecting Output File from the View drop down menu
❑ The Output File will display the circuit code, as well as node voltages
EECE 321 Lab 2: Circuit Simulation with SPICE
Page 4 of 10

❑ Currents can be calculated using Ohm’s law using the generated node voltages
❑ Compare the simulation results to your hand computed analysis from the pre-lab

MULTISIM

❑ Repeat the simulation for figure 1, but this time using Multisim.
❑ Start the Multisim program by selecting it from the program menu.
❑ You will be creating a new schematic and simulation so choose File->Save
as, navigate to or create a directory where you can save this schematic and
simulation then fill in the filename as shown below. Click OK when you have
navigated to the proper directory and entered a name for the project.
❑ You should now have a blank schematic. Start placing components by selecting
Place->Component from the menu bar. You will see another dialog box as
shown. Start with the Voltage source so pick Source Components in the drop-
down menu and select the DC_POWER source from the power sources family:

Figure 2 – MULTISIM Component Menu

❑ Drag and drop the component and then double click on the labels to edit them.
❑ Insert the rest of the components by searching them in the part menu. Resistors are
under the Basic components drop down menu. Note GROUND symbols are at
SOURCES->POWER_SOURCES.
❑ Use Place->Wire to add wires for connecting components together.
❑ Be sure all components are connected as shown in Figure 1. Then name the input
and output signals to make them easier to locate in simulation. First highlight the
wires above to label them. Do this by placing the cursor on the red wire and left
clicking once. Now right click once and select “properties” from the popup menu.
Change the net name to the proper labels.
EECE 321 Lab 2: Circuit Simulation with SPICE
Page 5 of 10

❑ To run the simulation first select Simulate->Analyses->DC Operating Point from


the top menu bar. Next select the variables you wish to analyze. The software also
allows you to input and expression if you need to. Finally click simulate.
❑ Compare the simulation results to your hand computed analysis from the pre-lab

4. AC Analysis Simulation

Figure 3 – Low Pass Passive Filter

Using the same techniques as for the resistive network, more complicated circuits can
also be analyzed using SPICE. For this passive filter we will use AC analysis to
obtain the Bode Magnitude plot.

PSPICE

❑ For AC Analysis in PSPICE the Voltage Source used should be VAC. Search for it
in the get new part menu and place it. Then double click on it and its attribute
window will appear. Notice that this part has no frequency attribute. It is because
the simulation will sweep the frequency of the source to find the AC response.
❑ Place the rest of the components and wire them. Remember to place a ground!
❑ We will do an AC Sweep Analysis, so enable the AC sweep in the Analysis setup
window . The AC sweep type can be Linear, Octave or Decade. For this
example, lets select decade, and 10 pts/decade with a start frequency of 10Hz and
a stop frequency of 200kHz. Click OK and then exit the setup window.
❑ Click on the simulate button . Then click on the add trace button .
❑ Select the output variables to plot. In the case of this filter the output is on node 2.
❑ Compare the simulation results to your hand computed analysis from the pre-lab.
❑ As a reminder the cut frequency for low pass or high pass filters is given by:

1
𝑓𝑐 =
2𝜋𝑅𝐶
EECE 321 Lab 2: Circuit Simulation with SPICE
Page 6 of 10

MULTISIM

❑ In Multisim to simulate an AC source you can use either the AC_Power Source or
the AC_Voltage source, the former uses RMS and the latter peak voltage. Look for
an AC source and place it in the schematic.
❑ Place the rest of the components and wire the circuit appropriately.
❑ To run an AC Analysis, select Simulate > Analyses > AC Analysis
❑ Make sure the frequency dialog box has the appropriate parameters selected:
decade sweep type, 10 pts/decade, start frequency of 10Hz and a stop frequency of
200kHz. Click OK and then exit the setup window. Make Vout the only output in
the output box. Finally click the Simulate button as before.
❑ Put the cursor in the graph and right click to get the menu show. From there you
can turn the grids on or off, add cursors, etc. You can also choose Properties and
change the axes of the graphs. Use File->Print to print the Bode plot.

Figure 4 – MULTISIM Bode Plot

5. DC Analysis Simulation

Figure 5 – Diode Based Circuit for DC Analysis

For this circuit wish to sweep the dc voltage source from -2.5V to 2.5V with 0.1V
increments and plot the output voltage across the resistor as a function of the input.
EECE 321 Lab 2: Circuit Simulation with SPICE
Page 7 of 10

PSPICE

❑ For this circuit we will use a 1N4002 rectifier diode. This a very common rectifier
diode. Look for it in the component menu and place it
❑ Place the rest of the components and wire them. Remember to place a ground!
❑ Enumerate all the nodes and then proceed to configure a DC Sweep in the analysis
setup window . In the DC sweep window, select the swept variable type and
write the name of the voltage source to be swept, the start time, end time and
increment value.
❑ Click on the simulate button . Then click on the add trace button .
❑ Select the output variables to plot. In this case the output is on node 2.
❑ At what voltage does the diode start conducting?
❑ Compare the simulation results to your hand computed analysis from the pre-lab.

MULTISIM

❑ Place all the components and wire them like in previous examples.
❑ To run a DC Analysis, select Simulate > Analyses > DC Sweep
❑ Select the source you want to sweep, and input start, end and increment values
❑ In the Output tab select the variables to plot for the analysis.
❑ Click the simulate button to observe the DC transfer characteristic.
❑ Multisim allows you to plot different dimensions in the same graph by enabling the
secondary axes. This can be configured from the graph properties window. Can you
plot the current and the voltage across the resistor by using auxiliary axes?

6. Transient Analysis Simulation

Figure 6 – Half Wave Rectifier Circuit for Transient Analysis

In this Half wave rectifier, we want to determine the time response of the circuit and plot
the output voltage across the resistor as a function of time.
EECE 321 Lab 2: Circuit Simulation with SPICE
Page 8 of 10

PSPICE

❑ For transient Analysis in PSPICE the Voltage Source used should be VSIN. Search
for it in the get new part menu and place it. Then double click on it and its attribute
window will appear. Notice that this part does have a frequency, attribute contrary
to VAC used in the AC analysis. This is because in a transient analysis simulation
the frequency of the source must be a defined attribute.
❑ After placing the VSIN source, double click on it to open the attribute window.
VOFF is the dc offset voltage, for this example we want it to be zero. VAMPL is
the peak voltage, set it to 5V. FREQ is the frequency, we will use 1kHz. Save the
attributes and close the window.
❑ Place the rest of the components and wire them. Remember to place a ground!
❑ Enumerate all the nodes and then proceed to configure a transient analysis in the
analysis setup window . In the transient window, select the print step to 1us and
the final time to 2ms. This final time will allow us to see two complete cycles.
❑ Click on the simulate button . Then click on the add trace button .
❑ Select the output variables to plot. In this case the output is on node 2.
❑ Why is the amplitude of the rectified peak less than the amplitude of the source?
❑ Compare the simulation results to your hand computed analysis from the pre-lab.

MULTISIM

❑ Place all the components and wire them like in previous examples.
❑ To run a transient Analysis, select Simulate > Analyses > >Transient Analysis from
the top menu bar. Change the End Stop Time (TSTOP) to 0.002 as shown below.

Figure 7 – MULTISIM Transient Analysis window

❑ Next choose the Output tab and select the signal(s) you want to see on the output.
❑ Click the simulate button to observe the DC transfer characteristic.
EECE 321 Lab 2: Circuit Simulation with SPICE
Page 9 of 10

7. Further Exploration

If time permits, practice some more with either simulation tool:

a) For the following Peak Rectifier Circuit provide a plot of the output voltage across the
resistor. Use a 5V and 1kHz sinusoid as the input signal:

Figure 8 Peak-Rectifier/Detector Circuit

b) In the following high pass filter use a bode plot to estimate the cut frequency:

Figure 9 High Pass Passive Filter

c) Provide the DC transfer characteristic in this circuit containing a Zener Diode:

Figure 10 Zener Diode Circuit


EECE 321 Lab 2: Circuit Simulation with SPICE
Page 10 of 10

8. Post-Lab Analysis

Write a brief summary report for this lab. Be sure to also include the following topics:

Compare the results from your pre-lab computations to the PSPICE models you created.
Record your findings in your lab notebook

Include print outs of the code, circuit diagrams with nodes labeled and simulation results.

Explain any difficulties you had with this lab. (Please include suggestions to improve the
lab, if you have them).

You might also like