Is there a potentiometer model for LTspice?
...has anyone done this already?
Yes, someone has already done this. (I believe his name is Helmut Sennewald).
The Yahoo LTSpice group has a set of potentiometers that work very well. You will have to register a Yahoo account and join the group to download them (by the way, I highly recommend doing this if you want to pursue LTSpice, the Yahoo group has one of the larger collection of third-party LTSpice models).
The relevant files are potentiometer_standard.lib
and potentiometer_standard.asy
, as well as some other supporting files.
The models provide linear, log, and other models, as well as a potentiometer symbol. The following is an excerpt from the readme file.
pot_lin : ideal linear resistance dependency
pot_pow : ideal power function resistance dependency
pot_plog : ideal positive logarithm function resistance dependency
pot_nlog : ideal negative logarithm function resistance dependency
potr_tab: arbitrary(table) based resistance dependency
pot_piher_plog : pseudo logarithm function resistance dependency, Piher
pot_radiohm_plog : measured pseudo logarithm fucntion resistance dependency, Radiohm
How would this taper be "controlled" during simulation?
These pots have a wiper
property which can be easily parameterized as a regular LTSpice parameter. For example, you might say wiper={GAIN}
, and then add a directive such as .step param GAIN 0 1.0 0.25
.
Tried to follow the suggestions above but took me a awfully long time to create a potentiometer that looks like a potentiometer and that can be instantiated from the main schematic. So, for the benefit of anyone that may be as dumb as me...
Just copy these 3 files to a directory in the LTspice search path (erase any initial spaces in every line). Hope the names are self-explanatory.
potentiometer_test.asc
Version 4
SHEET 1 880 680
WIRE 272 48 0 48
WIRE 528 48 272 48
WIRE 272 80 272 48
WIRE 528 80 528 48
WIRE 0 96 0 48
WIRE 0 192 0 176
WIRE 272 208 272 176
WIRE 528 208 528 176
FLAG 272 208 0
FLAG 0 192 0
FLAG 320 128 out1
FLAG 528 208 0
FLAG 576 128 out2
SYMBOL voltage 0 80 R0
SYMATTR InstName V1
SYMATTR Value 10
SYMBOL potentiometer 272 176 M0
SYMATTR InstName U1
SYMATTR SpiceLine2 wiper=0.2
SYMBOL potentiometer 528 176 M0
SYMATTR InstName U2
SYMATTR SpiceLine R=1
SYMATTR SpiceLine2 wiper=0.8
TEXT 140 228 Left 2 !.op
potentiometer.asy
Version 4
SymbolType BLOCK
LINE Normal 16 -31 -15 -16
LINE Normal -16 -48 16 -31
LINE Normal 16 -64 -16 -48
LINE Normal 1 -9 -15 -16
LINE Normal 1 0 1 -9
LINE Normal 1 -94 1 -87
LINE Normal -24 -56 -16 -48
LINE Normal -24 -40 -15 -48
LINE Normal -47 -48 -15 -48
LINE Normal -16 -80 16 -64
LINE Normal 1 -87 -16 -80
WINDOW 0 30 -90 Left 2
WINDOW 39 30 -50 Left 2
WINDOW 40 31 -23 Left 2
SYMATTR Prefix X
SYMATTR ModelFile potentiometer.lib
SYMATTR SpiceLine R=1k
SYMATTR SpiceLine2 wiper=0.5
SYMATTR Value2 potentiometer
PIN 0 -96 NONE 8
PINATTR PinName 1
PINATTR SpiceOrder 1
PIN 0 0 NONE 8
PINATTR PinName 2
PINATTR SpiceOrder 2
PIN -48 -48 NONE 8
PINATTR PinName 3
PINATTR SpiceOrder 3
potentiometer.lib
* This is the potentiometer
* _____
* 1--|_____|--2
* |
* 3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {R*(1-w)}
R1 3 2 {R*(w)}
.ENDS
Google LTSpice potentiometer, there are lots of examples with varying degrees of complexity. Most use a sub-circuit along these lines:
* This is the potentiometer
* _____
* 1--|_____|--2
* |
* 3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
.ENDS