You are on page 1of 6

Physics 160

Practical Electronics

Spring 2012

PSpice Tutorial
This is a tutorial designed to guide you through the simulation assignment included in the first homework set. You may either use the program as installed in the lab on one of the Windows PCs, or you may install it on your own computer. This note describes use of the latest version of the software. You can also obtain an old Version 9.1 program from a link in the course eCommons site, but note that I had trouble trying to use it with Windows 7. Installation Go to http://www.cadence.com/products/orcad/pages/downloads.aspx and scroll down to where it says Download FREE - OrCAD 16.5 Demo Software (495MB) and click on that link. You will have to follow the instructions to establish a free account with CADENCE in order to complete the download. You will then come to a page to select what to download. Select OrCAD 16.5 Demo Software (Capture and PSpice only). The download will be a .zip file from which you have to extract everything. Disable your virus protection software and then go to the area where you unzipped the installation files and double click on setup.exe. Follow the instructions to install the program. See the Physics 160 eCommons site for more information on the PSpice installation. Making a New Project and Schematic First, make a new empty folder on your computer where you want all the files for this project to be stored. Then, start up the program OrCAD Capture CIS Demo. On the File menu, select New Project. In the New Project dialog box, give the project a name, such as hw1, and use the Browse button to find your folder. Then, be sure to click Analog or Mixed A/D under Create a new project using. Finally click OK and then youll get a box labeled Create Pspice Project with two choices. Select Create a blank project and then click OK. The new project will be opened with two windows, one labeled hw1.opj, which shows all the files in the project, and another labeled Schematic 1 : Page 1. We are going to work here with the schematic window, so go ahead and maximize it. Go to the Place menu and select Part. In the Place Part dialog box under Libraries click on the Add Library button (which is not labeled but looks like a dotted rectangular outline to the left of the delete symbolif you place the cursor over it you will see Add Library). A Browse File dialog box will pop up. Open the folder named Pspice in this dialog box (it may already be open) and then double click on analog.olb. Click Add Library again and this time double click on source.olb. This will give you enough parts to work with for this project, at least. Now, still in the Place Part dialog box, click on SOURCE in the Libraries list (it may already be selected) and then scroll down through the Part List and click on VAC and then click on the Place Part icon (an 8-legged chip with a + in one corner) or just hit Enter. Then you will see that the cursor has a part attached to it. Move the cursor to where you

Physics 160

Practical Electronics

Spring 2012

want the part to be and then single click. Finally, hit the Esc key on your keyboard to get back the normal cursor. Next, in the Place Part dialog box click on ANALOG in the Libraries list. Scroll down through the Part List and click on R followed by Enter. This time, place two resistors before hitting Esc. Note that you can rotate the part before placing it by hitting ctrl-R, or you can rotate it afterwards by clicking it to highlight it and then selecting Rotate on the Edit menu. Similarly, place a capacitor (C) and an inductor (L) on your schematic. Arrange the parts neatly by clicking and dragging, more-or-less as shown on the schematic in the homework assignment. Now wire the parts together as follows. In the Place menu, select Wire. You will see the cursor change to a +. Put the cursor on a node of one part and then move it to the node of another part and click to wire them together. You can also click in-between parts to nail down the wire at a corner, for example, and you can click on top of another wire to connect two wires together. Hit the Esc key to stop making wires and get back the arrow cursor. It can be tricky to be sure that all the wires are connected. If one is not connected, drag it a little bit to a connect point, and with some luck it will connect. To see whether a part is really connected, you can click on it and drag it a little bit. If the wires are connected, then they will follow with the part. Connections between wires should be marked with a heavy dot. If two wires cross, they are not connected unless there is such a dot at the intersection. It is a good practice in drawing schematics never to make a connection where two wires cross. Instead, only connect wires at T intersections and there will be less likelihood of confusion. Be careful not to draw a wire on top of a part, as that will short out the part, and the wire may be hard to see. Now, give each part its correct value, according to the homework assignment. For example, for the capacitor, click on the value (1n) and enter 20uF (the F is not required, as Spice always works in Farads for capacitance, and the u is the Spice symbol for micro). Leave the source as 1 Vac, but for illustration, also give it 0.1 Vdc. Now, PSpice is very particular about there being a node defined as Ground, and it must be named 0. If you dont do this, then it will give you many error messages about floating nodes. So, go to the Place menu and select Ground. In the dialog box that pops up, choose 0/CAPSYM and then click OK. Place the symbol somewhere below the circuit and then connect it with a wire to the bottom wire of the circuit.

Physics 160
R1 6

Practical Electronics
R2 4
I V

Spring 2012

V1 1Vac 0.1Vdc C1 20uF

L1 2mH

Figure 1. The schematic, as drawn using Capture Student.

