These are just some collected tricks and helpful stuff to copy and paste and/or use as needed. Mostly for myself, so don't complain that I am missing this or that. Although I may add it here, in case I like it.


Potentiometer or adjustable resistor

Connect two resistors in series and assign them the values {ra} and {rb}, respectively. Note the curly braces and don't omit them. Press ''S'' to enter a new spice directive and paste the following text there:

.param rt=5k
.param ra=rt*rp+1m
.param rb=rt-ra+1m
.param rp=0.5

Change rt to the value of your pot, 5k in this case. Vary rp from 0 to 1 to set the wiper position. You can use the .step command to make several simulation runs with different wiper settings, like .step param rp 0 1 0.1: that will yield 11 runs with 10%-steps from 0 to 1, ie. one full turn from left to right.


Plot resistance values

This may come in handy for arbitrary voltage sources or things like Zener diodes. Hold down the ''ALT'' key and left-click on the part you're interested in. That will add a plot for the device power (you already knew that one, right?) with a title like V(N010,ac)*I(D1). Now right-click on that title in the waveform viewer and change the asterisk into a slash, so that the expression reads V(N010,ac)/I(D1). The scale will change from watts to ohms and there you are.


Simulate a RTD in the time domain

Sometimes you may wish to simulate a nonlinear resistance in you transient analysis, according to some special behaviour. Let's say we're simulating a soldering station and we want to see what the controller does when the temperature varies several degrees around the setpoint. Would be nice if we could just set up a SINE or PULSE stimulus like we can do for voltages, but vary a resistance value instead, according to some magical arcane formula. So let's do this. Add a voltage source first and set it up to your liking. One volt will be one kelvin of temperature change. Press ''G'' and place a ground symbol to the negative pin; press ''F4'', enter pt, and place that label on the positive pin. You can actually call it what you want, but you'll have to accommodate for that in the following formula. We need some additional parameters for that, so add the following text as a spice directive (press ''S''):

.param pta=3.9083e-3
.param ptb=-5.775e-7
.param ptr0=100

As you may have guessed, we're designing a platinum temperature sensor here, like it is used by manufacturers like Weller. The parameter ptr0 sets the base value of the sensor at 0°C. You can easily adapt that to the common values of PT100 or PT1000. Bear in mind though that I have simplified the formula a little and left out the third term, which makes this model only accurate for temperatures above the freezing point! Finally, add a resistance and assign it the following value:


The term v(pt) resembles our voltage value and is thus the proxy for our changing temperature value. Of course this works with fixed DC voltages or stepped sources, as well as with any other voltage node, like the output of an op amp.


(more stuff to follow)