ECEN 2250 - Circuits/Electronics 1

Spring 2008, Lucas Portelli/Garret Moddel

LAB #3


Introduction to PSpice

Note: This lab based on earlier labs authored by M. Lightner, G. Moddel, D. Meyer, P. Mathys and modified by Lucas Portelli and Garret Moddel


Quick Links


Goals of this Lab


1. Introduction ---READ THROUGH BEFORE STARTING WITH THE PRE-LAB & THE EXPERIMENTS---

1. Introduction

Background. SPICE (Simulation Program with Integrated Circuit Emphasis) is an engineering design tool for analog circuit simulation. It was developed at the University of California, Berkeley, in the 1970's. Because the program was released into the public domain with almost no charge, it quickly became an industry standard simulation tool. SPICE was originally programmed in Fortran and initially used only on mainframe computers without a graphical user interface. Thus, the underlying input/output mechanism of SPICE is entirely text-based. As an example, a simple voltage divider consisting of an ideal 10 V voltage source connected to a 3.3 kohm and a 2.2 kohm resistor in series would be described in SPICE by a netlist as follows.

 
VOLTAGE DIVIDER
V1         1 0 10Vdc
R1         1 2  3.3k
R2         2 0  2.2k
.END

PSpice is an adapted version of SPICE, developed by MicroSym Corporation in 1984, that is intended to be run on PCs, Macintoshes and workstations. MicroSym also added a graphical user interface called "Schematics" that allows users to describe circuits graphically, rather than in the form of a text-based netlist. The name PSpice was changed to PSpice A/D when it became possible to simulate circuits that contain both analog and digital devices. MicroSym was acquired by Orcad (which was in turn acquired by Cadence). Orcad improved the graphical user interface and changed its name from "Schematics" to "Capture". The Orcad Family Release 9.2 Lite Edition is a (almost) fully functional evaluation version (the main limitation is circuit size) that includes Capture CIS, PSpice A/D and Layout Plus. Using these three programs, schematics of a circuit can be drawn, the circuit can be simulated, and a PCB (printed circuit board) layout can be generated. The full version of PSpice A/D has model libraries for over 10,000 analog devices and nearly 2000 digital devices.

Basics. When you generate a circuit for later analysis with PSpice, you need to follow the following important conventions:

In a nutshell, here is how you enter a schematic and run a PSice simulation. Start the schematic capture program by clicking on "Orcad Family Release 9.2 Lite Edition" and select "Capture CIS Lite Edition" or "Capture Lite Edition". In the Orcad Capture window click on "File", "New", and "Project...". Specify a filename and a folder location and make sure the "Analog or Mixed A/D" radio button is checked as shown below.

On the next screen select "Create a blank project".

To draw a schematic, click on "Place" and select "Part...". Depending on the parts you need you may have to add libraries from the "Library\PSpice folder". The following figure shows the most important parts and the names of the libraries that contain the parts.

For example, to select a dc voltage source, click on "Place", select "Part...", then select the "SOURCE" library, and finally select the "VDC" part.

Next, click "OK" and place the part in the schematic. To exit placement mode, right-click and select "End Mode". Resistors are in the "ANALOG" library as shown in the screen snapshot below

If a part needs to be mirrored and/or rotated in the schematic, select it and then right-click on it. Choose the action to be performed on the menu window that pops up.

At least one PSpice ground is needed in a schematic (otherwise PSspice will complain about floating nodes). To place a ground symbol, click on "Place" and then select "Ground". The PSpice ground is located in the PSpice SOURCE library as shown below.

To wire the schematic, click on "Place" and select "Wire". or click on the "Wire" button on the right side of the Capture window.

Be careful when you connect wires to parts that you don't accidentially shorten the part. The first figure below on the left shows a shorted resistor and the second figure on the right shows a correctly wired resistor.

  

To change the value of a part, double click on the value to be changed and enter the new value in the window that pops up as shown below for a dc voltage source.

Numerical values for parts can be integers (5, -12, 15) or real numbers (-1.75, 3.1415, 0.7071). In either case the numbers can be followed by an integer exponent (1E6, 2.2e-9) or by a symbolic scale factor (530u, 1.2meg). These scale factors are summarized in the following table.

