6.101 Spring 2020 Lecture 4 Introduction to LTspice Acknowledgment: LTspice material based in part by Devon Rosner (6.101 TA 2014), Engineer, Linear Technology 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 4 2 Netlists 6.101 Spring 2020 Lecture 4 Components Commands 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 6.101 Spring 2020 Lecture 4 You do this Ltspice makes this 4 Getting Started 6.101 Spring 2020 Lecture 4 THAT’S IT! These buttons are where you will live 5 Component to Menu Item Matchup 6.101 Spring 2020 Lecture 4 6 Net Labels 6.101 Spring 2020 Lecture 4 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. 7 Adding Other Components 6.101 Spring 2020 Lecture 4 Devices besides basic resistors, capacitors, and inductors are found from this button 8 Op-Amps 6.101 Spring 2020 Lecture 4 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. 9 Op-Amps Though listed as “ideal” there are still 2 parameters you can tweak. 6.101 Spring 2020 Lecture 4 10 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. Op-Amps To more accurately model a real Op Amp not available in LTspice, UniversalOpamp2 has many tweakable parameters. 6.101 Spring 2020 Lecture 4 11 Open loop gain, gain bandwidth, slew rate, current limit, rail-rail voltage, input voltage offset, phase margin, Rin, etc. Editing Components 6.101 Spring 2020 Lecture 4 Just right click the component 12 Editing Components 6.101 Spring 2020 Lecture 4 This is the basic voltage source menu. Use this for DC sources such as power supplies or bias voltages. But what about this? 13 Editing Components 6.101 Spring 2020 Lecture 4 Voltage sources can produce many test signals. PWL can be used to construct any signal. 14 Selecting Device Model 6.101 Spring 2020 Lecture 4 There are no “ideal” BJT’s, MOSFET’s, etc. You can select a model (provided by LTspice), download models, or create your own. 15 Simulation: Transient Transient simulation gives Voltage and/or Current vs.time. 6.101 Spring 2020 Lecture 4 These are transient parameters for a voltage source 16 Simulation: Transient 6.101 Spring 2020 Lecture 4 This is all you really need 17 Random Tangent: Parameters 6.101 Spring 2020 Lecture 4 This is a parameter You MUST define all of your parameters. The “list” command allows you to choose multiple values (simulation simulates each value separately). 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 4 20 Here’s Where You Write the Solution 6.101 Spring 2020 Lecture 4 vx vo i1 i2 i3 A DOUBLE POLE!! 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 6.101 Spring 2020 Lecture 4 Hover over the desired voltage node to be probed and click when you see this symbol **This is the current probe 23 Transient Simulation 6.101 Spring 2020 Lecture 4 1 kHz 10 kHz 100 kHz 1 MHz 24 AC Simulation 6.101 Spring 2020 Lecture 4 This is the AC parameter. Just set the amplitude to 1 AC simulation gives Voltage and/or Current vs.frequency. 25 AC Simulation 6.101 Spring 2020 Lecture 4 26 Extra Fun: Math in LTspice 6.101 Spring 2020 Lecture 4 Remember: 27 Transient Simulation 6.101 Spring 2020 Lecture 4 It’s the same as before! 28 Even More Fun 6.101 Spring 2020 Lecture 4 29 *Note: You can try out some math functions in the simulator window, too! (ex: V(Vo)/V(Vi)). AC Simulation 6.101 Spring 2020 Lecture 4 30 Temperature as a Variable • PTAT current source 6.101 Spring 2020 Lecture 4 31 Temperature as a Variable 6.101 Spring 2020 Lecture 4 32 Including External Models 6.101 Spring 2020 Lecture 4 33 • PFET model • Includes parameters to describe MOS device physics 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 6.101 Spring 2020 Lecture 4 36 Before: 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 6.101 Spring 2020 Lecture 4 37 After: 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 4 38 Questions?? 6.101 Spring 2020 Lecture 4 39 LT sp ic e Ho tK ey s Sc he m at ic Sy m bo l W av ef or m Ne tli st Modes ES C – Ex it M od e ES C – Ex it M od e F 3 – Dr aw W ire F 5 – De le te F 5 – De le te F 5 – De le te F 6 – Du pl ic at e F 6 – Du pl ic at e F 7 – M ov e F 7 – M ov e F 8 – Dr ag F 8 – Dr ag F 9 – Un do F 9 – Un do F 9 – Un do F 9 – Un do S hi ft+ F9 – R ed o S hi ft+ F9 – R ed o S hi ft+ F9 – R ed o S hi ft+ F9 – R ed o View C trl +Z – Z oo m A re a C trl +Z – Z oo m A re a C trl +Z – Z oo m A re a C trl +B – Z oo m B ac k C trl +B – Z oo m B ac k C trl +B – Z oo m B ac k S pa ce – Z oo m F it C trl +E – Z oo m E xt en ts C trl +G – T og gl e Gr id C trl +G – T og gl e Gr id C trl +G – G ot o Li ne # U – M ar k Un nc on . P in s C trl +W – A ttr ib ut e W in do w ‘0 ’ – C le ar A – M ar k Te xt A nc ho rs C trl +A – A ttr ib ut e Ed ito r C trl +A – A dd T ra ce A tl+ Cl ic k – Po w er C trl +Y – V er tic al A ut or an ge C trl +R – R un S im ul at io n C trl +C lic k – At tr. E di t C trl +C lic k - A ve ra ge C trl +H – H al t S im ul at io n C trl +H – H al t S im ul at io n C trl +H – H al t S im ul at io n Place R – R es is to r R – R ec ta ng le C – C ap ac ito r C – C irc le L – In du ct or L – L in e D – D io de A – A rc G – G ND S – S pi ce D ire ct iv e T – T ex t T – T ex t F 2 – Co m po ne nt F 4 – La be l N et C trl +E – M irr or C trl +E – M irr or C trl +R – R ot at e C trl +R – R ot at e Co m m an d Li ne S w itc he s Fl ag Sh or t D es cr ip tio n -a sc ii Us e AS CI I . ra w fi le s. (D eg ra de s pe rfo rm an ce !) -b Ru n in b at ch m od e. -b ig o r - m ax St ar t a s a m ax im ize d w in do w -e nc ry pt En cr yp t a m od el li br ar y -F as tA cc es s Co nv er t a b in ar y .ra w fi le to F as t A cc es s Fo rm at -n et lis t Co nv er t a s ch em at ic to a n et lis t -n ow in e Pr ev en t u se o f W IN E( Li nu x) w or ka ro un ds -P CB ne tli st Co nv er t a s ch em at ic to a P CB n et lis t -r eg is tr y St or e us er p re fe re nc es in th e re gi st ry -R un St ar t s im ul at in g th e sc he m at ic o n op en -S OI Al lo w M OS FE T’ s to h av e up to 7 n od es in s ub cir cu it -u ni ns ta ll Ex ec ut es o ne s te p of th e un in st al la tio n pr oc es s -w in e Fo rc e us e of W IN E( Li nu x) w or ka ro un ds Si m ul at or D ire ct iv es – D ot C om m an ds Co m m an d Sh or t D es cr ip tio n .A C Pe rfo rm a S m al l S ig na l A C An al ys is .B AC KA NN O An no ta te S ub ci rc ui t P in N am es o n Po rt Cu rr en ts .D C Pe rfo rm a D C So ur ce S w ee p An al ys is .E ND En d of N et lis t .E ND S En d of S ub ci rc ui t D efi ni tio n .F OU R Co m pu te a F ou rie r C om po ne nt .F UN C Us er D efi ne d Fu nc tio ns .F ER RE T Do w nl oa d a Fi le G iv en th e UR L .G LO BA L De cl ar e Gl ob al N od es .IC Se t I ni tia l C on di tio ns .IN CL UD E In cl ud e an ot he r F ile .L IB In cl ud e a Li br ar y .L OA DB IA S Lo ad a P re vi ou sl y So lv ed D C So lu tio n .M EA SU RE Ev al ua te U se r- De fin ed E le ct ric al Q ua nt iti es .M OD EL De fin e a SP IC E M od el .N ET Co m pu te N et w or k Pa ra m et er s in a .A C An al ys is .N OD ES ET Su pp ly H in ts fo r I ni tia l D C So lu tio n .N OI SE Pe rfo rm a N oi se A na ly si s .O P Fi nd th e DC O pe ra tin g Po in t .O PT IO NS Se t S im ul at or O pt io ns .P AR AM Us er -D efi ne d Pa ra m et er s .S AV E Li m it th e Qu an tit y of S av ed D at a .S AV EB IA S Sa ve O pe ra tin g Po in t t o Di sk .S TE P Pa ra m et er S w ee ps .S UB CK T De fin e a Su bc irc ui t .T EM P Te m pe ra tu re S w ee ps .T F Fi nd th e DC S m al l-S ig na l T ra ns fe r F un ct io n .T RA N Do a N on lin ea r T ra ns ie nt A na ly si s .W AV E W rit e Se le ct ed N od es to a .W AV fi le Su ffi x Su ffi x f 1e -1 5 T 1e 12 p 1e -1 2 G 1e 9 n 1e -9 M eg 1e 6 u 1e -6 K 1e 3 M 1e -3 M il 25 .4 e- 6 Co ns ta nt s E 2. 71 82 81 82 84 59 04 52 35 4 P i 3. 14 15 92 65 35 89 79 32 38 46 K 1. 38 06 50 3e -2 3 Q 1. 60 21 76 46 2e -1 9 T R UE 1 F AL SE 0 © 20 18 A na lo g De vic es , I nc . A ll rig ht s re se rv ed . T ra de m ar ks a nd re gi st er ed tr ad em ar ks a re th e pr op er ty o f t he ir re sp ec tiv e ow ne rs . Ah ea d of W ha t’s P os sib le is a tr ad em ar k of A na lo g De vic es . LT sp ic e- 6/ 18 (E ) an al og .c om LT sp ic e LTSPICE SHORTCUTS ON A MAC 11/5/2013 REV 3 a DRAW CIRCLE b BUS TERMINATION g GROUND l DRAW LINE s ADD SPICE DIRECTIVE (right click for HELP ME EDIT) t ADD TEXT COMMENT w DRAW BOX z H HIDE LTSPICE z L SPICE LOG z N NEW SCHEMATIC z O OPEN z Q QUIT LTSPICE z S SAVE z Z UNDO ⇧z Z REDO z M MINIMIZE ⌥z M MINIMIZE ALL z W CLOSE ⌥z W CLOSE ALL z P PRINT ⇧z P page seupt F2 COMPONENT F3 WIRE F4 NET NAME F5 DELETE F6 DUPLICATE F7 MOVE (CNTRL-R to rotate, CNTRL-E to mirror) F8 DRAG (CNTRL-R to rotate, CNTRL-E to mirror) F9 UNDO ⇧F9 REDO SPACE BAR ZOOM TO FIT 2 FINGER PINCH ZOOM IN 2 FINGER SPREAD ZOOM OUT Here are the modifier key symbols you may see in OS X menus: z COMMAND ⌥ ALT OR OPTION ⇧ SHIFT