Download Introduction to LTspice-Electronics-Lab Manual and more Exercises Electronics in PDF only on Docsity!
ELECTRONICS 2 (LAB): COMPUTER
SIMULATIONS USING LTSPICE
LAB 1: INTRODUCTION TO LTSPICE
DOWNLOADING AND INSTALLING LTSPICE :-
LTspice can be downloaded from http://www.linear.com/designtools/software/ltspice.jsp. The downloaded file is a .exe file which directly installs LTspice.
CREATING A SIMPLE CIRCUIT: -
- Open the LTspice softwere.
- Choose File - > New Schematic.
- From Tools menu the color preferences can be changed, the grid can be turned on or off from the view menu.
- The toolbar is explained below
- The component button can be used to put any circuit component on the schematic diagram. The wire button can be used to connect different components.
- The label button can be used to give labels to different nodes. Otherwise a default name is given to each node.
- To delete a component from the diagram either use F5 or click the scissors button and click on the component to be deleted.
- To make a simple circuit as shown below click on the component button.
- The following window appears.
- Another way setting different properties of a component is by using left click on the component itself e.g. if we use left click on the voltage source the following window appears.
- Now the DC value and the source internal resistance can be set from this window. The advanced button can be used to change the voltage source from DC to other types which shall be explored in other tasks.
TASK1 : Simulating a Simple Circuit to Obtain DC Bias Point: -
- After the circuit has been made and values are set as explained above we can simulate the circuit to determine the DC bias point i.e. all node voltages and currents.
- Suppose we set the DC voltage source equal to 5V and both resistors are set equal to 1K. ( The symbol for prefixes such as kilo and milli and mega are case insensitive can be confusing e.g. the symbol for kilo is K or k , for milli it is M or m and for mega it is MEG or meg. A complete list can be found in appendix of this document).
- Now click Simulate->run from the top menu or click the run button on the toolbar. The following window appears
- It shows the possible type of analyses LTspice can perform. At the moment we are only interested in the DC bias point so click the DC op pnt button on the top menu of this window and click ok.
- The operating point is calculated and the following results appear.
- Since we placed no label on the nodes so they are given names n001 and n002. The node with ground connected is named 0.
- Now we place our own labels on the nodes by using the label net button on the toolbar and run the simulation again
- It shows that R1 is connected between nodes N2 and N1 and hence the assumed direction of current is from N2 to N1. Whereas the actual current flows from N1 to N2 and hence the output generated a negative sign.
- To connect R1 i.e. the assumed direction is from N1 to N2 select the resistor by using the move or drag button (the buttons with the symbol of open or closed hand) from the toolbar and press ctrl+e to mirror the resistor. Now run the simulation and view the Spice Netlist.
- The current through Voltage source is negative as it should be by passive sign convention.
TASK2: Simulating DC Bias Point of a Bipolar Junction Transistor
- Make a new schematic. Using the same procedure, as described in TASK1 create the circuit shown below.
- Calculate the DC bias point. The following window appears
- Since we have not specified any parameters of the BJT, LTspice has used the default values. A list of all parameters and the corresponding default values are given in the Appendix.
- From the table given in the Appendix we see that the saturation current of the BJT is defined using the symbol ‘ Is’ and the beta is defined by symbol ‘ Bf’.
- To specify our own value of these two parameters click the spice directive button.
- In the window that appears write to specify a beta of 200 and Is = 10-13.
.model MyBJT NPN(Is = 1e-13 Bf=200)
- Place it on the schematic and now change the value of BJT from NPN to MyBJT. To make results easier to read give proper names to all the nodes and find the DC bias point. The following results appear
Exercise Questions
Question No.
For the circuits shown below let VCC =10V. Calculate the DC bias point for both the circuits for different values of beta i.e. 70,100,200. What is the effect on the bias point i.e. IC, VCE when beta changes. Which scheme is less beta dependant and Why? Compute the percentage variation in bias point values with percentage variation in beta.
Question No.
For the circuit shown below find the Thevenin `s equivalent voltage Vth = Vab across nodes a and b and the equivalent resistance Rth.
LAB: 2 DC SWEEP AND TRANSFER FUNCTION ANALYSIS
DC SWEEP ANALYSIS:-
DC Sweep is a type of simulation in LTSpice where the DC voltage of one or more than one source(s) is varied in a step-wise manner. At each step the DC bias point is calculated, the results are usually represented in the graphs. This type of analysis is most suitable when plotting the V-I curves of different devices or when designing a specific DC bias point for a particular circuit.
TASK 1: Plotting the V-I curve of a real diode
- Create a new schematic and draw the following circuit. Remember to label the nodes as V1 and V2 as shown.
- As in the case of BJT discussed in the previous lab since we have not specified any parameters of the diode, LTspice has used the default values. A list of all parameters and the corresponding default values are given in the Appendix.
- The DC characteristics of the diode are defined by the reverse saturation current IS, the ohmic resistance RS and the ideality factor N (also known as emission coefficient). To specify these values we write .MODEL myDiode D ( IS = 1e-15 N=1.1 RS = 0)
- Change the value of diode from
D
to ‘myDiode’. - Another way of specifying a diode maybe to use ‘left-click’ on the diode and click ‘Pick New Diode’ from the window that appears. It will present a list of list of available diodes which may be used for the simulation.
- To perform the DC sweep analysis click the run command and choose the ‘DC Sweep’ button on the window that appears.
- Maximize the graph window; take the mouse cursor over the horizontal axis, the mouse cursor changes into a scale icon. Use the ‘right-click’ button and a window would appear. 3. This window tells us that the quantity plotted on the horizontal-axis is the DC source voltage V1. It also tells what the maximum and minimum value on the axis is and where the ticks are placed. We can change all these values. Since we want to plot diode current vs. diode voltage so we should place diode voltage on the horizontal-axis. To do so change the value of ‘Quantity plotted’ from ‘V1’ to V(V1) – V(V2)
- Now move the mouse cursor somewhere on the graphical screen and use ‘left-click’, from the drop-down menu that appears click ‘Add Trace’. The following window appears
- It lists all the voltages and current which have been calculated during the DC sweep simulation. Choose I(D1) which is the diode current.
- The V-I curve is plotted on the screen.
- A number of mathematical operations can be performed on the graphs. A constant may be added, subtracted, multiplied or dived from the graph. Two or more graphs may be added, subtracted, multiplied or divided. Similarly the logarithm or some trigonometric function of the graph may be plotted as well. In appendix a list of possible mathematical functions is provided. To apply a mathematical operation on the graph use left click on the title of the graph (I(D1) in this case). The following window appears
- In this window any algebraic expression may be written.
- By using right click on the graph, the numerical values at different points can be observed.
TRANSFER FUNCTION ANALYSIS: -
In transfer function analysis an input and output voltage or current is provided. The simulation first calculates the Bias point and then calculates the gain, input and output resistance around the bias point.
TASK 2: Apply Transfer function analysis on a given circuit
- Consider the following circuit
- It represents the small signal model of a common-emitter amplifier. The task is to implement the circuit using LTSpice and calculate the voltage gain, Rin and Rout using transfer function analysis.
- The rest of the circuit is simple; the only new component is the current controlled current source. In LTspice the current controlled current source is represented by ‘f’. The current controlled source requires the name of the current on which it depends and the value of the current gain. To specify the name of the current a dummy voltage source (i.e. a voltage source with 0V) is placed at the node through which the current flows (in series with Rpi in this case). The LTspice circuit is shown below
- The Output is V(Vo) and the input is Vin.
- The simulation is performed and the results are displayed on the screen
Exercise Questions
Question No.
Use a 2N2222 BJT. Plot its VCE vs. IC curves for 3 different values of VBE i.e. 0.7, 0.8 and 0.9 V. Use DC sweep with two sources i.e. one for VCE and the other for VBE. Use right click on the graph screen and use “select step” option to figure out which curve represents what value.
Question No.
For the circuit shown below calculate voltage gain, input and output resistance between node 2 and 3. (i.e. the output is V(2,3)).
Parameter Description Example Value Vinitial The lower amplitude of the pulse
- 5V
Von The upper magnitude of the pulse
+5v
Tdelay Initial delay if any of the pulse 0sec Trise Rise time 1nsec Tfall Fall time 1nsec Ton The time for which amplitude is Von
10usec
Tperiod Total time of one cycle 20usec Ncycles No of cycles to be simulated ----
- Lets use the example values listed and press the run button, the following window appears
- Lets specify stop time equal to 400usec and leave the rest of values unspecified, LTSpice would use default values.
- After simulation the graphical window would appear, move the cursor on the source node and use right click. The output of the voltage source would get plotted on the graphical screen
- Now to generate a sinusoidal voltage use left click on the voltage source, click advanced and now select the SINE radio button. The following parameters appear
Parameter Description Example Value DC offset DC offset if any 0V Amplitude Amplitude of sine wave 5V Freq Frequency 10K Tdelay Delay time If any Theta Damping factor if any 0 or 1e- 4 Phi Phase delay 0 Ncycles No. of Cycles
- Use the example parameters and run the simulation.
- The last voltage signal to be considered is the ‘piece-wise linear’ source. In this type of source signal a number of signal points are specified. The output signal is the linear interpolation between the specified signal points.
- To generate a step voltage waveform click on the PWL radio button in the advanced menu of the voltage source specification. Here the different voltage signal points can be specified. Specify three points given as Time1 0 Value1 0 Time2 1nsec Value2 5V Time3 1msec Value3 5V
- Simulate the circuit and observe the output.
TASK 2: Analyze the step response of an RLC circuit
- Draw the circuit shown below using a new schematic
- Convert the voltage source into a step voltage signal using the method explained in the previous task.
- Simulate the circuit using transient analysis for 400usec.
- Plot different voltages and currents.
- Change the values of Capacitor and Inductor and analyze its effect.