LTSPICE SOFTWARE Beginner's Guide
Total Page:16
File Type:pdf, Size:1020Kb
L2EEA Electronique 2ème semestre v2017 LTSPICE SOFTWARE Beginner’s guide Preliminary calculations must be done before the practical session Aims: • Perform a harmonic study with LTSPICE software • Know how to plot a Bode plot with LTSPICE The time for this initiation must not exceed 45 minutes. LTSPICE is a freeware generally used for the modelling or analog electronic circuits. It is distributed by LinearTechnology © and can be freely downloaded for windows OS (link: http://www.linear.com/designtools/software). Two kinds of studies can be done with LTSPICE. Two kinds of studies can be performed for an electronic circuit by using LTSPICE: - Harmonic study , in the frequency space - Transient analysis, in the time space The software can also be used for parametric study by varying the numerical value of a component of the circuit (resistance, DC supply, capacitor etc..). For all the cases the modelling of an electronic circuit should be done following these three steps: 1st step: Circuit diagram realization 2nd step: definition of simulation parameters (harmonic or transient study) and use (or not) of a parametric study. 3rd step: Run the simulation and visualization and analysis of the results. 1. Frequency behavior of a passive RC circuit Becoming familiar with the software by studying the frequency behavior of an RC circuit. The very first step is to create a new project with the software and to save it. For this, you have to click on the LTSPICE icon (on the desktop). Then, click on “File Menu” and on “New schematic”. Save your project in a folder named “your name” on the desktop by using the “save as” command. L2EEA Electronique 2ème semestre v2017 Figure 1 : graphic interface of LTSPICE First step: design of the circuit plan The studied circuit is drawn in figure 2. It is made of a resistance and a capacitor in series, a voltage generator, some wires and a ground. As we want to realize a harmonic study of the circuit, the generator is a function generator delivering an alternating voltage (1V of amplitude). Figure 2 : RC circuit Your aim is to reproduce this circuit in the creation area of the software. - Add a 10nF capacitor . Click on icon . Move the mask of the capacitor in the creation area, then click to create the capacitor. By default, the name of the capacitor is C1 and its value C. Just left click on the value C, and then give the value 10nF in the field. N.B.: Several abbreviations are available for setting the values: k for kilo, m for milli, n for nano, meg for mega, u for micro. Be careful as LTSPICE should not differentiate between lower case and upper case letters. So, “ m” and “ M” both correspond to the milli abbreviation. - Add a 2.5k Ω resistance . Click on icon . The mask of the resistance is vertical. To rotate L2EEA Electronique 2ème semestre v2017 it, press CTRL+r on the keyboard use icon . Choose the value of the resistance by a left click on “R” - Add a generator supplying a 1V amplitude alternative voltage . Click on icon . This opens a window with a list of the available components for the software. Select “Voltage” component and add it in the creation area. For setting the supply voltage, left click on one of the terminals + or – of the generator. This opens a window. Click on “advanced” button. This opens a new window presented in figure 3. Several parameters can be set. The wave form of the voltage can be defined with specific functions (on the left of the window) or directly by setting some voltage values (right side). Write “1” in the “AC amplitude” field for setting the generator of a harmonic study. NOTA BENE: If for example, you choose 1V for the DC value field (instead of 1V in the AC field) you will supply your circuit in DC. Then you can no longer perform a harmonic analysis of your circuit. Usually, the AC amplitude field must be filled only when we want to obtain the Bode plot of the circuit. - Link all the components with wires . For this, click on icon . - Add a ground using icon . Connect the mask of the ground directly to a wire. - Add two probes “Vin” and “Vout” for measuring input and output voltages. For this, use icon and name the probes using the corresponding field. The final circuit diagram is presented in figure 4. Figure 3: Settings for the generator L2EEA Electronique 2ème semestre v2017 Figure 4 : Circuit diagram in LTSPICE 2nd step: Settings of the simulation parameters The aim is to obtain the harmonic behavior of the circuit for frequencies between 10Hz and 1 MHz. Once the circuit diagram is correctly defined, it is necessary to correctly configure the analysis - Open the window for the simulation settings. Left click on the creation area and then click on “Edit Simulation Cmd”. Several tabs are available: Select « AC Analysis » tab for setting a harmonic simulation. Figure 5 presents the various possibilities. Figure 5: Harmonic simulation settings L2EEA Electronique 2ème semestre v2017 - Settings of the parameters . The starting frequency is 10Hz, the end frequency is 1MHz. We choose that the frequency varies by decades with a sufficient number of points (200) to obtain usable results. - Put the command line in the creation area. After validating the date (push OK button), put the mask of the command line near the circuit in the creation area. The command should appear near the circuit diagram. We can see that all parameters can be written using a command line. 3rd step: running the simulation and post treatment. With the settings of the simulation, you have to perform the following procedure to obtain the Bode plot of the circuit. - Run the simulation. Click on icon . If the simulation runs as expected, a graph window will open. It contains an empty plot depending on the frequency. If any error appears, you should read the error message and correct the circuit or the simulation parameters. - Set the curves to plot. Enlarge the window and add a new plot (use menu “Plot settings”/”add trace” (CTRL+A with the keyboard of icon )). A list with the several calculated data (voltage and current) is suggested. For plotting the Bode plot, you have to plot the ratio of output voltage to input voltage (as indicated in figure 6) Figure 6 :Add a new plot L2EEA Electronique 2ème semestre v2017 - Identify the curves . Two curves appear on the plot window. One corresponds to the Bode amplitude plot and the other to the Bode Phase plot. The scales of the two curves can be changed by using a left click on the axis. Two cursors can be activated by using a left click on the title (at the top of the plot) . They enable to obtain precise values of the gain and of the phase. For instance, the slope of the gain plot can be estimated as suggested in figure 7. Figure 7 :Diagram plot and cursors Questions: - What is the theoretical cutoff frequency of the filter? With the cursors, evaluate the cutoff frequency obtained with the simulation and compare it to the theoretical one. - What is the theoretical order of the filter? With the cursors, evaluate the gain slope of the filter. Does this value concur the theoretical order of the filter? L2EEA Electronique 2ème semestre v2017 TP 1: ACTIVE FILTER – LOW PASS- BAND PASS Objectives : • Design an active filter . • Plot the straight line bode plot of a filter – sizing. • Measure voltage amplitude and calculation of a filter gain • Measure phase shift of two signals. • Determine the cutoff frequency(ies) of a filter • Identification of the kind of active filter (low pass, high pass, band path, band rejection ) and determination of its order. 1. Study of an active filter Consider the circuit diagram in figure 1. Figure 1 : low pass filter 1.1 Preliminary study (to do before the practical course) Using the tutorial exercise, study a plot the Bode straight lines of this filter (gain and phase). Using R2 = 100 kΩ, determine the value of R 1 in order that maximal gain is 20dB. Determine the capacitor C in order that the cutoff frequency (at -3dB) is 10 kHz 1.2 Simulation study (with LTSPICE): 1.2.1 DC study The aim is to plot the variation of Uout with Uin in DC for values of Uin ∈ [-2; 2] V for the circuit of figure 1. You can find below some elements for using LTSPICE in this case. Use of an Operational amplifier with LTSPICE : For all practical courses, you should use the LT1356 OA. It is available in the [Opamps] folder (in components list ). An example is proposed in figure 1-bis for a non-inverting amplifier. L2EEA Electronique 2ème semestre v2017 Figure 1-bis Circuit and supply of an operational amplifier in LTSPICE As with the “real” circuit, a DC supply is necessary for the OA. This supply must deliver a symmetrical DC voltage of +15V and -15V. To achieve with this, create a DC supply in the creation area. The +15V terminal must be linked to the“+” OA terminal and -15V to the “–” OA terminal. Be careful not to mistake these terminals for the inverting and non-inverting inputs of the OA. For the sake of clarity, as presented in figure 1-bis, you can use available alias by clicking on icon . They create links between several parts of the circuit without using any wires. You will use “input” alias for input signals and “output” alias for output signals. In figure 1, input or output are differentiated by the direction of the arrows V+ and V-.