| Electronics > Beginners |
| Simulating potentiometers using LTSpice. |
| (1/3) > >> |
| Zero999:
In responding to another thread it became apparent that it's not obvious how to simulate a potentiometer, using LTSpice. Rather than clog it up, I decided to make a quick tutorial and it can be made sticky if people find it useful, otherwise it'll just sink to the bottom of the list and rot, if it's no good. There are several ways to do it. Firstly the potentiometer must be broken down into two resistors: the top (POT1a) and bottom (POT1b), with the wiper joining them both. If you wanted to, you could add an extra resistor in series with the wiper, to emulate the contact resistance, but it's not needed in most applications, as it's small, compared to the total resistance. Now you need a way to alter the resistance value. There are three ways: Use the .step param directive. .step param variable_name start_value end_value increment Where variable_name is the name of the variable i.e. POT start_value is the resistance value at the beginning of the simulation., end_value is the resistance value to be swept towards, as the end of the simulation increment is the step size. The value of the potentiometer is simply set to {variable_name} with a mathematical expression. To make a potentiometer, the top resistor's value is incremented, as the bottom resistor value is decremented, with a small value added to both to ensure neither value is zero: LTSpice can't handle zero Ohm resistors as they result in division by zero. demo 1 and 2 use the step param method. demo 1 uses absolute values demo 2 uses a percentage which is scaled, allowing the potentiometer's value to be more easily changed. The above two are fine, but no good for analysing the transient response, as the resistance is varies. demo 3 uses the time to control the resistance. The downside to this is changing the length of the simulation time affects the resistance value. demo 4 uses a voltage to control the resistance. A voltage of near 0V to 1V is used because it makes scaling easier. Note again, to avoid zero Ohm resistors, the voltage can never equal 0 or 1. It's a bit more tricky to set up but is the most flexible option since the resistance can be arbitrarily varied at and speed and wave shape. |
| iMo:
There is a pot available, and it works. What I miss is an interactive behavior, a knob I turn while I get new simulation results instantly :) |
| Zero999:
--- Quote from: imo on April 21, 2019, 06:54:46 pm ---There is a pot available, and it works. What I miss is an interactive behavior, a knob I turn while I get new simulation results instantly :) --- End quote --- It isn't part of the default install though. Attached is the library I often use, but I often prefer the methods described above because they're more portable and the voltage controlled one is very powerful. |
| iMo:
I've tried to push the control voltage into the model ( the "T" or "wiper" position ) without a success. Would be nice to have: to implement your model into the "pot" subcircuit, such we can use any parameter as the wiper position.. A collection of various pots (lin/log/pow/tab): PS: http://ltwiki.org/files/LTspiceIV/examples/LtSpicePlus/Gen/Chaos&Noise/OpticalAWGN/potentiometer_standard.lib |
| Zero999:
The step command works with the library, but not the time or voltage control methods, which is odd. I think it's a fault of LTSpice, rather than the library. Why do you need the library? The only advantage I can see is the symbol makes drafting easier and the schematic more clear. It doesn't benefit simulation. Logarithmic potentiometers are easy to implement, using the methods I've described previously. A log potentiometer can be simulated by using the exponential function. |
| Navigation |
| Message Index |
| Next page |