You are on page 1of 35

Lahore University of Management Sciences

School of Science & Engineering

EE 241 Introductory Electronics Lab


EE-241

OrCAD PSPICE Tutorial


O tli
Outline
 Introduction
 Circuit Drawings
 Circuit Simulations
 Simulation Results
 Exercises
 Conclusion

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 2


Wh t iis SPICE
What
“Simulation
Simulation Program with IC Emphasis
Emphasis”

- It is a language to represent circuit drawings in text


form

- Either you can write a spice code or you can use a


graphical interface circuit drawing software

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 3


Why do we need SPICE?

 to provide reasonably detailed analysis of circuits


containing the following:

– Passive components (resistors, capacitors, inductors)

– Active devices (diodes,


(diodes transistors: BJT’s
BJT s and FET’s)
FET s)

– Independent and dependent voltage/current sources

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 4


O CAD Capture
OrCAD C t CIS
 OrCAD is the software
we will be using to
simulate circuits
 It automatically
creates a SPICE code
 This tutorial is based
on OrCAD 15.7 demo
version

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 5


C ti
Creating a new project
j t
File>>New>>Project

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 6


O CAD
OrCAD

Schematics Window: Here


you will draw your circuit
schematics

Toolbar

Session Log: All the activities and


errors and reported here

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 7


C ti
Creating Schematics
S h ti

Click: Place>>Part OR use the “Place Part” button from the toolbar
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 8
Addi
Adding Libraries
Lib i

 If no parts are visible in the “Place Part” dialog, simply click on the “Add Library” button
 Default library location folder is
C:\OrCAD\OrCAD_15.7_Demo\tools\pspice\library
 Inside the Browse File dialog, click on any *.olb file then press Ctrl+A to select all the files
and hit the “Open File” button
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 9
COMMONLY USED SOURCES
Source Library
 VDC DC S Sweep AAnalysis
l i
 VAC AC sweep Analysis

 VSIN
S Transient
a s e t Analysis
a ys s
 VPULSE Transient Analysis

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 10


Pl i
Placing Parts
P t

 Place your desired circuit components from their respective libraries


 D bl li k on th
Double-click the component’st’ parameters
t to
t change
h th
their
i values
l
 Pay special attention to the suffixes, 1Meg, (more on this on the next slide)
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 11
SPICE S
Suffixes
ffi
Scale Suffix Meaning
g Scale Factor Unit Suffix Meaning
T tera 10^ 12 V Volts
G giga 10^ 9 A Amps
Meg
g mega
g 10^ 6 Hz Hertz
et
k kilo 10^ 3 Ohm Ohms
m milli 10^ -3 H Henry
u micro 10^ -6 F Farads
n nano 10^ -9 Degree degrees
p pico 10^ -12
f femto 10^ -15

-Warning: Do not confuse “Meg” & “M” SPICE will interpret “M” as “m” or “milli”

-Becareful!! writing just “1F” will mean “1 femto” and not “1 Farad”

-Unit suffixes are optional, SPICE does not need them, e.g. If you need 10 kilo Hertz frequency,
for SPICE you only need to write 10k but for your own convenience you may write 10k Hz
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 12
S h
Schematic
ti
Place>>Wire
- Use
U wirei ttooll tto complete
l t
your schematic

Place>>Ground
Pl G d
- Remember we always
need a ground in the
circuit.
circuit
- The ground we will use is
the “0/SOURCE” - It’s a good practice to label
identified by the symbol your nodes
d b by clicking
li ki
shown in the schematic Place>>Net Alias
- It helps to plot results

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 13


Ci
Circuit
it Simulations
Si l ti
PSpice>> New Simulation Profile

You can later change your


simulation profile settings by
PSpice>>Edit Simulation Profile

For this e.g. set “Run to time” for


400secs considering our wave
period is 200secs. This will plot
us two complete cycles 14
LUMS, EE-241 Introductory Electronics Lab, Fall 2009
Si
Simulation
l ti Results
R lt
PSpice Run
PSpice>>Run

If there aren’t any errors


in the circuit, automatically a
similar window should pop-up.

Otherwise, errors would be


reported in the session log
Window.

You can also manuallyy


open sim results by clicking
PSpice>>View Simulation
Results

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 15


Plotting the Results

– choose the variable to be plotted


on Y-axis
Y i
–different arithmetic operations can
also be performed for e.g.
V(O t)/V(I ) i.e.
V(Out)/V(In) i gaini

Click: Trace>> Add Trace LUMS, EE-241 Introductory Electronics Lab, Fall 2009 16
V lt
Voltage/Level
/L l Marker
M k
- With time you will Click to display
find it tedious to bias point results

repeat the same


steps to add traces
Marker Options
Voltage/Level Marker

- You may also place


a “Voltage/Level
Voltage/Level
Marker” where you
want to observe your
results and it will
automatically plot
the trace for that
point
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 17
Pl t Obt
Plot Obtained
i d

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 18


