Lesson 2 - Circuit SimulationWhile extremely instructive and interesting, it is not always easy to go to the lab, the test equipment may not be available or not capable of the particular tests we want to do, and it may be difficult or impractical to see the effects of extreme conditions such as extreme temperatures or extreme supply voltages. Also the choice of parts may be limited, so it may be impossible to verify the operation of a circuit when component values are at the edge of their specifications. For these reasons, and since the appearance of affordable personal computers, engineers and designers have been relying on simulation software running on a personal computer to simulate and optimize the operation of their designs before building the actual hardware. Since this is an on-line class, we will be using a circuit simulation software in this and the following chapters. Spice Simulation SoftwareSPICE is a general-purpose circuit simulation program for nonlinear dc, nonlinear transient, and linear ac analyses. Circuits may contain resistors, capacitors, inductors, mutual inductors, independent voltage and current sources, several types of dependent sources, transmission lines, switches, and the five most common semiconductor devices: diodes, Bipolar Junction Transistors (BJTs), Junction Field Effect Transistors (JFETs), Metal-Semiconductor Field Effect Transistors (MESFETs), and Metal Oxide Semiconductor Field Effect Transistors (MOSFETs.)SPICE originates from the EECS Department of the University of California at Berkeley, http://bwrc.eecs.berkeley.edu/ Spice is the oldest (updated regularly) and best known circuit simulation software. It is essentially free (check the link above for details) and the basic engine has been used as the basis of many commercial software implementations that provide convenient front-end, schematic capture, printing tools and libraries of parts. While we could be using the Berkeley SPICE package, we will instead use another free version designed by a semi-conductor company, Linear Technology, called SwitcherCAD (c). Log on to the download page of the company web site, download and install the software before continuing the course. SwitcherCAD is copyright of Linear Technology. The SwitcherCAD software is intended to facilitate the application of products designed and manufactured by Linear Technology, but the tool is not limited to Linear Technology's products. The company is to be commended for making such a useful tool available for free. Create your first Spice circuitThis is going to be your first schematic. This is called a "common emitter amplifier stage".
Click on the integrated circuit symbol
(tool tip = Component A selection window pops up. Locate and select "npn" and click OK. The symbol for an NPN transistor shows up. Move it to the right side of the page about half way up and click the mouse. Then, press Escape because we will only need one transistor at this point. Once the transistor is placed on the schematic, we need to select a part number. Right-click on the transistor and click "Pick New Transistor" in the popup window. The first selection is 2N2222, which is one of the most popular small signal transistors ever made. It will be fine for this example. Click OK. Please note that the transistor has a "reference designator" of Q1, and a "part number" of 2N2222. Do not confuse the two. You will quickly become familiar with this terminology.
Note: If you make a mistake, it is easy to click on the "Cut" tool (the scissors
Click on the resistor symbol By default, the resistor is vertical (so to speak) and that will be the collector resistor on our schematic. To create the base resistor, we need to select the Rotate tool on the toolbar.
Click on the Rotate symbol ( Right click on the resistor near the collector (should be R1) and in the Resistance box, enter "1000". Click OK. Do the same thing with R2, but with a value of "470". Repeat the process with the Voltage Source symbol (click on Component, then select "voltage"). Place two voltage sources approximately as they are shown on the sample schematic above. Make sure the first one you click is higher up on the page so that it is V1. Right-click on Source V1 (should be the top one) and enter a DC value of "12". Click OK. Right-click on V2 then click "Advanced". In the advanced settings window, select SINE and enter the following values:
Note: The amplitude value for an AC source in SwitcherCAD is the peak voltage. The total peak-to-peak voltage is therefore 2 x 20mV, or 40mV.
Finally, place three ground symbols Now, you are ready to string wire to connect all the components.
Click on the "Wire" symbol The last step is to name a few connections to make it easy to view the simulation results.
Click on the "Label Net" symbol
Simulate!!!You are now ready to run your first simulation.
Click Simulate->Run or click the small runner icon on the toolbar
("Run" SwitcherCAD can run a number of different simulations, Transient, AC Analysis, DC sweep, Noise, DC Transfer and DC operating point. DC operating point is typically run automatically before other simulations, we will study what it does later. For now, select Transient analysis and enter a value of "5m" (for 5 milli seconds, or 0.005 second) in Stop Time. Click OK. The next window lets you pick which voltage in the circuit you want to see. You can select the Label Net points (such as "collector", or "source"), which is why we gave them names, or you can select voltages or current through various components. For now, let's select the collector voltage "V(collector)" and click OK. The computer performs the simulation and if all goes well, the collector voltage waveform will appear at the top of the screen. Here is what I got:
Notice that the mouse cursor changes shape when you move it near a conductor on the schematic. It may look like a voltage probe (the red probe with a spiky test point), or a current probe (the black instrument with an arrow indication the current direction.) Notice that if you click the voltage probe on a net, the waveform at that point is displayed, in addition to the previous waveform. So, if you click on the base of the transistor, you will see an almost completely flat blue line around 0.7V. Now right-click on the green "V(collector)" label at the top of the waveform display. This will open a window. Select "Delete this trace" and click OK. The trace disappears, now click on "Run". The simulation will re run, but now the blue trace uses the full screen, so you can measure the actual base voltage with good precision.. Try to do that with other voltage and current waveforms to get familiar with the program.
Analysis of operation.In this circuit, the transistor is biased so that it draws some current all the time. During its operation, we do not intend for the current to drop to zero (cut-off) or to reach the maximum available through the load resistor R1 (saturation). Either circumstance would cause clipping and distortion. So we can say that this is a Class A amplifier.If we wanted to build something like a microphone preamplifier to drive a power audio amplifier, we would need such a Class A amplifier to minimize distortion. Since this circuit is being operated in Class A, it would be easy to think it is just fine and our job is done. Typical microphones deliver voltages in the millivolt range while most power amplifiers expect input voltages in the 100s of millivolts to a volt or so. Under the conditions of the simulation, this simple amplifier does just that. Well, it is not so easy. Actually, it is rarely that easy, even though in some cases, we can make some tasks pretty easy. But where would be the fun with that? There are a few problems with this circuit. Here are some of them:
Conclusion of this lesson
|