orcad pspice tutorial lab3cyphynets.lums.edu.pk/images/orcad_pspice_tutorial.pdf · o cad c t...

35
Lahore University of Management Sciences School of Science & Engineering EE 241 Introductory Electronics Lab EE-241 Introductory Electronics Lab OrCAD PSPICE Tutorial OrCAD PSPICE Tutorial

Upload: others

Post on 17-Aug-2020

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Lahore University of Management Sciences

School of Science & Engineering

EE 241 Introductory Electronics LabEE-241 Introductory Electronics Lab

OrCAD PSPICE TutorialOrCAD PSPICE Tutorial

Page 2: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

O tliOutline

Introduction Introduction Circuit Drawings Circuit Simulations Simulation Results Exercises Conclusion

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

Page 3: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Wh t i SPICEWhat is SPICE“Simulation Program with IC Emphasis”Simulation Program with IC Emphasis

- It is a language to represent circuit drawings in text- 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

Page 4: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Why do we need SPICE?

to provide reasonably detailed analysis of circuitscontaining the following:

– Passive components (resistors, capacitors, inductors)

Active devices (diodes transistors: BJT’s and FET’s)– Active devices (diodes, transistors: BJT s and FET s)

– Independent and dependent voltage/current sources

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

Page 5: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

O CAD C t CISOrCAD Capture CIS OrCAD is the software OrCAD is the software

we will be using to simulate circuitssimulate 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

Page 6: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

C ti j tCreating a new projectFile>>New>>ProjectFile>>New>>Project

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

Page 7: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

O CADOrCAD

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

Page 8: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

C ti S h tiCreating Schematics

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

Click: Place>>Part OR use the “Place Part” button from the toolbar

Page 9: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Addi Lib iAdding Libraries

If no parts are visible in the “Place Part” dialog, simply click on the “Add Library” button Default library location folder is

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

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

Page 10: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

COMMONLY USED SOURCESCOMMONLY USED SOURCESSource Library

VDC DC S A l i VDC DC Sweep Analysis VAC AC sweep Analysis VSIN Transient AnalysisS a s e t a ys s VPULSE Transient Analysis

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

Page 11: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Pl i P tPlacing Parts

Place your desired circuit components from their respective librariesD bl li k th t’ t t h th i l

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

Double-click on the component’s parameters to change their values Pay special attention to the suffixes, 1Meg, (more on this on the next slide)

Page 12: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

SPICE S ffiSPICE SuffixesScale Suffix Meaning Scale Factor Unit Suffix Meaningg

T tera 10^ 12

G giga 10^ 9

Meg mega 10^ 6

Unit Suffix Meaning

V Volts

A Amps

Hz Hertzg g

k kilo 10^ 3

m milli 10^ -3

u micro 10^ -6

e t

Ohm Ohms

H Henry

F Farads

n nano 10^ -9

p pico 10^ -12

f femto 10^ -15

Degree degrees

-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”

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

-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

Page 13: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

S h tiSchematicPlace>>Wire

U i t l t l t- Use wire tool to complete your schematic

Pl G dPlace>>Ground- Remember we always

need a ground in the circuitcircuit.

- The ground we will use is the “0/SOURCE” identified by the symbol - It’s a good practice to label

d b li kiidentified by the symbol shown in the schematic your nodes by clicking

Place>>Net Alias- It helps to plot results

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

Page 14: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Ci it Si l tiCircuit SimulationsPSpice>> New Simulation ProfilePSpice>> New Simulation Profile

You can later change yoursimulation profile settings byPSpice>>Edit Simulation Profile

For this e.g. set “Run to time” for400secs considering our wave

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

400secs considering our waveperiod is 200secs. This will plotus two complete cycles

Page 15: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Si l ti R ltSimulation ResultsPSpice>>RunPSpice Run

If there aren’t any errorsin the circuit, automatically a similar window should pop-up.

Otherwise, errors would be reported in the session logreported in the session logWindow.

You can also manuallyyopen sim results by clickingPSpice>>View Simulation

Results

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

Page 16: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Plotting the ResultsPlotting the Results

– choose the variable to be plotted Y ion Y-axis

–different arithmetic operations can also be performed for e.g. V(O t)/V(I ) i i

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 16Click: Trace>> Add Trace

V(Out)/V(In) i.e. gain

Page 17: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

V lt /L l M kVoltage/Level Marker- With time you will Click to displayWith time you will

find it tedious to repeat the same steps to add traces

Click to display bias point results

steps to add traces

- You may also place a “Voltage/Level

Marker OptionsVoltage/Level Marker

a Voltage/Level Marker” where you want to observe your results and it willresults and it will automatically plot the trace for that point

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