A i Settings
Axis S tti
 Axis settings can be
changed by double clicking
on either x or y axis

 X axis variable can also be


changed from “Time” to for
instance “Vin”
Vin

 In your Op-Amp exercise


you will be asked to plot
Vout vs. Vin, there you will
use this function

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 19


C
Cursors and
dLLabels
b l
- Click “Add Cursor”

- To move the cursor


click anywhere on the Add Cursor
plot
l t and
dddrag th
the
Mark
mouse pointer Different
Label
Types of
Cursors

- Set
S t the
th cursor to
t the
th
X value
desired point and click
Y value
“Mark Label”

- Click “Add Cursor”


again to get out of the
cursor mode

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 20


So far we have learnt the basics of how to build
and simulate circuit schematics.

We also obtained simulation results for


“Transient Analysis” i.e. time domain analysis.

In the following slides we will discuss the other


types of analysis
analysis.
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 21
T
Types off Analysis
A l i
Click: PSpice>>Edit Simulation Profile
Select you desired analysis type from the drop down
menu

– DC Sweep: sweeps the DC source to obtain the


corresponding
p g DC outputs
p

– AC Sweep/Noise, sweeps the frequency to obtain


the frequency response

”Sweep
Sweep Type”
Type can be a linear sweep (LIN)
(LIN),
logarithmic (DEC)

– Bias Point: calculates DC node voltages and DC


currents flowing through DC voltage sources

**SPICE has a peculiar omission… it does not give REMEMBER!! To run any analysis type
you every branch current, only currents through make sure you have connected its
g sources, to g
voltage get around this, if yyou need a corresponding sources, refer to slide 10
branch current, just add a dummy 0V voltage source!

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 22


AC R
Response

AC response, using an AC source 23


LUMS, EE-241 Introductory Electronics Lab, Fall 2009
Diode Exercise

1
1. Setup the diode circuit as
shown (refer to Lab 2)
2. Run DC Sweep Analysis
from -10
10 to +10 V and
plot Vout vs. Vin
3. Build the circuit to limit
voltage
lt b t
between -2
2 & +2 2
volts
4. Run Transient analysisy
and plot the output
5. Display Bias Points on
the schematic

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 24


P
Parametric
t i Sweep
S
Sweeps circuit parameters
parameters,
for e.g. variable resistance

- Give any name to the value


yyou want to sweep,p, enclosed
in curly brackets e.g.
{R_var}, {} means it is a
global
l b l parameter
t and d&
R_var could be any name of
your choice

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 25


P
Parametric
t i Sweep
S Contd.
C td

Place a new part on the drawing called “PARAM” (from the SPECIAL
library.). Double-click its body to open its property sheet.
Within the property sheet editor,
· Select the “OrCAD-PSpice” Filter to make it easier to see the
important fields.
· Click the “New
New Column
Column” button and add a column called R R_var.
var Set
its value to 1k
Make sure to set R_var visible by highlighting it and clicking the
“Display” button
Under display format, select “Name and Value”
· Close the property sheet.
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 26
P
Parametric
t i Sweep
S Contd.
C td
Your drawing should now look like this
this…

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 27


P
Parametric
t i Sweep
S Simulation
Si l ti
Click: PSpice>>Edit
p Simulation
Profile

Under Options, check


Parametric Sweep p

Select Global Parameter

Enter the required fields

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 28


Di d Rectification
Diode R tifi ti Exercise
E i
1
1. Build the diode rectification circuit from Lab 2

2. Use, R=1k, C=1uF and Vampl=5V

3. Simulate your circuit to obtain different


ripples with different time constants.

HINT: Use parametric sweep


LUMS, EE-241 Introductory Electronics Lab, Fall 2009 29
O A
OpAmp E
Exercise
i

1. Build the OpAmp circuit from Lab3. (This IC is named as uA741)


2. Run transient analysis and plot Vout vs. Vin
3. Use your plot to find OpAmp’s gain

**Note how “Net Alias” is being used to reduce wire routings


LUMS, EE-241 Introductory Electronics Lab, Fall 2009 30
C
Conclusion
l i
By the end of this Lab Session you should
know how to
I
I. Draw and Simulate Schematics
II. Run Tran, AC, DC & .OP analysis
III
III. Perform parametric sweep

And you should have obtained four plots as shown


on the following slides.

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 31


Di d DC S
Diode Sweep

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 32


Li it Circuit
Limiter Ci it

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 33


Diff
Different
t Ti
Time C
Constants
t t

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 34


VTC off O
OpAmp
A

As you can observe there are two slopes, this phenomenon is called
hysteresis. It is added to the circuit to retain the voltage level within
the designed threshold.
For more details look for it online also search for “Schmitt Trigger”
LUMS, EE-241 Introductory Electronics Lab, Fall 2009 35

You might also like