Categories
Analysis Potentiometer Resources

Pots for SPICE

While working on the next article, I had to figure out what to do with potentiometers. LTSpice I use does not come with pots out of the box. While I have no issue with using two resistors and emulate a potentiometer, it’s not as good if I wanted to add that to an article. Having a proper pot symbol is just nicer and simpler.

There’s a library (pote.lib) with pots (pot.asy) on LTWiki (not affiliated with Analog), but it’s not exactly what I wanted.

Pinout

I have a slight gripe with pots, I never know how are they marked and how to wire them up without looking at the actual code of the library (in this case) or printing out the PCD layout and seeing if everything goes where it should.

All pots I came across look the same, more or less. Looking them from the front (the way I imagine being front anyway), pins are numbered 1-2-3. 2nd pin is the wiper, and going clockwise (assuming positive linear/audio taper), resistance increases between pins 1 and 2, and decreases between 2 and 3. Going counter-clockwise, resistance between 1 and 2 decreases and between 2 and 3 increases. Something like this:

Excerpt from 2 different pot datasheets indicating pinout
Two examples of potentiometer pinouts

But aforementioned libraries have them marked as A-B-C and with random order of pins. The models do work, but it simply isn’t the way I look at and use pots. It just causes confusion (to me) and I have to triple check whatever I do.

Footprints

I mean, it’s not just that the “unofficial” pot library confuses me. Looks like the footprints for Alps pots that I use is wrong in KiCad:

Screenshot of a Alps RK09K family of potentiometers footprint from KiCad.
Alps RK09K footprint in KiCad library

It might be just me, but that order of pins is flipped. It actually caused me some issues when I ordered PCBs, I had to mount pots on the other side of the PCB to get them to work correctly. Having said that, the footprint has been there for years, I’m sure I must be wrong or somebody else would’ve already complained about it.

Here’s the “compatible” footprint that has correct pinout and should fit my pot just the same:

Alpha RD901F potentiometer footprint from KiCad
Alpha RD901F pot footprint in KiCad

Just something to be careful about.

SPICE Library

With all that, I decided to just simply adjust the aforementioned SPICE library and get it adapted to how I use pots. All credits to the original creator (I left the credits to the original creator in the file), I only did minor changes and clean-ups removing things I did not need.

Here’s the zip file with the library and the symbol file:

To use it, either extract it in the same folder where your asc file is, or to the lib folder of LTSpice (pot.asy file goes to sym subfolder, pot.lib file goes to sub subfolder).

How to use the file is when adding a new component is to select correct folder from the drop down and choose pot:

Selecting pot component

Linear

Here’s how it looks like using 10K linear pot:

Using linear pot in SPICE
Using linear pot

To use linear pot select pot_lin as the model and set parameters Rt (total resistance) and set (which is a value from 0.0 to 1.0 indicating knob position – e.g: 0.0 all the way counter clockwise, 1.0 all the way clockwise, 0.5 in the middle).

Audio

Audio pot has more parameters:

Using audio pot in SPICE
Using audio pot

Model is pot_audio and it requires additional parameters: Rtap and tap. Rtap is resistance between terminals 1 and 2 at position tap. In the above example, it just states that at the 0.65 (just past the middle) position of the pot the resistance is 2.5Kohms. I picked up those values up from Alps datasheet:

Alps resistance diagrams from datasheet
Alps resistance diagrams

The audio pot taper does not look that close, but in reality is not that far off. Which brings me to another 2 models.

Piecewise Linear

In reality, audio potentiometers are really made up of multiple sections of linear potentiometer with different slopes. Based on the resistance diagrams I did an attempt to replicate them with pot_alps_a model:

SPICE potentiometer model for Alps 15A taper
Alps 15A taper model

Audio model does not look that far off from this now that I plotted them at the same diagram size. In the original library there was already a similar pot model, I just adjusted it to fit the diagram from the datasheet.

Similarly, for reverse-audio taper: 15C from the datasheet diagram:

SPICE potentiometer model for Alps 15C taper
Alps 15C taper model

Using pot_alps_c model I get reverse-audio pot. The diagram is different from the datasheet but this is because the datasheet plots resistance between terminals 2 and 3, and I plotted resistance between 1 and 2.

Note: The diagram from the datasheet does not make much sense and I had this wrong first time around. The above is corrected version. I’ll get to documenting some gripes with data sheets in another post.

Summary

In summary here are the models to use:

ModelDescription
pot_linLinear taper
pot_audioAudio taper
pot_alps_aPiecewise linear audio taper, modeling Alps 15A taper
pot_alps_cPiecewise linear reverse-audio taper, modeling Alps 15C taper
Models for potentiometers

And parameters for the models:

ParameterDescription
RtTotal resistance for the potentiometer
setPosition of the wiper 0.0 to 1.0, 0.0 being completely counter-clockwise, 1.0 is completely clockwise, 0.5 is the middle. Ratio of the wiper travel if you will.
RtapResistance between terminals 1 and 2 at “tap” position. Only used for audio pot
tapRatio of wiper travel to reach Rtap resistance. Only used for audio pot
Parameters for the potentiometer models

I’ll be expanding this if I need to but so far this should be enough to get me going for most of the analysis I need to do.

One reply on “Pots for SPICE”

There are known problems with Kicad, Spices and pins.

https://electronics.stackexchange.com/questions/509392/kicad-component-doesnt-match-manufacturers-model

And
“KiCad uses different pin assignments for semiconductor components than is expected by the ngspice engine. For example, the standard SPICE pin assignments for a BJT transistor are pin 1 = collector, pin 2 = base, and pin 3 = emitter, whereas KiCad uses 1 = E, 2 = B, and 3 = C. This can cause great confusion for users wondering what the heck is going on. ”
https://www.woolseyworkshop.com/2019/07/01/performing-a-circuit-simulation-in-kicad/

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.