point

Page 18: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Pl t Obt i dPlot Obtained

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

Page 19: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

A i S ttiAxis Settings Axis settings can be 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”instance Vin

In your Op-Amp exercise you will be asked to plotyou will be asked to plot Vout vs. Vin, there you will use this function

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

Page 20: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

C d L b lCursors and Labels- Click “Add Cursor”

- To move the cursorclick anywhere on thel t d d th

Add Cursor

plot and drag themouse pointer

S t th t th

Different Types of Cursors

Mark Label

- Set the cursor to thedesired point and click“Mark Label”

X value

Y value

- Click “Add Cursor”again to get out of the

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

cursor mode

Page 21: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

So far we have learnt the basics of how to buildSo far we have learnt the basics of how to buildand simulate circuit schematics.

We also obtained simulation results for“Transient Analysis” i.e. time domain analysis.

In the following slides we will discuss the othertypes of analysis

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

types of analysis.

Page 22: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

T f A l iTypes of AnalysisClick: PSpice>>Edit Simulation ProfileSelect you desired analysis type from the drop downSelect you desired analysis type from the drop down

menu

– DC Sweep: sweeps the DC source to obtain the corresponding DC outputsp g p

– AC Sweep/Noise, sweeps the frequency to obtain the frequency response

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

– Bias Point: calculates DC node voltages and DCcurrents flowing through DC voltage sourcescurrents flowing through DC voltage sources

**SPICE has a peculiar omission… it does not giveyou every branch current, only currents throughvoltage sources, to get around this, if you need a

REMEMBER!! To run any analysis type make sure you have connected its corresponding sources, refer to slide 10

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

g g ybranch current, just add a dummy 0V voltage source!

Page 23: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

AC RAC Response

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 23AC response, using an AC source

Page 24: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Diode Exercise

1 Setup the diode circuit as1. Setup the diode circuit as shown (refer to Lab 2)

2. Run DC Sweep Analysis from 10 to +10 V andfrom -10 to +10 V and plot Vout vs. Vin

3. Build the circuit to limit lt b t 2 & 2voltage between -2 & +2

volts4. Run Transient analysis y

and plot the output5. Display Bias Points on

the schematic

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

the schematic

Page 25: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

P t i SParametric SweepSweeps circuit parametersSweeps circuit parameters, for e.g. variable resistance

- Give any name to the value you want to sweep, enclosed y p,in curly brackets e.g. {R_var}, {} means it is a

l b l t d &global parameter and & R_var could be any name of your choice

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

your choice

Page 26: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

P t i S C tdParametric Sweep Contd.

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 Column” button and add a column called R var Set· Click the New Column button and add a column called R_var. Set

its value to 1kMake sure to set R_var visible by highlighting it and clicking the

“Display” button

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

Under display format, select “Name and Value”· Close the property sheet.

Page 27: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

P t i S C tdParametric Sweep Contd.

Your drawing should now look like thisYour drawing should now look like this…

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

Page 28: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

P t i S Si l tiParametric Sweep SimulationClick: PSpice>>Edit Simulation p

Profile

Under Options, check Parametric Sweepp

Select Global Parameter

Enter the required fieldsEnter the required fields

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

Page 29: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Di d R tifi ti E iDiode Rectification Exercise

1 Build the diode rectification circuit from Lab 21. 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

HINT: Use parametric sweep

Page 30: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

O A E iOpAmp Exercise

1. Build the OpAmp circuit from Lab3. (This IC is named as uA741)2. Run transient analysis and plot Vout vs. Vin3. Use your plot to find OpAmp’s gain

LUMS, EE-241 Introductory Electronics Lab, Fall 2009 30**Note how “Net Alias” is being used to reduce wire routings

Page 31: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

C l iConclusionBy the end of this Lab Session you shouldBy the end of this Lab Session you should know how to I Draw and Simulate SchematicsI. Draw and Simulate SchematicsII. Run Tran, AC, DC & .OP analysisIII Perform parametric sweepIII. Perform parametric sweep

And you should have obtained four plots as shownAnd you should have obtained four plots as shown on the following slides.

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

Page 32: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Di d DC SDiode DC Sweep

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

Page 33: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Li it Ci itLimiter Circuit

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

Page 34: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

Diff t Ti C t tDifferent Time Constants

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

Page 35: OrCAD PSPICE Tutorial Lab3cyphynets.lums.edu.pk/images/OrCAD_PSPICE_Tutorial.pdf · O CAD C t CISOrCAD Capture CIS OrCAD is the softwareOrCAD is the software we will be using to simulate

VTC f O AVTC of OpAmp

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

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

the designed threshold. For more details look for it online also search for “Schmitt Trigger”