Introduction to Ltspice
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to LTspice Acknowledgment: LTspice material based in part by Devon Rosner (6.101 TA 2014), Engineer, Linear Technology 6.101 Spring 2020 Lecture 4 SPICE • Simulation Program with Integrated Circuit Emphasis • Developed in 1973 by Laurence Nagel at UC Berkeley’s Electronics Research Laboratory • Dependent on user defined device models 6.101 Spring 2020 Lecture 42 Netlists Components Commands 6.101 Spring 2020 Lecture 4 3 LTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREE and comes with tons of models You do this Ltspice makes this 6.101 Spring 2020 Lecture 4 4 Getting Started THAT’S IT! These buttons are where you will live 6.101 Spring 2020 Lecture 4 5 Component to Menu Item Matchup 6.101 Spring 2020 Lecture 4 6 Net Labels By labeling nets you can avoid a giant mess of wires. Always use these for at least your power supplies. When you start making large circuits, your power supplies will provide energy all over your schematic. 6.101 Spring 2020 Lecture 4 7 Adding Other Components Devices besides basic resistors, capacitors, and inductors are found from this button 6.101 Spring 2020 Lecture 4 8 Op-Amps There are no “ideal” op-amps in reality. BUT, there are in LTspice. PAY CLOSE ATTENTION TO THE TEXT You must literally include .lib opamp.sub in your netlist or schematic as a SPICE directive. 6.101 Spring 2020 Lecture 4 9 Op-Amps Though listed as “ideal” there are still 2 parameters you can tweak. Open Loop Gain: As this number approaches infinity, the Op Amp becomes more “ideal”. Look at some Op Amp data sheets to see some real open loop gains. Gain Bandwidth: As this number approaches infinity, the Op Amp becomes more “ideal”. To check if this is high enough, multiply your desired Closed Loop Gain by your highest desired output frequency. 6.101 Spring 2020 Lecture 410 Op-Amps To more accurately model a real Op Amp not available in LTspice, UniversalOpamp2 has many tweakable parameters. Open loop gain, gain bandwidth, slew rate, current limit, rail-rail voltage, input voltage offset, phase margin, Rin, etc. 6.101 Spring 2020 Lecture 411 Editing Components Just right click the component 6.101 Spring 2020 Lecture 4 12 Editing Components But what about this? This is the basic voltage source menu. Use this for DC sources such as power supplies or bias voltages. 6.101 Spring 2020 Lecture 4 13 Editing Components Voltage sources can produce many test signals. PWL can be used to construct any signal. 6.101 Spring 2020 Lecture 4 14 Selecting Device Model There are no “ideal” BJT’s, MOSFET’s, etc. You can select a model (provided by LTspice), download models, or create your own. 6.101 Spring 2020 Lecture 4 15 Simulation: Transient Transient simulation gives Voltage and/or Current vs.time. These are transient parameters for a voltage source 6.101 Spring 2020 Lecture 4 16 Simulation: Transient This is all you really need 6.101 Spring 2020 Lecture 4 17 Random Tangent: Parameters You MUST define all of your parameters. This is a The “list” command allows you to choose parameter multiple values (simulation simulates each value separately). 6.101 Spring 2020 Lecture 4 18 What Should My Circuit Do? • The very first step to any simulation is to know how your circuit should behave. Simulation is a verification tool NOT A CIRCUIT SOLVER. • So how should this circuit behave? 6.101 Spring 2020 Lecture 4 19 Here’s Where You Write the Solution 6.101 Spring 2020 Lecture 420 Here’s Where You Write the Solution i2 i1 vo vx i3 A DOUBLE POLE!! 6.101 Spring 2020 Lecture 4 21 Expected Behavior • Double pole is at: • We expect frequencies up to this point to be large, but frequencies above to quickly drop off due to the -40 dB/decade characteristic of the double pole 6.101 Spring 2020 Lecture 4 22 Transient Simulation Hover over the desired voltage node to be probed and click when you see this symbol **This is the current probe 6.101 Spring 2020 Lecture 4 23 Transient Simulation 1 kHz 10 kHz 100 kHz 1 MHz 6.101 Spring 2020 Lecture 4 24 AC Simulation AC simulation gives Voltage and/or Current vs.frequency. This is the AC parameter. Just set the amplitude to 1 6.101 Spring 2020 Lecture 4 25 AC Simulation 6.101 Spring 2020 Lecture 4 26 Extra Fun: Math in LTspice Remember: 6.101 Spring 2020 Lecture 4 27 Transient Simulation It’s the same as before! 6.101 Spring 2020 Lecture 4 28 Even More Fun *Note: You can try out some math functions in the simulator window, too! (ex: V(Vo)/V(Vi)). 6.101 Spring 2020 Lecture 4 29 AC Simulation 6.101 Spring 2020 Lecture 4 30 Temperature as a Variable • PTAT current source 6.101 Spring 2020 Lecture 431 Temperature as a Variable 6.101 Spring 2020 Lecture 432 Including External Models • PFET model • Includes parameters to describe MOS device physics 6.101 Spring 2020 Lecture 433 Making Things Pretty 6.101 Spring 2020 Lecture 4 34 Making Things Pretty 6.101 Spring 2020 Lecture 4 35 Making Things Pretty Bob Reay of Linear Technology has provided a nifty tool on his website to give LTspice circuits an even better makeover: http://reaylabs.com/tools/SchematicViewer/SchematicViewer.html Before: 6.101 Spring 2020 Lecture 436 Making Things Pretty Bob Reay of Linear Technology has provided a nifty tool on his website to give LTspice circuits an even better makeover: http://reaylabs.com/tools/SchematicViewer/SchematicViewer.html After: 6.101 Spring 2020 Lecture 437 LTspice Secrets Many aspects and functions of LTspice are not documented. You can learn lots of interesting undocumented capabilities of LTspice from: http://ltwiki.org/?title=Undocumented_LTspice Of particular interest should be B-sources. These allow you to make devices such as non-linear resistors whose value is determined from a function of voltage, current, if statements, constants, etc. Though you cannot build these, they may be useful to model a part not available in LTspice, or to model a special function in your circuit you have not designed yet. 6.101 Spring 2020 Lecture 438 Questions?? 6.101 Spring 2020 Lecture 439 Analysis ort Currents P V file ta a A Analysis W Analysis ransfer Function T Analysis oint ved D AC P a 2.7182818284590452354 3.14159265358979323846 1.3806503e-23 1.602176462e-19 1 0 arameters in a .AC P ting ile oint to Disk a Analysis ransient F UE P y T arameters r R ALSE P -Defined Electrical Quantities ile Given the URL Constants F T r E Pi K Q ourier Component F F ting tor Options a Dot Commands a – ture Sweeps a te Subcircuit Pin Names on te Use a a -Defined r lare Global Nodes lude another lude a Libra wnload a c ve Oper c c 1e-15 1e-12 1e-9 1e-6 1e-3 25.4e-6 o a erform a Small Signal erform a DC Source Sweep erform a Noise arameter Sweeps ind the DC Oper ind the DC Small-Signal emper Short Description P Annot P End of Netlist End of Subcircuit Definition Compute a User Defined Functions D De Set Initial Conditions In In Load a Previously Solved DC Solution Evalu Define a SPICE Model Compute Network Supply Hints for Initial DC Solution P F Set Simul Use Limit the Quantity of S S P Define a Subcircuit T F Do a Nonlinear Write Selected Nodes to a . Suffix f p n u M Mil 1e12 1e9 1e6 1e3 VE VE VEBIAS A A A ARAM P W T Simulator Directives Command .AC .BACKANNO .DC .END .ENDS .FOUR .FUNC .FERRET .GLOBAL .IC .INCLUDE .LIB .LOADBIAS .MEASURE .MODEL .NET .NODESET .NOISE .OP .OPTIONS . .S .S .STEP .SUBCKT .TEMP .TF .TRAN . Suffix G Meg K tion tion y a a r tic on open w a o Netlist y r (Degrades performance!) . tic to a netlist tic to a PCB netlist a a F9 – Undo Ctrl+G – Goto Line # Shift+F9 – Redo Ctrl+R – Run Simul Ctrl+H – Halt Simul WINE(Linux) workarounds w files WINE(Linux) workarounds a ting the schem a tch mode. a tion ypt a model libra ASCII .r a r ge Autorange orce use of a Use Run in b Start as a maximized wind Enc Convert a binary .raw file to Fast Access Format Convert a schem Prevent use of Convert a schem Store user preferences in the regist Start simul Executes one step of the uninstallation process F Short Description Allow MOSFET’s to have up 7 nodes in subcircuit Area race T Aver aveform ertical oggle Grid T W Add V y r ypt r wine o Command Line SwitchesastAccess F Flag -ascii -b -big or -max -enc - -netlist -n -PCBnetlist -regist -Run -SOI -uninstall -wine ‘0’ – Clear F5 – Delete Ctrl+Z – Zoom F9 – Undo Ctrl+B – Zoom Back Ctrl+E – Zoom Extents Ctrl+G – Shift+F9 – Redo Ctrl+A – Ctrl+Y – Ctrl+Click - Ctrl+H – Halt Simul w o Wind Area Tspice HotKeys L te a Attribute Attribute Editor Symbol g le a c xt e T ESC – Exit Mode F5 – Delete Ctrl+Z – Zoom R – Rectangle C – Cir L – Line A – Arc T – Ctrl+E – Mirror Ctrl+R – Rotate F6 – Duplic F7 – Move F8 – Dr F9 – Undo Ctrl+B – Zoom Back Shift+F9 – Redo Ctrl+W – Ctrl+A – tion a Pins ©2018 Analog Devices, Inc.