Letter Suffix

Multiplying Factor

Name of Suffix

T or t

1e12

tera

G or g

1e9

giga

MEG or meg

1e6

mega

K or k

1e3

kilo

M or m

1e-3

milli

U or u

1e-6

micro

N or n

1e-9

nano

P or p

1e-12

pico

F or f

1e-15

femto

Letters which are not scale factors and which immediately follow either a number or a scale factor are ignored. Thus, 12, 12V, 12A, 12Hz, 12H all represent the same number. Similarly 3.3m, 3.3mOhm, 3.3mV, 3.3MOhm all represent the number 3.3e-3 or 0.0033. Note: A resistor value of 3.3 megaohm is entered in PSpice as 3.3meg or 3.3megohm or 3.3MEGohm, but not as 3.3MOhm (this would be interpreted as 3.3 milliohm).

Bias Point. The following schematic is an example of a voltage divider in Orcad Capture.

The simplest PSspice analysis is a "Bias Point" (or dc bias) analysis. Click on "PSpice" and select "New Simulation Profile". Enter a filename and leave "Inherit From:" set to "none" as shown below.

Click "Create". In the next window select "Analysis type: Bias Point". Leave default values for everything else as shown in the next figure.

Now click on "PSpice" and select "Run" or click on the "Run" button in the menu bar at the top. A new window will pop up with some information about the PSpice Simulation that was just run. The main result of a "Bias Point" analysis are voltages, currents, and powers for all elements in the circuit, as shown below (note that the "V", "I", "W" buttons on the menu bar are pushed in to show voltages, currents, and powers, respectively).

As can be seen, the voltage source delivers 533.3 mW (-533.3 mW using passive sign convention) of which 296.3 mW are dissipated in R1 and 237 mW are dissipated in R2. The current flowing around the loop is 44.44 mA and the output voltage of the voltage divider (across R2) is 5.333 V.

There are 4 basic types of PSpice simulation:

This lab focuses on "Bias Point", "DC Sweep", and a little bit of "Time Domain" analysis. More about "Time Domain" and "AC Sweep" analysis will appear in later labs.

DC Sweep. Suppose now that a load is connected to the output of the voltage divider as shown below.

A bias point analysis reveals that the voltage across the load resistor is 5 V and the current through the load resistor is 5 mA. But suppose now that the 12 V battery voltage is not constant (e.g., depending on whether the battery is being charged or discharged) but the load (which might be a digital logic circuit) can only operate within a ±10% tolerance of 5 V. Thus, it is of interest to determine the voltage across the load as the 12 V power supply is sweeping over a range of voltages, say from 8 V to 16 V. To run this simulation in PSpice, click on the voltage marker button in the top menu and place a voltage marker on the load resistor as shown below.

Click on "PSpice" in the menu and select "New Simulation Profile". Enter a name for the simulation, e.g., V1_sweep and click on "Create". In the next screen select "DC Sweep" for the Analysis type and fill in the other fields as sown below.

If you run a PSpice simulation with these settings, then the voltage of the battery V1 is sweeping from 8V to 16V in 0.1V increments. After running this simulation you will see a screen similar to the following.

The graph at the top (Simulation Results) shows the voltage at the voltage marker (across the load resistor) versus the voltage V1 of the VDC voltage source. The small window at the lower left (Output Window) is a log of events that ocurred during the PSpice simulation. The window at the lower right (Simulation Status Window) shows the simulation analysis parameters. To view only the Simulation Results in a larger graph, click on "View" and then select "Alternate Display" as shown next.

The resulting graph is shown in the figure below.

To determine the values of V1 that correspond to 5V ±10% across the load precisely from the graph, click on "Trace" and then select "Cursor" and "Display" as shown next.

Now move the first cursor (hold down left mouse button) to 5V -10% and the second cursor (hold down right mouse button) to 5V +10% on the vertical axis. The result should look as follows.

Now it is easily found that for V1 in the range 10.805 ... 13.208 volts the output voltage from the voltage divider is 5V ±10%.

