introduction to ltspice - mitltspice • developed in 1998 by mike engelhardt at linear technology...

41
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

Upload: others

Post on 26-Oct-2020

22 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

6.101 Spring 2020 Lecture 4

Introduction to LTspiceAcknowledgment:  LTspice material based in part by Devon Rosner (6.101 TA 2014), Engineer, Linear Technology

Page 2: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 3: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Netlists

6.101 Spring 2020 Lecture 4

Components

Commands

3

Page 4: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 5: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Getting Started

6.101 Spring 2020 Lecture 4

THAT’S IT!

These buttons are where you will live

5

Page 6: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Component to Menu Item Matchup

6.101 Spring 2020 Lecture 4 6

Page 7: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 8: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Adding Other Components

6.101 Spring 2020 Lecture 4

Devices besides basic resistors, capacitors, and inductors are found from this button

8

Page 9: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Op-Amps

6.101 Spring 2020 Lecture 4

There are no “ideal” op-amps in reality. BUT, there are in LTspice.

PAY CLOSEATTENTIONTO THE TEXT

You must literally include.lib opamp.subin your netlistor schematicas a SPICE directive.

9

Page 10: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Op-AmpsThough listed as “ideal” there are still 2 parametersyou 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 Ampdata 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 highenough, multiply your desired Closed Loop Gain by your highest desired output frequency.

Page 11: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Op-AmpsTo 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.

Page 12: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Editing Components

6.101 Spring 2020 Lecture 4

Just right click thecomponent

12

Page 13: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Editing Components

6.101 Spring 2020 Lecture 4

This is the basic voltage source menu.Use this for DC sources such as powersupplies or bias voltages.

But what about this?

13

Page 14: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Editing Components

6.101 Spring 2020 Lecture 4

Voltage sources can produce many test signals.PWL can be used to construct any signal.

14

Page 15: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 16: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Simulation: TransientTransient simulation gives Voltage and/or Current vs.time.

6.101 Spring 2020 Lecture 4

These are transient parameters for a voltage source

16

Page 17: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Simulation: Transient

6.101 Spring 2020 Lecture 4

This is all youreally need

17

Page 18: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 19: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 20: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Here’s Where You Write the Solution

6.101 Spring 2020 Lecture 4 20

Page 21: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Here’s Where You Write the Solution

6.101 Spring 2020 Lecture 4

vx

vo

i1

i2

i3

A DOUBLE POLE!!

21

Page 22: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 23: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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

Page 24: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Transient Simulation

6.101 Spring 2020 Lecture 4

1 kHz10 kHz100 kHz1 MHz

24

Page 25: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

AC Simulation

6.101 Spring 2020 Lecture 4

This is the ACparameter.Just set theamplitude to 1

AC simulation gives Voltage and/or Current vs.frequency.

25

Page 26: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

AC Simulation

6.101 Spring 2020 Lecture 4 26

Page 27: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Extra Fun: Math in LTspice

6.101 Spring 2020 Lecture 4

Remember:

27

Page 28: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Transient Simulation

6.101 Spring 2020 Lecture 4

It’s the same as before!

28

Page 29: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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)).

Page 30: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

AC Simulation

6.101 Spring 2020 Lecture 4 30

Page 31: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Temperature as a Variable

• PTAT current source

6.101 Spring 2020 Lecture 4 31

Page 32: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Temperature as a Variable

6.101 Spring 2020 Lecture 4 32

Page 33: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Including External Models

6.101 Spring 2020 Lecture 4 33

• PFET model• Includes 

parameters to describe MOS device physics

Page 34: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Making Things Pretty

6.101 Spring 2020 Lecture 4 34

Page 35: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Making Things Pretty

6.101 Spring 2020 Lecture 4 35

Page 36: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Making Things PrettyBob 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:

Page 37: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Making Things PrettyBob 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:

Page 38: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

LTspice SecretsMany aspects and functions of LTspice are not documented. You can learn lots of interesting undocumented capabilities of LTspicefrom: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

Page 39: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

Questions??

6.101 Spring 2020 Lecture 4 39

Page 40: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

LTsp

ice

HotK

eys

Sche

mat

icSy

mbo

lW

avef

orm

Netli

st

Modes

ESC

– Ex

it M

ode

ESC

– Ex

it M

ode

F3

– Dr

aw W

ire F

5 –

Dele

te F

5 –

Dele

te F

5 –

Dele

te F

6 –

Dupl

icat

e F

6 –

Dupl

icat

e F

7 –

Mov

e F

7 –

Mov

e F

8 –

Drag

F8

– Dr

ag F

9 –

Undo

F9

– Un

do F

9 –

Undo

F9

– Un

do S

hift+

F9 –

Red

o S

hift+

F9 –

Red

o S

hift+

F9 –

Red

o S

hift+

F9 –

Red

o

View

Ctrl

+Z –

Zoo

m A

rea

Ctrl

+Z –

Zoo

m A

rea

Ctrl

+Z –

Zoo

m A

rea

Ctrl

+B –

Zoo

m B

ack

Ctrl

+B –

Zoo

m B

ack

Ctrl

+B –

Zoo

m B

ack

Spa

ce –

Zoo

m F

it C

trl+E

– Z

oom

Ext

ents

C

trl+G

– T

oggl

e Gr

id

Ctrl

+G –

Tog

gle

Grid

C

trl+G

– G

oto

Line

#

U –

Mar

k Un

ncon

. Pin

s C

trl+W

– A

ttrib

ute

Win

dow

‘0

’ – C

lear

A –

Mar

k Te

xt A

ncho

rs C

trl+A

– A

ttrib

ute

Edito

r C

trl+A

– A

dd T

race

Atl+

Clic

k –

Pow

er C

trl+Y

– V

