10

I started designing a model for a three-terminal potentiometer in LTspice, since none are included and it's such a common component. Drawing the .asy symbol and the wiper terminal, it dawned on me that this was going to be more complicated than it appeared. How would the various tapers be modeled? How would this taper be "controled" during simulation? It looks like a subcircuit and library at least, is in order.

Before I reinvent the wheel, has anyone done this already? Thank you. 3-terminal resistor model, under construction

rdtsc
  • 15,913
  • 4
  • 30
  • 67
  • 4
    In the past I have used a standard resistor then just a parametric sweep of the resistor values to model a potentiometer. – IC_Eng Nov 12 '18 at 11:31

5 Answers5

10

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
Celiponcio
  • 101
  • 1
  • 2
8

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

Ricardo
  • 6,134
  • 19
  • 52
  • 85
uint128_t
  • 8,664
  • 6
  • 26
  • 28
3

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
Steve G
  • 5,275
  • 1
  • 13
  • 24
3

To vary a parameter (such as a component value), you can use the .step command to do a parameter sweep. If all you want is a two-terminal variable resistance, you can use a normal resistor for this. If you need three terminals, Steve's answer seems like a good one.

Adam Haun
  • 21,331
  • 4
  • 50
  • 91
1

Under "Special Functions" there is a voltage controlled varistor that you could use instead.

Brendan Simpson
  • 2,154
  • 12
  • 20