Now well add a couple of widgets that will tell PSpice what we want to look at in the circuit. Suppose we want to see the current going through the 6-ohm resistor (which is the same as the current through the source, of course). In the tool bar, click on the icon that looks like a scope probe with the letter I inside a green circle. The probe will appear on the cursor, so move it and attach it to one end of the resistor. Next, suppose we want to see the voltage on the node connecting the 4-ohm resistor to the inductor. Click on the probe with the letter V and attach that thing to the wire. Your completed schematic should look something like what you see in Figure 1. Simulating Your Schematic Now you have to tell PSpice what kind of simulation you want done on your circuit. Go to the PSpice menu and select New Simulation Profile. (If you dont see a PSpice menu, then you did not follow the instruction above to create an Analog or Mixed A/D project.) In the resulting dialog box give it a name, such as ACanalysis. In the resulting Simulation Settings dialog box select the Analysis tab, and under Analysis type select AC Sweep/Noise. Under AC Sweep Type select Logarithmic, and then enter the Start Frequency as 1, the End Frequency as 1E6 and the Points/Decade as 100. Then click OK. Now, go back to the PSpice menu and select Create Netlist. Then from the same menu select View Netlist. You dont have to do this in order to simulate, but I want you to see what the netlist is. What you should see is something looking nearly identical to Figure 2. This is a text representation of your circuit. It has one line for each part in your * source HW1 V_V1 N00013 0 DC 0.1Vdc AC 1Vac R_R1 N00013 N00019 6 R_R2 N00019 N00022 4 L_L1 0 N00022 2mH C_C1 0 N00019 20uF
Figure 2. The netlist generated from the schematic.

Physics 160

Practical Electronics

Spring 2012

circuit, and each line tells what nodes the part is connected to. The nodes all have names starting with N, except for the one we purposely named 0. Each line also gives the characteristics of the part. Understand that this netlist is what PSpice ingests. The PSpice program does not look at your schematic. You could have skipped the whole schematic exercise and entered the netlist by hand with a text editor. In fact, that is how people used to simulate circuits (and how a few old-fashioned engineers still do). Youll probably see lots of advantages of the graphical representation afforded by the schematic editor as you go along. Now, close the netlist or go back to your schematic. Then, go to the PSpice menu, and select Run. A PSpice window will pop open, which will show a plot of the circuit response versus frequency, as illustrated in Figure 3, where you see the current through R1 and the voltage on the right-hand-side node of R2. The current and voltage widgets that we placed on the schematic caused those two items to be plotted. Now, you can see that the PSpice window has lots of menus, and you can make use of them to plot anything else you may want to see, rerun the simulation, and so forth. To do those things, you can either interact directly with PSpice or else go back to the schematic, modify it, and then rerun PSpice. When you look at your schematic after running PSpice, you may see it updated with DC voltage readings, as shown in Figure 4. If not, then clicking on the big green OrCAD Capture toolbar button with a V in the center will turn on the DC bias voltage display. Similarly, clicking on the green I button will turn on a display of the bias currents. The W button will turn on a display of the DC power dissipated by each component. For

Figure 3. The PSpice output for the AC analysis.

Physics 160
R1 6
I

Practical Electronics
R2 40.00mV 4 0V
V

Spring 2012

100.0mV V1 1Vac 0.1Vdc C1 20uF L1 2mH

0V

Figure 4. The schematic after running the simulation. Note how the DC voltages have been marked on each of the nodes. These result from the 0.1Vdc setting of the source.

this circuit, the voltage display just shows the result of the 0.1 V DC current of the source divided by the two resistors. The capacitor and inductor have no effect on the DC response (the capacitor looks like an open circuit, and the inductor looks like a zero resistance wire). Transient Simulation Now that you have completed a simulation in the frequency domain (AC), try a simulation in the time domain (Tran). Modify your schematic as follows. Delete the AC voltage source by selecting it and hitting the Delete key. Then place a part from the Source library called VPulse where the AC source used to be. Fill in all of the values as shown in Figure 5. The meaning of the values is, respectively, the low voltage, the high voltage, the time delay before the pulses turn on, the rise time, the fall time, the width of each pulse, and the period of the repetition. Weve set it up to produce something like a clock signal with a period of 1 ms and rise and fall times of 0.05 ms. Then, attach voltage monitor widgets as shown in the figure. Now, to go to the PSpice menu and select New Simulation Profile. Give the new profile a name something like
R1 6
V

R2 4
V

V1 = 0 V2 = 0.5 TD = 1m TR = 50u TF = 50u PW = 0.45m PER = 1m

V2 C1 20uF

L1 2mH

Figure 5. The schematic as modified for doing a transient analysis.

Physics 160

Practical Electronics

Spring 2012

Figure 6. Result of the transient simulation.

HW1Tran and set the analysis type to Time Domain (transient), and set the Run to time to 3m. Click OK and then run the simulation. You should see a PSpice display very close to what is shown in Figure 6, where you see plotted both the input clock-like pulses, exactly as we defined it, and the corresponding butchered output pulses (the voltage across the inductor). So, by now youve essentially completed the simulation in the first homework assignment. There will be more to come, however, especially including transistors, so I encourage you to play around with this software and get familiar with it. You should have some fun with it. Change the component values around and see if you can understand what it does to the frequency response. What happens if you feed it an input clock-like square wave with a period equal to the resonance frequency versus far above or below resonance? What if you input a step function with zero rise time? What if you input a sharp spike? Make up your own circuits and try them out. With the simulation there is no danger of blowing a fuse or smoking a part, so dont be afraid to be creative.

You might also like