ertic

al A

utor

ange

Ctrl

+R –

Run

Sim

ulat

ion

Ctrl

+Clic

k –

Attr.

Edi

t C

trl+C

lick

- Ave

rage

Ctrl

+H –

Hal

t Sim

ulat

ion

Ctrl

+H –

Hal

t Sim

ulat

ion

Ctrl

+H –

Hal

t Sim

ulat

ion

Place

R –

Res

isto

r R

– R

ecta

ngle

C –

Cap

acito

r C

– C

ircle

L –

Indu

ctor

L

– L

ine

D –

Dio

de A

– A

rc G

– G

ND S

– S

pice

Dire

ctiv

e T

– T

ext

T –

Tex

t F

2 –

Com

pone

nt F

4 –

Labe

l Net

Ctrl

+E –

Mirr

or C

trl+E

– M

irror

Ctrl

+R –

Rot

ate

Ctrl

+R –

Rot

ate

Com

man

d Li

ne S

witc

hes

Flag

Shor

t Des

crip

tion

-asc

iiUs

e AS

CII .

raw

file

s. (D

egra

des

perfo

rman

ce!)

-bRu

n in

bat

ch m

ode.

-big

or -

max

Star

t as

a m

axim

ized

win

dow

-enc

rypt

Encr

ypt a

mod

el li

brar

y-F

astA

cces

sCo

nver

t a b

inar

y .ra

w fi

le to

Fas

t Acc

ess

Form

at-n

etlis

tCo

nver

t a s

chem

atic

to a

net

list

-now

ine

Prev

ent u

se o

f WIN

E(Li

nux)

wor

karo

unds

-PCB

netli

stCo

nver

t a s

chem

atic

to a

PCB

net

list

-reg

istr

ySt

ore

user

pre

fere

nces

in th

e re

gist

ry-R

unSt

art s

imul

atin

g th

e sc

hem

atic

on

open

-SOI

Allo

w M

OSFE

T’s

to h

ave

up to

7 n

odes

in s

ubcir

cuit

-uni

nsta

llEx

ecut

es o

ne s

tep

of th

e un

inst

alla

tion

proc

ess

-win

eFo

rce

use

of W

INE(

Linu

x) w

orka

roun

ds

Sim

ulat

or D

irect

ives

– D

ot C

omm

ands

Com

man

dSh

ort D

escr

iptio

n.A

CPe

rform

a S

mal

l Sig

nal A

C An

alys

is.B

ACKA

NNO

Anno

tate

Sub

circ

uit P

in N

ames

on

Port

Curr

ents

.DC

Perfo

rm a

DC

Sour

ce S

wee

p An

alys

is.E

NDEn

d of

Net

list

.END

SEn

d of

Sub

circ

uit D

efini

tion

.FOU

RCo

mpu

te a

Fou

rier C

ompo

nent

.FUN

CUs

er D

efine

d Fu

nctio

ns.F

ERRE

TDo

wnl

oad

a Fi

le G

iven

the

URL

.GLO

BAL

Decl

are

Glob

al N

odes

.ICSe

t Ini

tial C

ondi

tions

.INCL

UDE

Incl

ude

anot

her F

ile.L

IBIn

clud

e a

Libr

ary

.LOA

DBIA

SLo

ad a

Pre

viou

sly

Solv

ed D

C So

lutio

n.M

EASU

REEv

alua

te U

ser-

Defin

ed E

lect

rical

Qua

ntiti

es.M

ODEL

Defin

e a

SPIC

E M

odel

.NET

Com

pute

Net

wor

k Pa

ram

eter

s in

a .A

C An

alys

is.N

ODES

ETSu

pply

Hin

ts fo

r Ini

tial D

C So

lutio

n.N

OISE

Perfo

rm a

Noi

se A

naly

sis

.OP

Find

the

DC O

pera

ting

Poin

t.O

PTIO

NSSe

t Sim

ulat

or O

ptio

ns.P

ARAM

User

-Defi

ned

Para

met

ers

.SAV

ELi

mit

the

Quan

tity

of S

aved

Dat

a.S

AVEB

IAS

Save

Ope

ratin

g Po

int t

o Di

sk.S

TEP

Para

met

er S

wee

ps.S

UBCK

TDe

fine

a Su

bcirc

uit

.TEM

PTe

mpe

ratu

re S

wee

ps.T

FFi

nd th

e DC

Sm

all-S

igna

l Tra

nsfe

r Fun

ctio

n.T

RAN

Do a

Non

linea

r Tra

nsie

nt A

naly

sis

.WAV

EW

rite

Sele

cted

Nod

es to

a .W

AV fi

le

Suffi

xSu

ffix

f1e

-15

T1e

12 p

1e-1

2 G

1e9

n1e

-9 M

eg1e

6 u

1e-6

K1e

3 M

1e-3

Mil

25.4

e-6

Cons

tant

s E

2.71

8281

8284

5904

5235

4 P

i3.

1415

9265

3589

7932

3846

K1.

3806

503e

-23

Q1.

6021

7646

2e-1

9 T

RUE

1 F

ALSE

0

©20

18 A

nalo

g De

vices

, Inc

. All

right

s re

serv

ed. T

rade

mar

ks a

nd

regi

ster

ed tr

adem

arks

are

the

prop

erty

of t

heir

resp

ectiv

e ow

ners

.Ah

ead

of W

hat’s

Pos

sible

is a

trad

emar

k of

Ana

log

Devic

es.

LTsp

ice-

6/18

(E)

anal

og.c

om

LTsp

ice

Page 41: Introduction to LTspice - MITLTspice • Developed in 1998 by Mike Engelhardt at Linear Technology Corporation • GUI, simulator, and schematic -> netlist for SPICE • FREEand comes

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