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.
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:
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.
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:
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:
Just something to be careful about.
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:
Here’s how it looks like using 10K 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 pot has more parameters:
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:
The audio pot taper does not look that close, but in reality is not that far off. Which brings me to another 2 models.
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:
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:
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.
In summary here are the models to use:
|Piecewise linear audio taper, modeling Alps 15A taper
|Piecewise linear reverse-audio taper, modeling Alps 15C taper
And parameters for the models:
|Total resistance for the potentiometer
|Position 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.
|Resistance between terminals 1 and 2 at “tap” position. Only used for audio pot
|Ratio of wiper travel to reach Rtap resistance. Only used for audio pot
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.