Parameter Sweep. Another scenario of interest is to keep the V1 voltage fixed at 12V, but to vary the load current (a load like a digital logic circuit doesn't use the same amount of current in all states). In order to simulate this in PSpice, the load resistance is made into a parameter that can be varied by a DC Sweep analysis. To implement this, start from getting a PARAMETER block (PARAM in the SPECIAL library) as shown below.

Place the block anywhere in the schematic, e.g., as shown here.

To place a parameter in the PARAMETER box, select it (click left mouse button on PARAMETER), then right-click and choose "Edit Properties..." as shown in the following screen snapshot.

This should open the "Property Editor" for the PARAMETER block as follows.

Click on "New Column..." to create a new parameter entry. This will open the "Add New Column" dialog box.

Enter RL for the name of the parameter and 1k for its value as shown above. Click "OK" and then a new column for RL will appear in the Property Editor.

At this point RL is defined and the association between RL and the value of 1k is established. But to make this visible in the schematic, the "Display Properties" of the RL column need to be modified. Make sure the RL column is selected and then click on "Display..." to get the following dialog box.

Click on the radio button next to "Name and Value" under Display Format as shown in the figure above. Click "OK" and then exit the Property Editor. Now the schematic should look as follows.

The next step is to associate the value of the load resistor R3 with the parameter RL. For this R3 needs to be selected and then its properties need to be opened in the Property Editor (left-click on R3 to select it, right-click on the selected part to be able to open the Property Editor). Here's a screen snapshot of what you should see.

Change the numerical value of 1k to the symbolic variable {RL} (note the curly braces which tell PSpice to evaluate the expression rather than interpret it as a number).

Close the property editor. After adding a voltage marker at the the output of the voltage divider the schematic is ready for PSpice simulation and looks as follows.

Click on "PSpice", select "New Simulation Profile" enter a name, e.g., RL_sweep, and then fill in the Simulation screen as shown in the next figure.

Note that now the global parameter RL is the sweeping parameter in the range from 400 ohms to 1600 ohms with 10 ohm increments. The result of the simulation, in the form of a graph plotting output voltage versus load resistance, is given below.

As can be seen, the output voltage stays well within ±10% of 5V over the range 400...1600 ohms of RL.

Suppose you want to see the graph of another variable in the circuit, e.g., the current through resistor R2 in the voltage divider circuit. Click on the "Trace" menu item at the top of the simulation result window. Then you can either select "Add Trace..." to add another trace to the current graph, or "Delete All Traces" to start with a new graph from scratch. The latter case is shown in the figure below.

Now click again on "Trace" and select "Add Trace..." so that the following window pops up.

On the left all output variables from the simulation, which include the currents through all elements and the voltages across all elements, are listed. On the right a whole set of functions that can be applied to the output variables, such as addition (+), multiplication (*), logarithm (LOG), etc, are shown. For now choose I(R2) (current through R2) and I(R1) (current through R1) so that "Trace Expression" at the bottom reads I(R2) I(R1) and then click "OK". This yields the simulation result graph shown below.


2. Pre-lab Assignments:

No pre-lab this week.


3. Lab Experiments

HINT: Use the web when necessary. Complement your understanding of this lab in as many ways as you can find

E1. Resistor Array. Consider the following resistor array.

Are there any redundant resistors? What is the value of the equivalent resistance Req? Which resistor(s) dissipate most of the power? Find out using a PSpice Bias Point analysis.

E2. D/A Converter. The figure below shows the schematic of a 2-bit D/A (digital to analog) converter.

Because there are two SPDT switches, the circuit can be in four different states depending on the switch positions. Thus, you could run 4 Bias Point simulations in PSpice to analyze the behavior of the circuit. Another approach is to use two pulse sources of the kind shown below (VPULSE from the PSpice SOURCE library) to replace the switches.

The idea is then to run one pulse source twice as fast as the other one (corresponding to one switch being toggled at twice the rate of the other one) so that the circuit goes through all 4 possible states when a Time Domain Analysis is run in PSspice.

The meanings of the various parameters of the VPULSE source are shown in the figure below. V1 and V2 are the two voltage levels between which the output is switching. TD is the time delay from the start of the simulation to the beginning of the first pulse. TR and TF are the rise and fall times of the pulse, respectively. PW is the pulse width at the V2 level, and PER is the period of the (periodically repeated) pulse train.

A schematic to simulate the D/A converter using VPULSE sources in PSpice is shown in the next figure. The rise and fall times of the pulse sources are set to small values (1 ms) so that they are negligible.

Implement this schematic in Orcad Capture and then run a Time Domain PSpice analysis with the following parameters.

Make plots of the relevant quantities like the output voltage, the pulsed voltage signals, etc. What happens if the output is loaded, e.g., with a 1kOhm load resistor?

E3. T Attenuator. The following schematic shows a symmetric resistive T attenuator with input voltage vS, output voltage vO, and load resistance RL.

As the name suggests, T attenuators are used to attenuate input signals, e.g., for measurements of audio or RF (radio frequency) power amplifiers. Suppose you have two attenuators with attenuation factors A1 and A2 and you connect them in series (i.e., the output of the first attenuator is connected to the input of the second attenuator). A desirable feature for this scenario is that the overall attenuation A is equal to the product A1*A2. The condition for this to be true is that Req = RL which occurs whenever

The goal of this experiment is to design two T attenuators for a load resistance of RL = 600 ohm, one with attenuation A1 = 1/2 and one with attenuation A2 = 1/3 and then to verify that the overall attenuation is A = 1/6 when the two attenuators are used in series. Use a parameter sweep in PSpice and the following schematic to design the two T attenuators.

After you have designed your two attenuators, use PSpice to verify that their combined attenuation when they are connected in series and loaded with RL = 600 ohms is the product of the individual attenuations.

E4. LED Brake Light Design. The goal of this experiment is to design a LED replacement for the brake light of a car. The idea is to use several high intensity red LEDs in series so that they can operate from a 12V car battery.

In PSpice this LED can be modeled using the Dbreak part ("breakout diode") from the PSpice BREAKOUT library which is shown below.

After placing the part in the schematic, select it and then right-click on it as shown in the next figure.

Select "Edit PSpice Model" to see the model parameters of the Dbreak part as shown in the following snapshot of the "PSpice Model Editor"

 

 

The default settings are 1e-14 A for the reverse saturation current (Is) and 0.1 ohm for the series resistance (Rs). No explicit specification is given for the diode ideality factor (N). To model the hi intensity red LED, change the model parameters of the Dbreak part in the PSpice Model Editor using this parameters:

 

n = 2.11,    i0 = 3.83×10-17 A,   and   R = 2.9 ohms.

As follows:

Make an i-v plot after you changed the model parameters and compare it with the measured data given below to make sure you use the right model for the LED.

Measured (v,i) Pairs for Hi Intensity Red LED

v [V]

1.58

1.62

1.69

1.72

1.75

1.77

1.79

i [mA]

0.16

0.37

1.23

2.11

3.58

4.88

6.24

v [V]

1.81

1.84

1.86

1.89

1.91

1.93

1.95

i [mA]

8.14

11.67

14.57

19.62

22.4

26.0

29.5

For this Hi intensity LED the max forward current is 30mA.

If you are interested in what is the process to find the model parameters starting from this table, click here.

The design specifications for the red LED brake light replacement are as follows:

  1. Use as many LEDs in series as possible, while satisfying all other constraints.
  2. The nominal battery voltage of 12V can vary between 10V and 14V. The maximum current of 30 mA for the LEDs cannot be exceeded as the voltage varies over this range.
  3. Only passive components, such as a series resistor can be used for current limiting purposes.
  4. To guarantee visibility of the brake light under all conditions, the minimum current through the LEDs must be 12 mA over the range of 10V to 14V of the battery voltage.

Design a circuit that satisfies the above specifications and use PSpice to verify the correctness of your design.

 


4. Lab Worksheet

WARNING! Each student needs to turn in a lab worksheet. The raw measured data for each student in a lab team will be the same, but the conclusions drawn from it are individual to each partner in the team.

Click here to retrieve a copy of the LWS03.PDF

WARNING!! Raw data without any procedure or justification holds no grade value. DOCUMENT YOUR WORK PROPERLY.